Commit graph

35820 commits

Author SHA1 Message Date
Yuneng Jiang
6680850c43
chore: fixes 2026-04-04 23:39:58 -07:00
Ishaan Jaffer
5a0db7b6b5 fix PEP 479 regression in __anext__ sync iterator exhaustion
asyncio.to_thread re-raises thread exceptions inside a coroutine, where
PEP 479 converts StopIteration to RuntimeError before any except clause
can catch it. Add _next_sync_or_exhausted() module-level helper that
catches StopIteration in the thread and returns a sentinel instead, then
raise StopAsyncIteration in the coroutine.

Also rewrites the non-blocking test to use asyncio.gather() instead of
asyncio.create_task() (which returned None on Python 3.9 / pytest-asyncio
in CI), and adds an exhaustion regression test that drains the wrapper
fully and asserts no RuntimeError leaks out.
2026-03-19 20:26:19 -07:00
Emerson Gomes
1373debd61 Update tests/test_litellm/litellm_core_utils/test_streaming_handler.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-19 19:43:50 -07:00
Emerson Gomes
e38a0a6c40 Fix blocking sync next 2026-03-19 19:43:50 -07:00
Krrish Dholakia
3093ef844e fix: document new config_settings.md 2026-03-19 18:57:02 -07:00
Krish Dholakia
48e9d0b271
Merge pull request #24140 from devin-petersohn/feat/anthropic-auth-token-and-base-url
feat(anthropic): support ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL env vars
2026-03-19 18:50:48 -07:00
Krish Dholakia
3a0652c445
Merge branch 'main' into feat/anthropic-auth-token-and-base-url 2026-03-19 18:41:19 -07:00
Krish Dholakia
2900e0e384
Merge pull request #24090 from joereyna/fix/release-notes-v1-82-3-helicone-langfuse
docs(release-notes): complete v1.82.3 changelog with full PR audit
2026-03-19 18:33:02 -07:00
Krish Dholakia
29647856b5
Merge branch 'main' into fix/release-notes-v1-82-3-helicone-langfuse 2026-03-19 18:32:38 -07:00
Krish Dholakia
d8b28141b9
Merge pull request #24173 from joereyna/fix/black-format-batch-3
chore: apply black formatting to fix lint CI (batch 3)
2026-03-19 18:27:30 -07:00
joereyna
87b5039aaa chore: apply black formatting to fix lint CI (batch 3) 2026-03-19 18:11:40 -07:00
Krish Dholakia
482b77e71d
Merge pull request #24081 from BerriAI/litellm_oss_staging_03_18_2026
Litellm oss staging 03 18 2026
2026-03-19 17:58:07 -07:00
Krish Dholakia
8d92d8637d
Merge branch 'main' into litellm_oss_staging_03_18_2026 2026-03-19 17:57:55 -07:00
Krish Dholakia
b1731b6798
Merge pull request #24168 from BerriAI/cursor/litellm-license-key-environment-16b4
docs: add LiteLLM license key environment variable instructions
2026-03-19 17:35:33 -07:00
Cursor Agent
e668ca310d
docs: add LiteLLM license key environment variable instructions
Added a new section to the config.yaml documentation explaining how to
set the LITELLM_LICENSE environment variable for enterprise features.

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-03-20 00:28:21 +00:00
yuneng-jiang
35d4984033
Merge pull request #24167 from joereyna/fix/black-format-types
chore: apply black formatting to proxy/_types.py to fix lint CI
2026-03-19 17:25:08 -07:00
joereyna
6f1bac07e5 chore: apply black formatting to proxy/_types.py to fix lint CI 2026-03-19 17:11:04 -07:00
yuneng-jiang
0781f68b8a
Merge pull request #24150 from BerriAI/litellm_yj_march_18_2026
[Infra] Merge daily internal branch with main
2026-03-19 16:43:47 -07:00
yuneng-jiang
7b600cdbfe linting 2026-03-19 16:31:50 -07:00
yuneng-jiang
f60e3cfd34 remove returning key in error message 2026-03-19 16:29:51 -07:00
yuneng-jiang
05620c87e3 [Fix] Update bulk key update tests for find_unique refactor
Tests were outdated after _get_and_validate_existing_key was refactored
to use prisma_client.db.litellm_verificationtoken.find_unique() and
ProxyException. Also add ProxyException handling in bulk_update_keys
error extractor so error messages aren't empty.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 15:34:44 -07:00
yuneng-jiang
2d3cff99fe
Merge pull request #24159 from joereyna/fix/add-poetry-lock-check
chore: add poetry check --lock to lint CI to prevent stale lockfile merges
2026-03-19 14:48:11 -07:00
joereyna
d118bf4818 chore: add poetry check --lock to lint CI to prevent stale lockfile merges 2026-03-19 14:36:02 -07:00
yuneng-jiang
e86ca7f34d Revert "[Fix] Update tests for _get_and_validate_existing_key refactor"
This reverts commit cf63697703.
2026-03-19 14:32:14 -07:00
Joe Reyna
2df965513e
Merge pull request #24153 from joereyna/fix/black-format-lint-2
chore: apply black formatting to fix lint CI (batch 2)
2026-03-19 12:56:48 -07:00
Krish Dholakia
739356640b
Merge pull request #24120 from BerriAI/litellm_proxy-azure-api-version-bump
feat(proxy): use AZURE_DEFAULT_API_VERSION for proxy --api_version default
2026-03-19 12:54:14 -07:00
yuneng-jiang
cf63697703 [Fix] Update tests for _get_and_validate_existing_key refactor
Tests were outdated after _get_and_validate_existing_key was refactored
to use prisma_client.db.litellm_verificationtoken.find_unique() instead
of prisma_client.get_data(), and to raise ProxyException instead of
HTTPException. Also fix bulk_update_keys error handler to extract
ProxyException.message (str(ProxyException) returns empty string).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 12:41:11 -07:00
joereyna
004d8d01f6 chore: apply black formatting to fix lint CI 2026-03-19 12:39:39 -07:00
Devin Petersohn
f784da41af Fix get_complete_url to honour ANTHROPIC_BASE_URL in experimental passthrough
Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-19 12:37:12 -07:00
yuneng-jiang
c2b8ba8b1b [Fix] Resolve mypy errors in key_management_endpoints.py
Add None guard for prisma_client before calling update_data, and add
"unblocked" to AUDIT_ACTIONS literal type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 12:28:56 -07:00
yuneng-jiang
dfcf978745
Merge pull request #24092 from joereyna/fix/black-format-lint
chore: apply black formatting to fix lint CI
2026-03-19 12:22:48 -07:00
Devin Petersohn
b7e2269942 Address review feedback: fix OAuth routing in get_auth_header and self-contained validate_environment
Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-19 12:17:00 -07:00
yuneng-jiang
afb35204ce Merge remote-tracking branch 'origin' into litellm_yj_march_18_2026 2026-03-19 11:53:58 -07:00
Devin Petersohn
41d9ecfebc Address feedback
Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-19 10:36:04 -07:00
Ishaan Jaff
81dadb698a
Ishaan - March 18th changes (#24056)
* add DD Tracing (#24033)

* feat(models): add Azure GPT-5.4 mini and nano variants (#24045)

Add `azure/gpt-5.4-mini` and `azure/gpt-5.4-nano` to the model
database with official pricing from Azure OpenAI:

- GPT-5.4 mini: $0.75/M input, $0.075/M cached, $4.5/M output
- GPT-5.4 nano: $0.20/M input, $0.02/M cached, $1.25/M output

Both models support:
- 1.05M input / 128K output context window
- Chat, batch, and responses endpoints
- Function calling, tools, vision, reasoning
- Prompt caching with automatic tiered pricing

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* Add new model pricing details for volcengine Doubao-Seed-2.0 series (#23871)

Add entries for volcengine Doubao-Seed-2.0 series

* fix(mcp): support refresh_token grant type in OAuth token endpoint (#23701)

* fix(mcp): support refresh_token grant type in OAuth token endpoint (#23700)

The .well-known/oauth-authorization-server metadata advertises
refresh_token as a supported grant type, but the token endpoint
rejected it with HTTP 400. This adds refresh_token grant support
so MCP clients can refresh expired tokens without re-authenticating.

* test(mcp): add tests for refresh_token grant type in OAuth token endpoint

* fix(mcp): move code_verifier guard into authorization_code branch

code_verifier is only relevant for authorization_code grants (PKCE).
Move it inside the else branch so it doesn't apply to refresh_token.

* fix(mcp): guard None client_secret and forward scope in token exchange

- Conditionally include client_secret in form data to prevent httpx
  from sending the literal string "None" (applies to both
  authorization_code and refresh_token branches)
- Forward optional scope parameter per RFC 6749 §6, allowing clients
  to request a subset of originally-granted scopes on refresh

* fix(mcp): validate code param in authorization_code grant

Guard against None code being form-encoded as literal string "None"
by httpx, symmetric with the existing refresh_token guard.

* docs: add incident report for guardrail logging secret exposure (#24059)

Add blog post documenting the guardrail logging path exposing internal
request data (e.g. Authorization headers) in spend logs and OTEL traces.
Fix available in LiteLLM 1.82.3+.

Made-with: Cursor

* [Fix] Datadog LLM Observability tags format (env, service, version missing) (#23673)

* tag fix

* greptile comment

* fix(ci): stabilize 6 failing CI jobs

1. mypy: remove duplicate type annotation for token_data in discoverable_endpoints.py
2. integrations tests: add parameterized to CI test deps
3. doc quality: document OTEL_IGNORE_CONTEXT_PROPAGATION env key
4. security: allowlist CVE-2026-2673, CVE-2026-3644, CVE-2026-4224 (no fix available)
5. proxy_store_model_in_db: fix missing x-litellm-call-id header on error responses
6. google tests: add --retries 3 for transient Vertex AI rate limits

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* fix(streaming): handle RuntimeError during model_copy in streaming handler

The race condition occurs when model_copy(deep=True) tries to deepcopy
_hidden_params dict while it's being concurrently modified by logging
callbacks. Fall back to shallow copy if the deep copy fails.

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* fix(cost): handle non-string traffic_type in cost calculator + add retries

1. Fix AttributeError in _map_traffic_type_to_service_tier when traffic_type
   is an integer (cast to str before calling .upper()). This was causing
   pass-through vertex spend logging to fail silently.
2. Add --retries to llm_translation_testing for flaky external API calls.

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

---------

Co-authored-by: Emerson Gomes <emerson.gomes@thalesgroup.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: ExMatics HydrogenC <33123710+HydrogenC@users.noreply.github.com>
Co-authored-by: Jack Venberg <jack.venberg@rover.com>
Co-authored-by: milan-berri <milan@berri.ai>
Co-authored-by: Shivam Rawat <161387515+shivamrawat1@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-03-19 10:20:35 -07:00
Devin Petersohn
f415b72bcf feat(anthropic): support ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL env vars
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Devin Petersohn <devin.petersohn@gmail.com>
2026-03-19 10:16:30 -07:00
Sameer Kankute
b9564834e6 Fix mypy errors 2026-03-19 16:18:06 +05:30
Sameer Kankute
067dab42e6 refactor: reduce statement count in langsmith and anthropic methods
- Extract helper methods in langsmith._prepare_log_data to reduce from 51 to <50 statements
- Extract helper methods in anthropic.transform_parsed_response to reduce from 57 to <50 statements
- Fixes PLR0915 linter errors
- All existing tests pass (10 langsmith tests, 126 anthropic tests)

Made-with: Cursor
2026-03-19 16:16:23 +05:30
Sameer Kankute
532e0d13df feat(proxy): use AZURE_DEFAULT_API_VERSION for proxy --api_version default
Aligns proxy default with litellm.AZURE_DEFAULT_API_VERSION (2025-02-01-preview)
so Azure response_format + json_schema works without tools fallback.

Made-with: Cursor
2026-03-19 15:57:03 +05:30
joereyna
d5ef754950 docs(release-notes): align v1.82.3 notes with release notes guide
- Add MCP Gateway section (moved from Management per guide rule §11)
- Rename Spend Tracking → Spend Tracking, Budgets and Rate Limiting
- Fix Hashicorp Vault doc link: docs/secret → docs/secret_managers
- Fix LLM API section: #### Bug Fixes → #### Bugs (matches guide)
- Add Documentation Updates section (required by guide §11)
- Update Diff Summary: correct section names, add MCP Gateway and
  Documentation Updates counts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 23:35:40 -07:00
joereyna
61df7471ba docs(release-notes): complete v1.82.3 changelog with 30+ missing features
Full audit of 371 PRs in v1.82.0-stable...v1.82.3-stable range.
Adds previously undocumented user-facing changes:

- Key Highlights: Hashicorp Vault, Responses WebSocket, Org Admin RBAC,
  guardrail mode defaults
- New Providers: Google Search API, Bedrock Mantle (7 total, was 5)
- LLM API: Anthropic Files API, Mistral Voxtral transcription, WebRTC,
  Responses WebSocket, litellm.acount_tokens() public API, OpenRouter
  image edit, Vertex AI VIDEO token tracking, input_fidelity image edit,
  model cost aliases, per-request json schema validation, 15+ bug fixes
- Management: RBAC expansion for Org Admins, Vector Store CRUD, MCP
  token auth + team scoping, BYOK key precedence, virtual key spend reset,
  batch expiry for teams, Admin Viewer audit log access, 12+ bug fixes
- Guardrails: mode default list, tag-based modes, presidio fix, OTEL fix
- Secret Managers: Hashicorp Vault (was "no changes")
- Spend Tracking: new section — budget-linked reset fix, flex pricing,
  spend log cleanup, WebSearch dedup fix
- Performance: 4 additional reliability fixes
- Diff summary counts updated to reflect actual scope

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 23:30:42 -07:00
joereyna
dab8721ba3 chore: apply black formatting to fix lint CI 2026-03-18 22:57:38 -07:00
joereyna
bba3b1fe4c docs(release-notes): add missing Helicone and Langfuse entries to v1.82.3 changelog
Helicone (PRs #19288, #22603) and Langfuse (#22390) were present in the
v1.82.0-stable...v1.82.3-stable diff but omitted from the AI Integrations
logging section. Also updates the AI Integrations diff summary count from 2 to 4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 22:42:25 -07:00
Krish Dholakia
e5baa2232f
Merge pull request #24082 from joereyna/fix/poetry-lock-content-hash 2026-03-18 22:04:08 -07:00
Krish Dholakia
547a73120e
Merge pull request #24083 from BerriAI/cursor/missing-guardrails-docs-143b
docs: add Contributing to Guardrails section to Guardrail Providers sidebar
2026-03-18 21:54:24 -07:00
Cursor Agent
df38fbcc97
docs: add Contributing to Guardrails section to Guardrail Providers sidebar
- Add 'Contributing to Guardrails' category with links to:
  - Generic Guardrail API (integrate without PR)
  - Adding a New Guardrail Integration tutorial
  - Adding Guardrail Support to Endpoints

- Add 'Team Bring-Your-Own Guardrails' link for team BYOG workflow

These docs existed but were only accessible from the 'LiteLLM AI Gateway'
sidebar. Now they're also accessible when browsing the 'Guardrail Providers'
section.

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-03-19 04:47:30 +00:00
Krish Dholakia
49443cc08c
Merge pull request #24080 from BerriAI/litellm_dev_03_18_2026_p1
fix: fix logging for response incomplete streaming + custom pricing on /v1/messages and /v1/responses
2026-03-18 21:45:17 -07:00
Krish Dholakia
11f0f061bc
Merge pull request #18120 from hytromo/improve-llm-repeated-message-detection-performance
Fix model repetition detection performance
2026-03-18 21:43:03 -07:00
Krrish Dholakia
08f0cbc2e9 fix: address greptile feedback 2026-03-18 21:36:39 -07:00
Krish Dholakia
5c93c107d9
Merge pull request #24043 from themavik/fix/24001-langsmith-usage-metadata
fix(langsmith): populate usage_metadata in outputs for Cost column
2026-03-18 21:30:23 -07:00