Commit graph

35825 commits

Author SHA1 Message Date
yuneng-jiang
896e7b7623
Merge pull request #23367 from BerriAI/litellm_auto_redirect_sso_config
[Feature] Support auto_redirect_ui_login_to_sso in config.yaml
2026-03-11 14:37:24 -07:00
yuneng-jiang
3968146f67
Merge pull request #23363 from BerriAI/litellm_fix_is_master_key_none_api_key
[Fix] TypeError in spend tracking when request has no API key
2026-03-11 14:34:44 -07:00
yuneng-jiang
9c0cd6e02e Fix ruff lint errors: unused imports, undefined names, and statement counts
Remove unused imports (F401), add missing TYPE_CHECKING imports for
forward references (F821), and extract helpers to reduce statement
counts below the 50-statement limit (PLR0915).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:34:43 -07:00
Cesar Garcia
f8cf97710e
Merge pull request #17724 from peterkc/refactor/files-api-type-aliases
refactor(files): add type aliases for provider parameters
2026-03-11 18:04:45 -03:00
Chesars
296dcae60f Merge upstream/litellm_oss_staging_03_11_2026 and resolve conflicts
Update type aliases to include anthropic provider added in base branch.
2026-03-11 17:59:25 -03:00
Chesars
6c6585af56 Merge litellm_oss_staging_03_11_2026 into refactor/files-api-type-aliases
Resolve merge conflicts in litellm/files/main.py by updating type
aliases to include new providers (gemini, manus) and preserving the
expires_after parameter added in the base branch.
2026-03-11 17:55:52 -03:00
yuneng-jiang
b5dfde892c
Merge pull request #23377 from BerriAI/litellm_fix_flaky_mcp_and_agentcore_tests
[Fix] Flaky MCP Server and AgentCore Streaming Tests
2026-03-11 13:20:59 -07:00
yuneng-jiang
13c0741262 Memoize expensive computations in UsagePageView to prevent unnecessary recalculations on every render
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:20:50 -07:00
Mr. Ånand
05fba27b0c
Add Retool Assist tutorial with LiteLLM Proxy to docs (#21952)
* docs: add Retool Assist integration guide

- Add tutorials/retool_assist.md with setup instructions
- Add screenshots: Resources screen, Custom Provider config, resource query test
- Add retool_assist to AI Tools sidebar

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: refine Retool Assist guide layout

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: update Retool Assist guide with new screenshots

- Add Resources screen after step 1
- Update AI category and LiteLLM config modal images

Co-authored-by: Cursor <cursoragent@cursor.com>

* Apply suggestion from @greptile-apps[bot]

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* updated blank line

* Added video & gifs

Made-with: Cursor

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-11 13:17:08 -07:00
Cesar Garcia
8d2432b21b
Merge pull request #23373 from Chesars/style/black-format-codebase
style: run black formatter on /litellm
2026-03-11 17:13:37 -03:00
yuneng-jiang
64d3d7626f [Fix] Flaky MCP server and AgentCore streaming tests in CI
- MCP tests: set mock_mcp_server.oauth2_flow = None to prevent MagicMock
  leaking into Pydantic Literal validation for MCPServer
- AgentCore tests: pass api_key="test-jwt-token" to bypass SigV4 credential
  lookup that fails in CI without AWS credentials

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:08:48 -07:00
Chesars
2e9f057fbd style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
yuneng-jiang
08bb3808bc
Merge pull request #23374 from BerriAI/ui_build_fix_mar11
[infra] Fixing UI Build and Tests
2026-03-11 12:55:58 -07:00
yuneng-jiang
d415ffc70b fixing ui build and tests 2026-03-11 12:55:16 -07:00
Ryan Crabbe
2773adba6d fix(ui): move timezone search icon to the left side in date picker 2026-03-11 12:20:34 -07:00
Carlo Alberto Ferraris
d398d1f9b9
fix: use group_by instead of find_many(distinct) in /tag/list to avoid full table scan (#23136)
* fix: use group_by instead of find_many(distinct) in /tag/list to avoid full table scan

The list_tags endpoint used Prisma's find_many(distinct=["tag"]) to discover
dynamic tags from LiteLLM_DailyTagSpend. Prisma's distinct is a client-side
post-processing filter that fetches all rows with all columns before
deduplicating, causing a full table scan of 3M+ rows on every usage page load.

Replace with Prisma's group_by() which generates proper GROUP BY SQL, letting
the database handle deduplication efficiently. NULL tags are filtered out via
where={"tag": {"not": None}}, and created_at/updated_at are preserved via
_min/_max aggregates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review feedback

- Remove unused LiteLLM_DailyTagSpendTable class and datetime import
- Simplify created_at/updated_at access (values guaranteed by spend system)
- Remove DB call assertions from tests, keep response-only assertions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: RheagalFire <arishalam121@gmail.com>
2026-03-12 00:32:37 +05:30
Ryan Crabbe
bc3a54d49d fix: refetching mcp after creating 2026-03-11 11:56:01 -07:00
Carlo Alberto Ferraris
c7e3b11da8
fix: batch key queries in list_team to eliminate N+1 (#23152)
* fix: batch key queries in list_team to eliminate N+1

The list_team endpoint issued one DB query per team to fetch keys,
causing N+1 query overhead. Replace with a single batched IN query.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review feedback on team list test

- Rename test to include "v1" for consistency with other test names
- Remove unnecessary DB call assertion, keep behavioral assertions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: RheagalFire <arishalam121@gmail.com>
2026-03-12 00:17:17 +05:30
yuneng-jiang
e5245adae6 Support auto_redirect_ui_login_to_sso in config.yaml general_settings
Previously this setting was only honored via the AUTO_REDIRECT_UI_LOGIN_TO_SSO
environment variable. Now it can also be set in config.yaml under general_settings,
matching the pattern used by other proxy settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:34:17 -07:00
Cesar Garcia
cb24b8b05e
Merge pull request #19104 from Chesars/fix/vertex-ai-zai-org-global-region
feat(vertex_ai): route region for partner models and add GLM support
2026-03-11 15:19:33 -03:00
Cesar Garcia
59c24b7405
Merge pull request #17717 from Chesars/docs/responses-api-bridge-clarification
docs: clarify when to use openai/responses/ prefix for built-in tools
2026-03-11 15:18:32 -03:00
Cesar Garcia
57e73c8f5e
Merge pull request #20795 from Chesars/chore/remove-deprecated-models
chore: cleanup deprecated models from pricing JSON
2026-03-11 15:18:13 -03:00
Chesars
3948513a4c fix(vertex-ai): warn on region override and remove dead is_global_only_vertex_model
Add verbose_logger.warning when user-specified region is overridden by
supported_regions. Remove now-unused is_global_only_vertex_model function
and its tests since get_vertex_region handles all region logic directly.
2026-03-11 15:12:53 -03:00
Chesars
1a3fdc7ae3 fix: align Vertex AI Claude deprecations with Google's schedule
- Restore vertex_ai/claude-3-7-sonnet@20250219 (Vertex AI shutdown is
  May 11, 2026, still active — was incorrectly removed based on
  Anthropic API retirement date)
- Remove vertex_ai/claude-3-5-sonnet-v2 and
  vertex_ai/claude-3-5-sonnet-v2@20241022 (Vertex AI shutdown was
  Feb 19, 2026, already past)
- Remove deprecated claude-3-7-sonnet-20250219 from web search test,
  use only non-deprecated models

Source: https://docs.google.com/vertex-ai/generative-ai/docs/deprecations/partner-models
2026-03-11 15:11:07 -03:00
yuneng-jiang
1a08ac6619 Fix TypeError in _is_master_key when api_key is None
When a request arrives without an API key, auth fails and the failure
hook triggers spend tracking. _is_master_key was called with api_key=None,
causing secrets.compare_digest to raise TypeError. Add a None guard for
api_key matching the existing guard for _master_key.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:01:29 -07:00
RJ Duffner
0c95d415e1
Add Abilty To Set minReadySeconds From values Files (#23173)
* Add Abilty To Set minReadySeconds From values Files

* typo

* uppercase Min as it comes after deployment

* Don't use defaults, just omit
2026-03-11 23:29:15 +05:30
Chesars
f3ceb69e9f fix(vertex-ai): override unsupported user region for models with supported_regions
- get_vertex_region now overrides user-specified region when it's not in
  the model's supported_regions list (prevents 404 for users with a
  global VERTEXAI_LOCATION default hitting global-only models)
- Add supported_regions: ["global"] to glm-5-maas in both JSON files
- Update tests to cover the override behavior
2026-03-11 14:55:51 -03:00
yuneng-jiang
1d1baa2cd5
Merge pull request #23362 from BerriAI/litellm_ui_model_mcp
[Fix] Null safe checks for MCP Hub Tab
2026-03-11 10:50:54 -07:00
Chesars
d81d751af0 fix(tests): update tests to use models still present in pricing JSON
Replace removed deprecated models (claude-3-5-sonnet-20241022,
claude-3-5-haiku-20241022, claude-3-5-haiku-latest) with current
models in web_search and cost calculation tests.
2026-03-11 14:50:47 -03:00
yuneng-jiang
8af34ffebc null-safe array checks 2026-03-11 10:35:51 -07:00
Chesars
689cbaa6c1 fix(vertex-ai): update tests to match new get_vertex_region model_cost lookup
- Remove redundant get_vertex_region() call in partner models main.py
  (already called inside get_complete_vertex_url)
- Rewrite test mocks to use patch.dict(litellm.model_cost) instead of
  patching the removed is_global_only_vertex_model symbol
- Align test assertions with new behavior: user-specified region is
  preserved (not overridden) for global-only models
2026-03-11 14:25:08 -03:00
Chesars
45ca8b5b2b chore: resolve merge conflicts with upstream/main
Accept upstream's new models and re-apply removal of 133 deprecated models.
2026-03-11 14:24:53 -03:00
Chesars
f9a538b583 fix(docs): close unclosed code block before Examples heading 2026-03-11 14:15:54 -03:00
Cesar Garcia
274bf42493
Update docs/my-website/docs/providers/openai.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-11 14:13:56 -03:00
Chesars
9e7a6a73ed docs: remove duplicate gpt-5.4 tip block 2026-03-11 13:48:47 -03:00
Chesars
01a6c707a3 docs: restore gpt-5.4 reasoning_effort tip lost during rebase 2026-03-11 13:48:07 -03:00
Chesars
d0d09e037e docs: clarify when to use openai/responses/ prefix for built-in tools
The existing documentation for the Responses API bridge only showed
examples with models that have `mode: responses` (like o3-deep-research),
which work automatically. This update clarifies that models with
`mode: chat` (like gpt-4o, gpt-5) require the `openai/responses/` prefix
to use built-in tools like web_search_preview.

Changes:
- Explain the `mode` property from model_prices_and_context_window.json
- List models with mode: responses vs mode: chat
- Add example showing the common error and how to fix it
- Add SDK example using the prefix with gpt-4o
- Update proxy example with both automatic and prefix-based configs
- Fix invalid trailing comma in original JSON example
2026-03-11 13:47:57 -03:00
Cesar Garcia
ebe75a1bc6
Merge pull request #16594 from Chesars/feat/anthropic-files-api
feat: Add Anthropic Files API support
2026-03-11 13:45:53 -03:00
michelligabriele
24ad510617
feat(mcp): add AWS SigV4 auth support in UI and fix credential merge on edit (#23282) 2026-03-11 09:43:28 -07:00
Aarish Alam
3bbadca6e2
Clean up skills test: remove duplicate imports, parameterize mock HTTP method (#23360)
Address review comments from PR #23325:
- Remove duplicate `from unittest.mock import MagicMock, patch` and unused `json` import
- Parameterize HTTP method in `_make_mock_response` helper so mock requests
  use the correct method (GET/POST/DELETE) matching each test scenario
2026-03-11 22:10:27 +05:30
Chesars
d7c2532137 fix: remove redundant import os, use Path().name instead 2026-03-11 13:37:52 -03:00
Joe Reyna
ca910a8fa0
Replace broken Anthropic Skills API integration test with unit tests (#23325)
* Replace broken Anthropic Skills API integration test with unit tests

* Update tests/test_litellm/test_anthropic_skills_transformation.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: Aarish Alam <arishalam121@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-11 22:00:08 +05:30
Chesars
abe0c40c1a fix: clarify purpose field docstring in AnthropicFilesConfig 2026-03-11 13:23:24 -03:00
Chesars
8d4e98faa1 fix(vertex-ai): remove unused import is_global_only_vertex_model 2026-03-11 13:19:12 -03:00
Chesars
bb5d57645f docs: add VertexAI ZAI (GLM) documentation 2026-03-11 13:18:12 -03:00
Chesars
c723d63e59 fix(vertex_ai): auto-resolve vertex_location from supported_regions
- Add call to get_vertex_region() in partner models to auto-detect region
- Improve get_vertex_region() to read supported_regions from model_cost
- User-specified vertex_location still takes priority
2026-03-11 13:18:12 -03:00
Chesars
c63b7965bd fix(vertex_ai): add supported_regions for zai-org/glm-4.7-maas
Add `supported_regions: ["global"]` to the GLM-4.7 model configuration
so that LiteLLM automatically uses the correct global endpoint.

Without this, users must manually specify `vertex_location: global`,
otherwise LiteLLM defaults to us-central1 which returns 404.
2026-03-11 13:18:12 -03:00
Chesars
093cca9f57 chore: remove unused AnthropicFilesHandler import and instance 2026-03-11 13:12:40 -03:00
Chesars
b601b531e7 fix: use calendar.timegm for UTC timestamps and reuse AnthropicError
Address Greptile review feedback:
- Use calendar.timegm() instead of time.mktime() for correct UTC parsing
- Import AnthropicError from common_utils instead of redefining it
2026-03-11 13:03:49 -03:00
Chesars
9eff611b1a feat(anthropic): add Files API support for SDK
Implement Anthropic Files API (upload, retrieve, list, delete, content)
using the BaseFilesConfig provider pattern. Adds multipart form-data
support to BaseLLMHTTPHandler for file uploads.
2026-03-11 12:45:19 -03:00