Commit graph

32136 commits

Author SHA1 Message Date
Otavio Brito
b1a67666ea
refactor: reuse get_instance_fn in initialize_custom_guardrail - allow module level import (#20917) 2026-02-12 20:53:47 -08:00
The Mavik
99b4d17ee8
fix: guard against None litellm_metadata in batch logging (#20832)
When litellm_metadata is explicitly set to None in litellm_params,
`dict.get("litellm_metadata", {})` returns None (not the default {}),
because the key exists. The subsequent .get() call on None raises
`AttributeError: 'NoneType' object has no attribute 'get'`.

Use `or {}` instead, consistent with line 4924 in the same file.

Fixes #15836
2026-02-12 20:45:30 -08:00
Lei Nie
68d2306dd4
feat(vertex_ai): preserve usageMetadata in _hidden_params (#20559)
* fix: allow Management keys to access user/daily/activity and team/daily/activity

* feat(vertex): surface trafficType via generic provider_specific_fields in Responses API

Extract Vertex AI's trafficType from usageMetadata in both streaming and
non-streaming paths, storing it in _hidden_params["provider_specific_fields"].

The Responses API transformation layer generically passes any
_hidden_params["provider_specific_fields"] dict to the ResponsesAPIResponse,
avoiding provider-specific logic in the bridge.

Also fix stream_chunk_builder to propagate _hidden_params from the last
streaming chunk to the rebuilt ModelResponse, ensuring provider metadata
survives the chunk→response rebuild.

---------

Co-authored-by: naaa760 <neh6a683@gmail.com>
Co-authored-by: yuneng-jiang <yuneng.jiang@gmail.com>
2026-02-12 20:44:59 -08:00
Cesar Garcia
20ae67a3ba
fix(vertex): map IMAGE_PROHIBITED_CONTENT finish reason to content_filter (#20524)
Closes #20357
2026-02-12 20:39:55 -08:00
datzscaler
f74fdfbb61
feat(ui): added UI for Zscaler AI Guard (#21077)
* fix: allow Management keys to access user/daily/activity and team/daily/activity

* feat(ui): added UI for Zscaler AI Guard

* feat(ui): addressed UI comment

* Apply suggestion from @greptile-apps[bot]

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

---------

Co-authored-by: naaa760 <neh6a683@gmail.com>
Co-authored-by: yuneng-jiang <yuneng.jiang@gmail.com>
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-12 20:27:44 -08:00
mubashir1osmani
1bc90d2db7
fix guardrail status error (#20972)
* fix guardrail status error

* fix function imports
2026-02-12 20:19:13 -08:00
joaokopernico
da31dd19da
fix(anthropic): use Authorization Bearer for OAuth tokens instead of x-api-key (#21039)
OAuth tokens (sk-ant-oat*) require Authorization: Bearer header per
Anthropic's OAuth specification, but were being sent via x-api-key
which Anthropic rejects with 'invalid x-api-key'.

- optionally_handle_anthropic_oauth: detect OAuth tokens in api_key
  param (standard chat flow), not just Authorization header
- get_anthropic_headers: use Authorization: Bearer + required OAuth
  headers for OAuth tokens, x-api-key for regular API keys
- Passthrough messages: skip x-api-key when Authorization is set
- Add oauth-2025-04-20 to beta headers whitelist config
2026-02-12 20:10:08 -08:00
Emerson Gomes
022846baae
fix(router): remove repeated provider parsing in budget limiter hot path (#21043)
* fix(router): remove budget limiter provider hot-path overhead

- avoid LiteLLM_Params instantiation from dict deployments in provider lookup\n- resolve provider once per deployment and reuse in budget filtering\n- add router unit tests for hot-path behavior\n\nFixes #21042

* fix(router): handle None provider cache entries in budget limiter

- avoid recomputing provider when cached value is None\n- clarify deployment_provider_map uses id(deployment) keys\n- add regression test covering None-provider cache path

* refactor(router): avoid id()-based provider cache coupling

- switch provider cache handoff to index-aligned list between budget-limiter loops\n- remove implicit dependency on object identity stability\n- move hot-path tests to tests/test_litellm/router_strategy per template guidance

* chore(router): make use_litellm_proxy default explicit

Use deployment_litellm_params.get('use_litellm_proxy', False) for clarity and parity with LiteLLM_Params default behavior.

* test(router): add provider-resolution parity guard

- wrap dict litellm_params with lightweight attribute view for get_llm_provider\n- reduce drift risk from manual field extraction vs LiteLLM_Params defaults\n- add parity test matrix comparing optimized path to legacy LiteLLM_Params behavior for dict deployments

* test(router): harden dict view compatibility for provider resolution

- extend _LiteLLMParamsDictView with mapping-like and dump methods\n- add regression test simulating future get_llm_provider method-based access\n- keep hot-path optimization while reducing duck-typing break risk

---------

Co-authored-by: Codex <codex@example.com>
2026-02-12 20:05:55 -08:00
milan-berri
a2e9e73b64
fix(proxy): change model mismatch logs from WARNING to DEBUG (#20994)
Fixes #20990

PR #19943 added logging when the proxy overrides model names to prevent
internal provider prefixes from leaking to clients. The behavior works
correctly but logs a WARNING on every request with model mismatch.

For high-traffic customers using model aliases or provider prefixes,
this creates millions of warnings per day, flooding logs and causing
disk space issues.

Changed log level from WARNING to DEBUG since:
- The model mismatch is expected behavior when using aliases
- The override happens correctly regardless of log level
- Operators can still enable with LITELLM_LOG=DEBUG for debugging

Changes:
- common_request_processing.py: 2 warnings -> debug (non-streaming)
- proxy_server.py: 1 warning -> debug (streaming)
2026-02-12 16:40:58 -08:00
yuneng-jiang
ce3bb97d40
Merge pull request #21076 from BerriAI/litellm_ui_model_table_cred
[Feature] UI - Model Page: Improve Credentials Messaging
2026-02-12 16:28:45 -08:00
Emerson Gomes
d9606773ea
feat(vertex_ai): add zai-org/glm-5-maas model pricing (#21053)
Add Vertex AI ZAI GLM-5 model map entry with reasoning + prompt caching metadata and cache-read pricing.\n\nRefs #21052

Co-authored-by: Codex <codex@example.com>
2026-02-12 16:11:59 -08:00
yuneng-jiang
168a8731ce improve credentials messaging 2026-02-12 16:02:54 -08:00
yuneng-jiang
3cbb12b9c8
Merge pull request #21074 from milan-berri/fix/mcp-server-name-validation-spaces
fix(ui): Block spaces and hyphens in MCP server names and aliases
2026-02-12 15:35:18 -08:00
yuneng-jiang
2864ce73da
Merge pull request #21022 from BerriAI/litellm_unified_ag
[Feature] Access Groups
2026-02-12 15:34:38 -08:00
Milan
de42f733df fix: Update alias tooltip - remove outdated space replacement text
Since spaces are now blocked in server names, the tooltip text about
'spaces replaced by underscores' is no longer accurate.
2026-02-13 01:20:57 +02:00
Milan
b769fa08d2 chore: Remove accidentally committed image file 2026-02-13 01:18:19 +02:00
Milan
bab5173500 fix: Make validation message generic and restore alias tooltip text
- Change error message to be generic (works for both server_name and alias)
- Restore 'Defaults to server name with spaces replaced' text in alias tooltip
2026-02-13 01:17:01 +02:00
Milan
1d67476ed0 refactor: Simplify validateMCPServerName to match original ternary style 2026-02-13 01:14:37 +02:00
Ishaan Jaff
5f40f93846
fix: MCP - inject NPM_CONFIG_CACHE into STDIO MCP subprocess env (#21069)
* fix: inject NPM_CONFIG_CACHE into STDIO MCP subprocess env for Docker

npm/npx needs a writable cache directory. In containers the default
(~/.npm) may not exist or be read-only, causing STDIO MCP servers
launched via npx to fail with ENOENT. Inject NPM_CONFIG_CACHE=/tmp/.npm_mcp_cache
into the subprocess env when not already set.

* test: add unit test for NPM_CONFIG_CACHE injection in STDIO MCP

Verifies that NPM_CONFIG_CACHE is auto-injected when not set, and
preserved when explicitly provided. Also moves the import to module
level per code style rules.

* Update litellm/constants.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: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-12 15:11:37 -08:00
Milan
8fa2734830 fix(ui): Block spaces and hyphens in MCP server names and aliases
- Update validateMCPServerName to reject both spaces and hyphens
- Apply shared validation to alias field in create form (was inline)
- Update tooltips to mention space restriction
- Ensures consistency across create/edit forms for server_name and alias fields
2026-02-13 01:11:06 +02:00
yuneng-jiang
a37623945d migration and build 2026-02-12 14:34:10 -08:00
yuneng-jiang
ed59c7c84d bump: version 0.4.35 → 0.4.36 2026-02-12 14:33:38 -08:00
yuneng-jiang
a45028f623 Merge remote-tracking branch 'origin' into litellm_unified_ag 2026-02-12 14:32:52 -08:00
yuneng-jiang
ea8c89ea3f rename file and add tests 2026-02-12 14:05:51 -08:00
yuneng-jiang
c34cdb29cd remove double auth and add alias 2026-02-12 13:40:58 -08:00
Ishaan Jaff
736daf0a7d
[Feat] Adds Shell tool support for the OpenAI Responses API (#21063)
* test_responses_api_context_management_server_side_compaction

* Server-side compaction

* docs fix

* test_responses_api_shell_tool

* add SHELL tool

* test_responses_api_shell_tool

* add SHELL_CALL_IN_PROGRESS

* add SHELL_CALL_IN_PROGRESS events

* TestOpenAIResponsesAPITest

* transform_streaming_response

* test_responses_api_shell_tool_streaming_sees_shell_output

* test_responses_api_shell_tool_streaming_sees_shell_output

* test_responses_api_shell_tool

* docs fix
2026-02-12 13:04:29 -08:00
yuneng-jiang
e6df587bfb adding tests and fixing prisma lookup table 2026-02-12 12:48:05 -08:00
yuneng-jiang
fbfaa6c8af rename unified access group to access group 2026-02-12 12:30:22 -08:00
yuneng-jiang
5a0db00d8a
Merge pull request #21061 from BerriAI/migration_yj_feb12
[Infra] Add Mmigration for Tags Adjustment on Policy Table
2026-02-12 10:36:10 -08:00
yuneng-jiang
5147515d78 add migration + build files 2026-02-12 10:34:59 -08:00
yuneng-jiang
5152bf4f4e bump: version 0.4.34 → 0.4.35 2026-02-12 10:34:17 -08:00
yuneng-jiang
df15456bcc
Merge pull request #20598 from muraliavarma/fix/team-update-empty-premium-fields-403
fix(proxy): skip premium check for empty metadata fields on team/key update
2026-02-12 10:10:27 -08:00
Ishaan Jaff
89565c97cc
[Feat] AI Gateway - Add Tracing for MCP Calls running through AI Gateway (#21018)
* commit new expansion

* fix MCP

* fix: LiteLLMProxyRequestSetup

* _process_mcp_tools_without_openai_transform

* UI fixes

* UI refactor view logs/sessions

* index

* _add_mcp_tool_metadata_to_final_chunk

* add badges

* add getEventDisplayName

* ui fixes

* backend fix

* fix

* UI fix

* UI fix

* fix row

* fix: address Greptile review feedback on PR #21018 (#21057)

- Fix session time range calculation: use Math.min/Math.max across all
  entries instead of relying on array order (sessionLogs is sorted by
  type, not time).

Other Greptile comments were already addressed in the branch:
- LogDetailContent.tsx exists
- Clipboard call already wrapped in try/catch
- Dedup already uses O(1) Map lookup
- model_dump() serialization is documented
- GROUP BY performance comment already present

---------

Co-authored-by: shin-bot-litellm <shin-bot-litellm@berri.ai>
2026-02-12 10:02:03 -08:00
Ishaan Jaff
3d9b145b04
[Feat] Adds support for server-side compaction on the OpenAI Responses API context_management (#21058)
* test_responses_api_context_management_server_side_compaction

* Server-side compaction

* docs fix

* test_responses_api_shell_tool
2026-02-12 10:00:30 -08:00
Krrish Dholakia
f5382ebac9 docs: fix docs 2026-02-12 08:45:57 -08:00
Sameer Kankute
556bcd7203
Merge pull request #21055 from BerriAI/litellm_day_0_MiniMax-M2.1
fix docs
2026-02-12 22:04:23 +05:30
Sameer Kankute
9f15eca6b6 fix docs 2026-02-12 22:03:21 +05:30
Sameer Kankute
4e62386c65
Merge pull request #21054 from BerriAI/litellm_day_0_MiniMax-M2.1
Add support for MiniMax-M2.1 and MiniMax-M2.1-lightining
2026-02-12 21:51:46 +05:30
Sameer Kankute
7a3b227aeb
Apply suggestion from @greptile-apps[bot]
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-12 21:50:55 +05:30
Sameer Kankute
9b32c516ad Add support for MiniMax-M2.1 and MiniMax-M2.1-lightining 2026-02-12 21:45:49 +05:30
Sameer Kankute
a7179797f7
Merge pull request #20930 from BerriAI/litellm_oss_staging_02_11_2026
oss staging 02 / 11/ 2026
2026-02-12 21:28:59 +05:30
Sameer Kankute
5471b14c56
Merge pull request #21051 from BerriAI/revert-20569-fix/20557-gemini-multiturn-tool-calling
Revert "Fix #20557: Fix Gemini multi-turn tool calling message formatting"
2026-02-12 21:17:04 +05:30
Sameer Kankute
4931bac3da
Revert "Fix #20557: Fix Gemini multi-turn tool calling message formatting (#2…"
This reverts commit 49078b3c6b.
2026-02-12 21:16:33 +05:30
Sameer Kankute
e68b970953
Merge branch 'main' into litellm_oss_staging_02_11_2026 2026-02-12 21:14:08 +05:30
Sameer Kankute
3d7126b11a
Merge pull request #20587 from BerriAI/litellm_oss_staging_02_06_2026
Litellm oss staging 02 06 2026
2026-02-12 20:07:35 +05:30
Sameer Kankute
59d6ab8a00
Merge branch 'main' into litellm_oss_staging_02_11_2026 2026-02-12 20:04:46 +05:30
jquinter
e78d17cd0a Fix/mcp health check cancelled error (#19851)
* Fix MCP health check CancelledError handling for parallel test execution

Add asyncio.CancelledError handler in health_check_server() and missing
@pytest.mark.asyncio decorator on test_mcp_server_manager_config_integration_with_database.

In Python 3.8+, CancelledError inherits from BaseException, not Exception,
so it bypassed the generic exception handler when pytest-xdist cancels
running tasks after a failure.

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

* Regenerate poetry.lock to resolve merge conflict markers

The lock file had unresolved conflict markers from a previous merge,
causing poetry to fail with "Invalid statement (at line 8534, column 1)".

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 19:40:08 +05:30
jquinter
2875fe8e49 ci: add matrix-based parallel test workflow (#19942)
Split tests/test_litellm into 10 parallel CI jobs using GitHub Actions
matrix strategy to reduce PR feedback time from ~25 min to ~8-10 min.

Changes:
- Add new test-litellm-matrix.yml workflow with 10 matrix jobs:
  - llms (~225 files, 4 workers)
  - proxy-guardrails (~51 files, 4 workers)
  - proxy-core (~52 files, 4 workers)
  - proxy-misc (~77 files, 4 workers)
  - integrations (~60 files, 4 workers)
  - core-utils (~32 files, 2 workers)
  - other (~69 files, 4 workers) - includes all previously uncovered dirs
  - root (~34 files, 4 workers)
  - proxy-unit-a (~20 files, 2 workers)
  - proxy-unit-b (~28 files, 2 workers)

- Deprecate test-litellm.yml (moved to workflow_dispatch for manual use)

- Add matching Makefile targets for local testing:
  - make test-unit-llms
  - make test-unit-proxy-guardrails
  - make test-unit-proxy-core
  - make test-unit-proxy-misc
  - make test-unit-integrations
  - make test-unit-core-utils
  - make test-unit-other
  - make test-unit-root
  - make test-proxy-unit-a
  - make test-proxy-unit-b

Benefits:
- ~3x faster wall-clock time through parallelization
- Dependency caching for faster subsequent runs
- Concurrency control to cancel stale runs
- Better failure isolation per test group

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-12 19:39:05 +05:30
jquinter
199fbabfb3 Fix MCP streaming test skip logic and metadata None check (#20428)
- Fix skip condition to detect claude models (was only checking for
    "anthropic" in model name, missing "claude-haiku-4-5")
  - Add missing skip for OpenAI tests when OPENAI_API_KEY is not set
  - Fix TypeError in utils.py when metadata is explicitly None instead
    of missing (use `or {}` fallback)
2026-02-12 19:39:05 +05:30
Zero Clover
7044512407 Fix responses bridge metadata isolation (#20484) 2026-02-12 19:39:05 +05:30