Commit Graph
34559 Commits
Author SHA1 Message Date
Ryan Crabbe 37de206c5b polish changes 2026-03-07 08:58:28 -08:00
Ryan Crabbe 8388e77b59 wire in the hashicorp settings 2026-03-06 18:26:30 -08:00
Ryan Crabbe 1a395e1bae Merge branch 'main' into litellm_hashicorp_vault_frontend 2026-03-06 18:12:15 -08:00
0e78aa4cf1 feat: add Azure AI grok-4-1-fast model support (#22587)
Add support for Grok 4.1 Fast models in Azure AI Foundry:
- azure_ai/grok-4-1-fast-non-reasoning
- azure_ai/grok-4-1-fast-reasoning

Pricing: $0.2/M input tokens, $0.5/M output tokens
Context window: 131k tokens

Source: https://techcommunity.microsoft.com/t5/Azure-AI-Foundry-Blog/Grok-4-0-Goes-GA-in-Microsoft-Foundry-and-Grok-4-1-Fast-Arrives/ba-p/4497964

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 18:10:40 -08:00
Ishaan JaffGitHubCursor AgentIshaan Jaffgreptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
b7b20664c1 Gflags worker parameters (#22931)
* feat: add LITELLM_WORKER_STARTUP_HOOKS for per-worker initialization (gflags support)

Add support for running user-defined startup hooks in each worker process
during proxy_startup_event. This enables re-initialization of in-process
state (like gflags.FLAGS) that doesn't survive uvicorn worker spawning.

Usage:
  export LITELLM_WORKER_STARTUP_HOOKS=mymodule:init_fn,other:setup_fn

Hooks run early in proxy_startup_event (before config/DB loading).
Supports both sync and async callables. Errors propagate to prevent
broken workers from serving traffic. No-op when env var is unset.

Includes 5 tests covering sync/async hooks, multiple hooks, error
propagation, and no-hooks-set scenarios.

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

* docs: add Worker Startup Hooks page with gflags usage example

- New docs page: docs/proxy/worker_startup_hooks.md
  - Explains the problem (per-process state lost in multi-worker deployments)
  - Full gflags example with wrapper module and startup script
  - Covers multiple hooks, async hooks, error behavior
  - Architecture diagram showing master→worker flow
- Added LITELLM_WORKER_STARTUP_HOOKS to config_settings.md env var table
- Added to sidebar under Setup & Deployment

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

* Update litellm/proxy/proxy_server.py

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

* Apply suggestion from @greptile-apps[bot]

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-06 18:09:57 -08:00
Ishaan JaffandGitHub bb52b0b6b0 fix(mcp): resolve $ref params and path-level params in OpenAPI spec parsing (#22952)
* fix(mcp): resolve \$ref params and merge path-level params in OpenAPI tool registration

Real-world OpenAPI specs (e.g. GitHub's 11.8 MB official spec) use two
patterns that crashed tool registration:

1. \$ref parameters: params defined as {"$ref": "#/components/parameters/foo"}
   instead of inline objects. Accessing param["name"] on a $ref raises KeyError.
   Fix: resolve each param against components/parameters before processing.

2. Path-level parameters: params defined on the path object apply to all
   HTTP methods on that path, but the operation object doesn't include them.
   GitHub's spec uses this for owner/repo/etc. path params.
   Fix: merge path-level params with operation-level params (op-level wins
   when the same name+in combination appears in both).

With this fix the full GitHub REST API spec loads successfully:
720 paths → 1079 tools, all with correct parameter schemas.

* fix(mcp): resolve \$ref params in OpenAPI preview endpoint (test/tools/list)

The _preview_openapi_tools function (called by the UI add-server form to show
connection status and available tools) had the same bug as _register_openapi_tools:
it accessed param["name"] directly without resolving \$ref parameters or merging
path-level parameters from the path item.

This caused "Failed to load OpenAPI spec: 'name'" for any spec that uses
component-level parameter references (e.g. GitHub's official REST API spec).

Apply the same fix: resolve \$ref against components/parameters and merge
path-level params (with operation-level taking priority) before building schemas.

* refactor(openapi-mcp): extract resolve_operation_params, add tests

- Hoist _resolve_ref and _resolve_param_list to module level in
  openapi_to_mcp_generator.py (were being redefined on every loop iteration)
- _resolve_ref now returns None for unresolvable $refs instead of
  the stub dict, preventing (None, None) from poisoning deduplication
- Add resolve_operation_params() as a shared helper that handles both
  $ref resolution and path-level param merging
- Replace duplicated inline logic in mcp_server_manager.py and
  rest_endpoints.py with calls to resolve_operation_params()
- Add TestResolveRef, TestResolveParamList, TestResolveOperationParams
  test classes covering $ref resolution, path-level merging, collision
  semantics, unresolvable ref filtering, and a GitHub-style spec fixture
2026-03-06 18:02:48 -08:00
yuneng-jiangandGitHub c2b03c15b9 Merge pull request #22939 from BerriAI/litellm_hashicorp_vault_backend
feat: Hashicorp Vault config override backend endpoints
2026-03-06 17:59:46 -08:00
Ryan Crabbe 6091621bec Build artifacts 2026-03-06 17:58:49 -08:00
Ryan Crabbe a9dcc1ab37 bump: version 0.4.50 → 0.4.51 2026-03-06 17:55:12 -08:00
Ryan Crabbe b87133ae04 fix json loads, migration file 2026-03-06 17:52:31 -08:00
yuneng-jiangandGitHub 5c8bd6a6ca Merge pull request #23006 from BerriAI/litellm_policy_component_tests
[Test] UI - Policies: Add unit tests for 5 untested components
2026-03-06 17:36:02 -08:00
michelligabrieleandGitHub 8dc0c97958 fix(caching): check REDIS_CLUSTER_NODES env var in Cache and Router class selection (#22790)
When Redis Cluster is configured via the REDIS_CLUSTER_NODES environment
variable, Cache.__init__() and Router._create_redis_cache() ignored the
env var and always created RedisCache instead of RedisClusterCache. This
caused the v3 rate limiter's cluster detection (_is_redis_cluster()) to
return False, skipping hash-slot key grouping. The resulting CROSSLOT
errors were silently caught, falling back to per-instance in-memory
counting — breaking RPM/TPM enforcement across multiple proxy instances.

Add REDIS_CLUSTER_NODES env var detection to both Cache.__init__() and
Router._create_redis_cache(), matching the existing pattern in
_redis.py:215-220. When the env var is set and no explicit startup_nodes
parameter is provided, parse it and create RedisClusterCache.

Fixes #22748
Related to #20836
2026-03-06 17:31:30 -08:00
v0rtex20kandGitHub c64140e4c5 [Feat[ extends OAuth2 M2M authentication support to info routes (/key/info, /team/info, /user/info, /model/info) (#22713)
* added info_route

* greptile pt1

* greptile pt2

* greptile pt3
2026-03-06 17:29:25 -08:00
hliu-robloxandGitHub 07ac97aff4 feat(key_management): allow @ in key_alias for email-based aliases (#23003)
Adds @ to the _KEY_ALIAS_PATTERN allowed character set so that
key aliases like user/user@example.com are accepted. Updates tests
to cover email-based alias formats.
2026-03-06 17:24:42 -08:00
yuneng-jiangandClaude Sonnet 4.6 a0fb994ef0 [Test] Add unit tests for 5 untested policy components
Adds Vitest + RTL test files for policy_table, policy_templates,
guardrail_selection_modal, impact_popover, and add_attachment_form.
53 tests total covering rendering, user interactions, API calls,
and conditional UI behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 17:22:39 -08:00
Sameer KankuteandGitHub 3a2cba43dc Merge pull request #22992 from BerriAI/litellm_5.4_relase_flex
Add flex pricing
2026-03-07 01:03:45 +05:30
Sameer Kankute 6034efb9c6 Add flex pricing 2026-03-07 01:02:18 +05:30
Sameer KankuteandGitHub 11e2bdbaec Merge pull request #22981 from BerriAI/litellm_reasoning-effort-dict-normalization
feat(openai): normalize reasoning_effort dict to string for chat completion API
2026-03-07 00:37:07 +05:30
ryan-crabbeandGitHub 7d2681fa36 Merge pull request #22982 from BerriAI/litellm_fix_batch_stale_status
Fix batch list showing stale "validating" status after completion
2026-03-06 09:31:09 -08:00
5e34fdce77 feat(vertex_ai): support explicit AWS credentials for WIF auth (#21472)
* feat(vertex_ai): support explicit AWS credentials for WIF auth

The current Vertex AI AWS Workload Identity Federation implementation
exclusively uses google.auth.aws.Credentials.from_info(), which requires
EC2 instance metadata access to obtain AWS credentials. In environments
where the metadata service is blocked for security reasons, this makes
WIF unusable.

Add support for explicit AWS credentials by implementing a custom
AwsSecurityCredentialsSupplier (google-auth >= 2.29.0). When aws_* keys
(e.g. aws_role_name, aws_region_name) are present in the WIF credential
JSON, LiteLLM uses BaseAWSLLM.get_credentials() to obtain AWS creds via
STS AssumeRole (or any other supported AWS auth flow), wraps them in the
custom supplier, and passes them to aws.Credentials() — bypassing the
metadata service entirely.

When no aws_* keys are present, the existing from_info() flow is used
unchanged, preserving full backward compatibility.

* refactor(vertex_ai): extract AWS WIF auth to own class + add docs

Address PR review feedback:
- Move _AWS_CREDENTIAL_KEYS, _extract_aws_params(), and
  _credentials_from_aws_with_explicit_auth() from VertexBase into
  new VertexAIAwsWifAuth class in vertex_ai_aws_wif.py
- Add documentation for explicit AWS credentials WIF auth method
  in vertex.md (supported params, JSON example, SDK/Proxy tabs)

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

* fix(vertex_ai): use lazy credentials provider to prevent stale STS tokens

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 09:27:20 -08:00
Ryan Crabbe c4db53a98a Address review feedback: remove dead code, add error handling, strengthen test assertions
- Remove unused `completed_jobs` list (dead code after per-job update refactor)
- Wrap DB update in try/except to prevent one failed update from aborting remaining jobs
- Add test assertions verifying batch_processed, status, and file_object are written to DB
2026-03-06 09:25:50 -08:00
Sameer Kankute 7d524fe5a8 Fix model map 2026-03-06 22:49:37 +05:30
Sameer Kankute dd7ab3f01f Fix model map 2026-03-06 22:46:32 +05:30
Sameer Kankute a7967801b0 Fixed o file 2026-03-06 22:29:25 +05:30
Sameer Kankute 91fc91c9c3 Fixed o file 2026-03-06 22:27:09 +05:30
Sameer Kankute d8f139fe4d feat(openai): add 272K tier pricing for GPT-5.4/5.4-pro
Prompts >272K input tokens priced at 2x input, 1.5x output for full session
(standard, batch, flex). Applies to models with 1.05M context window (gpt-5.4,
gpt-5.4-pro).

- Add input/output_cost_per_token_above_272k_tokens to model_prices
- Add above_272k fields to ModelInfoBase and get_model_info extraction
- Add test_generic_cost_per_token_gpt54_above_272k_tokens

Made-with: Cursor
2026-03-06 22:26:14 +05:30
Ryan Crabbe 3d55f7f6ab Fix batch list showing stale "validating" status after completion
CheckBatchCost poller updated the status column but not the file_object
JSON column. The list_batches endpoint reads status from file_object,
so batches appeared stuck in "validating" even after Azure reported
them as completed. Now update file_object alongside status in the
per-job DB write.
2026-03-06 08:54:21 -08:00
Sameer Kankute 14b52b1318 feat(openai): drop reasoning_effort for gpt-5.4 when tools present
Function calls not supported with reasoning_effort != 'none' on gpt-5.4.
Drop reasoning_effort when tools are in the request (small minority of volume).

Made-with: Cursor
2026-03-06 22:20:47 +05:30
Sameer Kankute b6344c319b feat(openai): normalize reasoning_effort dict to string for chat completion API
The OpenAI chat completion API expects reasoning_effort as a string
('none', 'low', 'medium', 'high', 'xhigh'). Config/deployments may pass
the Responses API format: {'effort': 'high', 'summary': 'detailed'}.

Fix BadRequestError when model config uses dict format by extracting
the 'effort' value before passing to the API.

Made-with: Cursor
2026-03-06 22:17:11 +05:30
Sameer KankuteandGitHub 8b0375f99c Merge pull request #22888 from BerriAI/litellm_a2a-custom-headers
[Feat] Add a2a custom headers
2026-03-06 18:24:21 +05:30
Sameer KankuteandGitHub 447b760a83 Merge pull request #22964 from BerriAI/litellm_claude-code-byok
feat(proxy): Client-side provider API key precedence for Anthropic /v1/messages (BYOK)
2026-03-06 18:23:48 +05:30
Sameer Kankute e9d797bd8d fix(proxy): do not forward Authorization header to LLM provider when used for LiteLLM proxy auth
When forward_llm_provider_auth_headers=true, Authorization: Bearer <litellm-key> was
being forwarded to Anthropic if it looked like an OAuth key, causing auth failures.

Now checked against authenticated_with_header: if Authorization was used to authenticate
with the proxy, it is always stripped before forwarding to the LLM provider.

Made-with: Cursor
2026-03-06 18:20:48 +05:30
Sameer Kankute 159c477c18 feat(proxy): client-side provider API key precedence for Anthropic /v1/messages
- Add forward_llm_provider_auth_headers support from litellm_settings
- When enabled, client x-api-key takes precedence over deployment keys
- Forward x-api-key when x-litellm-api-key or Authorization used for auth
- Fix duplicate patch lines in test_byok_oauth_endpoints.py
- Add Claude Code BYOK documentation with /login and ANTHROPIC_CUSTOM_HEADERS
- Add unit tests for clean_headers x-api-key forwarding logic
- Sync model_prices backup (pre-commit hook)

Made-with: Cursor
2026-03-06 18:20:46 +05:30
Sameer KankuteandGitHub 118cad8b54 Merge pull request #22957 from BerriAI/litellm_azure-model-router-cost-tracking
feat(azure_ai): add router flat cost when response contains actual model
2026-03-06 18:18:51 +05:30
Sameer Kankute c23eb5afc6 feat(azure_ai): add router flat cost when response contains actual model
- Pass request_model to Azure AI cost calculator to detect router requests
- Add router flat cost ($0.14/M input tokens) even when Azure returns actual model in response
- Add test for router flat cost with response containing actual model
- Update docs with cost calculation flow and configuration requirements

Made-with: Cursor
2026-03-06 18:18:06 +05:30
Sameer KankuteandGitHub 0d699d06f1 Merge pull request #22953 from BerriAI/litellm_gpt5_reasoning_model_map
feat(gpt-5): Add supports_none_reasoning_effort and supports_xhigh_reasoning_effort to model cost map
2026-03-06 18:16:29 +05:30
Sameer Kankute 6ba2e9f10f feat(gpt-5): add supports_none_reasoning_effort and supports_xhigh_reasoning_effort to model cost map
- Shift from hardcoded model checks to dynamic lookup via _supports_factory
- Add supports_none_reasoning_effort for gpt-5.1/5.2/5.4 chat variants
- Add supports_xhigh_reasoning_effort for gpt-5.1-codex-max, gpt-5.2, gpt-5.4+
- Update model_prices_and_context_window.json and backup
- Add ProviderSpecificModelInfo types for new fields
- Fix Azure: use _supports_reasoning_effort_level instead of removed is_model_gpt_5_1_model

Made-with: Cursor
2026-03-06 18:15:32 +05:30
yuneng-jiangandGitHub 8523bb6b48 Merge pull request #22956 from BerriAI/litellm_key_null_duration
[Fix] Key Expiry Default Duration
2026-03-05 21:06:55 -08:00
yuneng-jiangandClaude Sonnet 4.6 e468b0278f [Fix] Key Expiry Default Duration - support null to never expire
Support passing duration=null on /key/update to reset a key's expiry to never expires, alongside the existing "-1" magic string (kept for backward compat).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 20:54:30 -08:00
yuneng-jiangandGitHub 99c4f3cbea Merge pull request #22938 from BerriAI/litellm_fix_team_usage_spend
[Fix] Team Usage Spend Truncated Due to Pagination
2026-03-05 20:45:27 -08:00
Daniel YudelevichandGitHub 8b2dd4f65a fix(pricing): add supports_web_search for OpenAI gpt-5.1/5.2/5.3 models (#22934)
OpenAI gpt-5.1, gpt-5.2, and gpt-5.3 chat models all support the
`web_search_options` parameter, but the model cost registry was missing
the `supports_web_search` flag. Only `gpt-5.2-pro` had it set.

Models updated:
- gpt-5.1, gpt-5.1-2025-11-13, gpt-5.1-chat-latest
- gpt-5.2, gpt-5.2-2025-12-11, gpt-5.2-chat-latest
- gpt-5.3-chat-latest
2026-03-05 20:38:27 -08:00
Sameer KankuteandGitHub ad59aa02bb Merge pull request #22954 from BerriAI/litellm_gpt-5-4-pro-model-map
feat(openai): add gpt-5.4-pro to model map
2026-03-06 09:53:45 +05:30
Sameer Kankute 050503469a feat(openai): add gpt-5.4-pro to model map
- Add gpt-5.4-pro and gpt-5.4-pro-2026-03-05 snapshot
- Input: $30/1M tokens, Output: $180/1M tokens
- 1.05M context window, 128K max output tokens
- Priority pricing for >272K input tokens (2x input, 1.5x output)
- Supports reasoning.effort: medium, high, xhigh
- Responses API, Chat Completions, Batch endpoints

Made-with: Cursor
2026-03-06 09:52:56 +05:30
Ishaan JaffandGitHub 83e237bac2 fix(chat): fix /ui/chat routing, Suspense boundary, serverRootPath support (#22945)
* fix(chat): fix router.push paths to use /ui/chat with serverRootPath support

* fix(chat): wrap chat page in Suspense boundary for Next.js static export

* fix(chat): fix clipboard writeText rejection handler - remove undefined message.error call

* feat(chat): rebuild UI with routing fixes

* fix(chat): use useTheme logoUrl + /get_image fallback for sidebar logo

* feat(chat): rebuild UI with logo fix

* fix(chat): use /get_image directly for logo (no ThemeProvider outside dashboard layout)

* feat(chat): add multi-model comparison and provider logos in chat UI

- Replace single model selector with multi-select (up to 3 models)
- Show provider logos next to model names in dropdown (openai, anthropic, gemini, mistral, groq, etc.)
- Selected models float to the top of the dropdown list
- Multi-model mode: responses stream in parallel side-by-side cards below each user message
- Multi-turn: each follow-up message carries full per-model history as context
- Surface API errors inline in response cards instead of silently swallowing them
- Rebuild UI
2026-03-05 20:00:25 -08:00
Sameer KankuteandGitHub bc481f49d3 Merge pull request #22895 from BerriAI/litellm_o-series-generalize-detection
fix(o-series): generalize is_model_o_series_model to match any o+digit prefix
2026-03-06 09:14:57 +05:30
Sameer KankuteandGitHub 91a8937705 Merge pull request #22750 from BerriAI/litellm_mcp_doc_update
[Chore] update mcp documentation for header forwarding
2026-03-06 09:14:48 +05:30
Sameer KankuteandGitHub 20ec949cf1 Merge pull request #22734 from vincentkoc/vincentkoc-code/chatgpt-53-oauth-models
feat(models): add ChatGPT 5.3/5.4 aliases + OpenAI gpt-5.4-pro
2026-03-06 08:59:12 +05:30
Sameer KankuteandGitHub 57596cab1a Merge pull request #22920 from Varad2001/litellm_gemini_3.1_reasoning_effort
fix(gemini): handle 'minimal' reasoning_effort param for gemini-3.1-f…
2026-03-06 08:55:57 +05:30
Sameer KankuteandGitHub 31c43ba187 Merge pull request #22948 from BerriAI/litellm_vertex-paygo-docs
docs: add PayGo/priority cost tracking for Gemini Vertex AI
2026-03-06 08:37:39 +05:30
Sameer Kankute baa5d7262d docs: add PayGo/priority cost tracking for Gemini Vertex AI
- Add PayGo / Priority Cost Tracking section to Vertex AI provider docs
- Document trafficType to service_tier mapping (ON_DEMAND_PRIORITY, FLEX, etc.)
- Add service tier cost keys to custom pricing docs
- Add provider-specific cost tracking note to spend tracking overview

Made-with: Cursor
2026-03-06 08:36:31 +05:30