Commit graph

36177 commits

Author SHA1 Message Date
Chesars
7bac87e9b9 feat(openai): add supports_web_search to o4-mini models
Tested and confirmed both o4-mini and o4-mini-2025-04-16 support
web_search_preview via the Responses API.
2026-03-10 17:48:59 -03:00
Shivam Rawat
97c92cc84e
Merge pull request #23287 from BerriAI/docs_flow_builder
policy builder
2026-03-10 13:44:18 -07:00
Shivam Rawat
592232e835
Update docs/my-website/docs/proxy/guardrails/guardrail_pipeline_flow_builder.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-10 13:42:46 -07:00
Shivam Rawat
f3844d8356
Update docs/my-website/docs/proxy/guardrails/guardrail_pipeline_flow_builder.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-10 13:42:36 -07:00
yuneng-jiang
bead0b7d90 [Test] UI - Logs: Add unit tests for 5 untested view_logs components
Add vitest tests for TypeBadges, ErrorViewer, ConfigInfoMessage, TimeCell, and TruncatedValue covering rendering, user interactions, and edge cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:42:30 -07:00
Chesars
926a0df9b0 Merge main into feat/openai-like-responses-api
Resolve conflict in perplexity/responses/transformation.py by keeping
the simplified ~50 line version (PR's goal) instead of main's ~410 line
version. Added supports_native_websocket() -> False from main.
2026-03-10 17:36:32 -03:00
Chesars
2315d4b73c fix: resolve merge conflicts with staging branch
Keep unified _FINISH_REASON_MAP dict approach, discard upstream's
inconsistent _VALID_OPENAI_FINISH_REASONS frozenset that mapped to
values not in the OpenAIChatCompletionFinishReason Literal.
2026-03-10 17:27:57 -03:00
stevejaker
2341a38c08
fix(snowflake): transform tool_choice string to object format (#23268)
* fix(snowflake): transform tool_choice string to object format

Snowflake's Cortex API requires tool_choice to be an object, not a string.
For example, {"type": "auto"} instead of "auto".

Ref: https://docs.snowflake.com/en/developer-guide/snowflake-rest-api/reference/cortex-inference#post--api-v2-cortex-inference-complete-req-body-schema

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 01:41:24 +05:30
Chesars
95ef97bd34 docs: expand aliases section in add_model_pricing guide
Add usage example with concrete model entry, explanation of load-time
expansion, and cross-reference to model_alias_map to clarify the
difference between the two features.
2026-03-10 16:54:55 -03:00
Chesars
effaef3cfb fix: remove duplicate supports_web_search keys
7 models already had supports_web_search from upstream, causing
duplicate JSON keys. Re-serialized to remove duplicates.
2026-03-10 16:49:45 -03:00
Chesars
7a0c8af458 merge: resolve conflicts with upstream/main
Keep both: supports_web_search additions and upstream's
supports_none_reasoning_effort / supports_xhigh_reasoning_effort fields.
2026-03-10 16:42:28 -03:00
Chesars
3fe4829676 fix: include redacted_thinking in list-content thinking block detection
The _list_has_thinking guard only checked for type == "thinking" but
Anthropic can also return redacted_thinking blocks (safety-filtered).
These are also accumulated in thinking_blocks, so the same duplication
bug would occur with redacted thinking content.
2026-03-10 16:37:06 -03:00
Jason Roberts
70fca22f68
feat(panw-prisma-airs): PANW Prisma AIRS guardrail with apply_guardrail support (#22999)
* feat(panw-prisma-airs): PANW Prisma AIRS guardrail with apply_guardrail support

* fix(panw): honor masking and fallback behavior

* fix(panw): clean up apply_guardrail MCP metadata handling

* fix(panw): clean up apply_guardrail MCP metadata handling

* fix(panw): harden apply_guardrail edge cases

* fix(panw): apply MCP masked data on allow responses

* fix(panw): scan latest developer message in anthropic mode

* fix(panw): restore legacy user-only pre-call scanning

* fix(panw): record apply_guardrail in applied guardrails header

* fix(panw): scan developer role in legacy pre-call path

* fix(panw): harden SSE parsing and narrow MCP name fallback

* fix(panw): harden streaming attr lookup and document dual scans

* fix(panw): fail closed on permanent 4xx and cover streaming observability
2026-03-10 12:31:31 -07:00
Chesars
6bc4cc8f0f feat(openai): add supports_web_search to OpenAI models with Responses API
Add `supports_web_search: true` to 31 OpenAI models that support the
`web_search_preview` tool via the Responses API. This enables the Router
to correctly include these deployments when requests use web search tools.

Models excluded (tested, confirmed unsupported):
- o1-pro (Tool 'web_search_preview' is not supported)
- gpt-audio / gpt-audio-mini (not supported)
- gpt-4.1-nano (not supported)
- codex-mini-latest (model not found)

Also removes the invalid `gpt-5.3` entry added in prior commit
(model name does not exist in OpenAI API; use gpt-5.3-chat-latest).
2026-03-10 16:28:50 -03:00
Chesars
6469de9516 fix: address Greptile review feedback
- Clean up aliases key from entries with empty aliases list
- Strengthen test assertion for alias conflict warning
2026-03-10 16:09:49 -03:00
shivam
fa330ed96b policy builder 2026-03-10 12:09:00 -07:00
Chesars
af297dc082 fix(openai): clean up gpt-5.3 model entry fields
- Remove dead fields: supports_none_reasoning_effort, supports_xhigh_reasoning_effort
  (not referenced anywhere in the codebase)
- Remove supports_web_search (inconsistent with other base models)
- Add supports_service_tier (consistent with gpt-5, gpt-5.1, gpt-5.2)
2026-03-10 16:04:31 -03:00
Chesars
7ccb14cab4 feat: add model cost aliases expansion support 2026-03-10 15:57:23 -03:00
michelligabriele
ffc89e4ef6
fix(mcp): add AWS SigV4 auth for Bedrock AgentCore MCP servers (#22782)
* fix(mcp): add AWS SigV4 auth for Bedrock AgentCore MCP servers

Add aws_sigv4 auth type to MCP client via httpx.Auth subclass that
signs each request with SigV4 using botocore. Enables mcp_servers
config to connect to AgentCore-hosted MCP servers.

* docs(mcp): add AWS SigV4 auth documentation for Bedrock AgentCore

Add dedicated docs page for configuring MCP servers with AWS SigV4
authentication, update MCP overview with aws_sigv4 auth type and
config example, and link from Bedrock AgentCore provider docs.

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

* fix(mcp): address Greptile review — requires_request_body, full header signing, health check

- Add requires_request_body = True to MCPSigV4Auth so httpx buffers the
  request body before calling auth_flow (prevents empty body hash for
  streaming requests)
- Pass all request headers to AWSRequest for canonical SigV4 signing
  instead of only Content-Type
- Exclude aws_sigv4 from health check skip logic since it has its own
  credential fields (not authentication_token)
- Fix docs: mark aws_access_key_id/aws_secret_access_key as optional
  (falls back to boto3 credential chain)
- Add test for requires_request_body flag

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-03-10 11:11:20 -07:00
Ishaan Jaff
9543d785b5
fix(mcp): don't auto-detect M2M OAuth from field presence (#23187)
* fix(mcp): require explicit opt-in for OAuth2 M2M client_credentials flow

Auto-detecting M2M from client_id+secret+token_url presence broke existing
interactive OAuth setups (e.g. GitHub Enterprise). Add oauth2_flow field and
default has_client_credentials to False — M2M must be explicitly opted into
with oauth2_flow: client_credentials.

* test(mcp): add regression tests for oauth2_flow M2M opt-in behavior
2026-03-10 10:59:49 -07:00
mubashir1osmani
26febf11a7
Merge pull request #23202 from mubashir1osmani/fix/tag-usage-cost-panel-zero
fix: tag usage cost panel zero
2026-03-10 13:57:22 -04:00
mubashir1osmani
88d0f9d834 added comments 2026-03-10 13:56:15 -04:00
mubashir1osmani
6a59ec5ddf
fix: anthropic prompt caching returns a string instead of an int
fix: anthropic prompt caching returns a string instead of an int
2026-03-10 13:51:17 -04:00
ryan-crabbe
0a324663fb
Merge pull request #23215 from BerriAI/litellm_migrate_user_buttons_tremor_to_antd
Migrate user management buttons from Tremor to Ant Design
2026-03-10 10:32:09 -07:00
yuneng-jiang
b02ecc7807
Merge pull request #23260 from milan-berri/feat/mcp-token-auth-support
feat(mcp): add token authentication support for MCP servers
2026-03-10 09:57:21 -07:00
Milan
4c9220bdec feat(mcp): add token authentication support for MCP servers
- Add 'token' to MCPAuth enum for custom token auth format
- Implement token auth in MCP client (_get_auth_headers)
- Add token auth support for OpenAPI-based MCP tools
- Add comprehensive unit tests to existing test_mcp_client.py
- Fixes issue where MCP servers expecting 'Authorization: token <value>' header could not connect
2026-03-10 18:33:08 +02:00
milan-berri
336fb0cfeb
fix(security): strip secret_fields from guardrail logging response (#23162)
When guardrails return the full data dict (e.g. guardrails_ai), the
guardrail response logged to spend logs and OTEL traces could contain
data["secret_fields"].raw_headers with plaintext Authorization headers.

This adds a pop("secret_fields") in the guardrail logging path,
matching the existing pattern used by Langfuse and Arize integrations.

Tested: Verified fix removes secret_fields/raw_headers/authorization
from both /spend/logs/ui responses and OTEL trace span attributes.
2026-03-10 08:58:18 -07:00
xykong
810de556bd
fix(streaming): map unknown finish_reason values to finish_reason_unspecified to prevent ValidationError in stream_chunk_builder (#22673)
* fix(streaming): map unknown finish_reason values to finish_reason_unspecified

Some LLM providers return non-standard finish_reason values that are not
in the OpenAIChatCompletionFinishReason Literal (e.g. ZhipuAI/GLM returns
'network_error' when a streaming error occurs mid-response).

Previously map_finish_reason() fell through with return finish_reason,
passing the unknown value directly to Choices.__init__() which calls
Pydantic validation. This caused a ValidationError that was caught by
stream_chunk_builder() and re-raised as the misleading:
  litellm.APIError: Error building chunks for logging/streaming usage calculation

Fix: after all known provider-specific mappings, check if the value is in
the valid set (stop, length, tool_calls, content_filter, function_call,
guardrail_intervened, eos, finish_reason_unspecified, malformed_function_call).
Any value not in this set is mapped to 'finish_reason_unspecified' instead
of being returned as-is.

This is consistent with how other unknown stop reasons (e.g. Vertex AI's
FINISH_REASON_UNSPECIFIED) are already handled.

* refactor: use get_args(OpenAIChatCompletionFinishReason) for valid set

Per code review feedback: replace the hardcoded _valid_finish_reasons set
with a module-level frozenset derived dynamically from the source-of-truth
Literal type via typing.get_args(). This ensures the valid-reason check
stays in sync automatically when new finish reasons are added to the Literal,
and avoids recreating the set on every streaming chunk call.

* test(map_finish_reason): add unit tests and warning log for unknown finish reasons

- Add TestMapFinishReason class in test_core_helpers.py covering:
  - All known OpenAI-native values pass through unchanged (parametrized)
  - Provider-specific mappings: Anthropic, Cohere, Vertex AI
  - Unknown/provider-specific values map to 'finish_reason_unspecified'
  - Regression test for ZhipuAI/GLM-5 'network_error' case
- Add verbose_logger.warning() in map_finish_reason() when an unknown
  finish_reason is encountered, so operators can track which providers
  return non-standard values
2026-03-10 21:25:24 +05:30
Chesars
0680a97409 fix: handle list-content messages in thinking block interleaving
When assistant content is already a list containing thinking blocks
inline (not str/None), SEQUENTIAL MODE was still prepending all
thinking_blocks from provider_specific_fields, causing duplication
and breaking Anthropic's position-dependent signature verification.

Now detects if the content list already has thinking blocks and skips
the extend(thinking_blocks) to preserve the original interleaved order.

Addresses the correctness gap identified by Greptile review where
list-content messages bypass INTERLEAVED MODE.

Fixes: https://github.com/BerriAI/litellm/issues/23047
2026-03-10 12:48:30 -03:00
Harshit Jain
424a96580b
Merge pull request #22627 from BerriAI/litellm_presidio_antropic_edge_case
fix: presidio edge case with antropic handle on pii token leak
2026-03-10 21:16:56 +05:30
Harshit Jain
e1c2c36f67
Merge pull request #23259 from BerriAI/litellm_claude_missing_reqs
fix: claude code req traces on langfuse
2026-03-10 21:15:36 +05:30
Harshit Jain
fdb0a46242
Merge pull request #23209 from BerriAI/litellm_silent_metrics
feat: record silent metrics
2026-03-10 21:14:09 +05:30
Harshit Jain
a7e9bca103
Merge pull request #23214 from BerriAI/litellm_deployment_helm_chart
feat: add strategy to deployment for helmchart
2026-03-10 21:13:40 +05:30
Chesars
8c2c379cb5 fix(openai): add missing gpt-5.3 model entry
Fixes #23267 — plain `gpt-5.3` was missing from the model pricing
JSON, causing tool_choice (and other capability flags) to default
to unsupported. Copied fields from gpt-5.3-chat-latest.
2026-03-10 12:35:23 -03:00
Carlo Alberto Ferraris
323b473835
fix: add missing indexes for top CPU-consuming queries (#23147)
* fix: add missing indexes for top CPU-consuming queries

Add indexes to eliminate full table scans on two of the top 5 queries
by CPU usage:

1. LiteLLM_VerificationToken(key_alias) — for ORDER BY key_alias ASC
   queries when listing verification tokens
2. LiteLLM_SpendLogs(user, startTime) — for WHERE user = $1 AND
   startTime BETWEEN $2 AND $3 GROUP BY queries on the spend logs

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

* fix: use CREATE INDEX CONCURRENTLY to avoid table locks

Both indexes are now created with CONCURRENTLY and IF NOT EXISTS
to avoid blocking writes on large production tables.
Uses -- SkipTransactionBlock for Prisma migrate compatibility.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:00:22 +05:30
Chesars
d232d0de6c docs(openai): document gpt-5.4 reasoning_effort + tools limitation
Add tip boxes explaining that gpt-5.4 does not support reasoning_effort
with function tools in /v1/chat/completions, and that the responses
bridge (openai/responses/gpt-5.4) should be used instead.
2026-03-10 12:04:55 -03:00
Chesars
08d81f5d7c fix(vertex): shallow copy parameters before mutating in _build_vertex_schema_for_gemini_2
Avoids silently removing $defs from the caller's dict, which could
affect logging, caching, or retry logic referencing the same object.
2026-03-10 11:29:59 -03:00
Aarish Alam
2b093aa796
Merge pull request #23196 from CAFxX/docs/claude-md-db-performance-guidelines
docs: add DB query performance guidelines to CLAUDE.md
2026-03-10 19:51:51 +05:30
Chesars
a9c3095cc5 fix(vertex): skip harmful schema transforms for Gemini 2.0+ tool parameters
Gemini 2.0+ natively accepts JSON Schema in tool parameters, including
bare {} (TYPE_UNSPECIFIED), anyOf with null, and lowercase types. The
existing _build_vertex_schema pipeline was coercing {} to {"type": "object"},
breaking JsonValue/Any field semantics (issue #22391).

Add _build_vertex_schema_for_gemini_2() that only resolves $ref (which
Gemini doesn't support in tools) and filters unsupported fields. Use it
for Gemini 2.0+ models, keeping the full transform for Gemini 1.5.
2026-03-10 11:15:27 -03:00
Chesars
a6cb510703 merge: resolve conflicts between main and litellm_oss_staging_03_04_2026
Resolved 14 file conflicts:
- image_edits.md: combined OpenRouter + Black Forest Labs providers
- utils.py: kept staging's message-level cache_control check
- networking.tsx: kept export on 4 tool interfaces
- tool_management_endpoints.py: kept ToolOutputPolicy import
- Accepted main's version for: schema.prisma, a2a_protocol, mcp_server,
  _types.py, auth_checks.py, db_spend_update_writer, endpoints.py,
  spend_tracking_utils, a2a_endpoints, model_prices backup
2026-03-10 10:45:04 -03:00
Chesars
8fac04208d docs(responses): add tool_search bridge examples for chat completions
Add examples showing tool_search with namespaces via the chat
completions bridge (openai/responses/ prefix) for both SDK and proxy.
2026-03-10 10:27:40 -03:00
Harshit Jain
17804edc78
Update litellm/utils.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-10 18:44:57 +05:30
Harshit Jain
81bd62e8b0
Update litellm/utils.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-10 18:39:40 +05:30
Harshit28j
558523fd75 fix: req changes by greptile 2026-03-10 18:33:17 +05:30
Harshit28j
2f5a553a7d test: assert setup_database called with correct args
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:31:04 +05:30
Harshit28j
8c3d6db482 fix: claude code req traces on langfuse 2026-03-10 18:21:42 +05:30
Chesars
bec12db635 docs(responses): add tool_search & namespaces section for gpt-5.4
Add documentation for OpenAI's tool_search feature (Responses API)
with SDK and Proxy examples showing namespace-based deferred tool
loading. Closes #23206.
2026-03-10 09:50:08 -03:00
Sameer Kankute
a788b21092
Merge pull request #23243 from BerriAI/litellm_bedrock-completion-tokens-details
fix(bedrock): populate completion_tokens_details in Responses API
2026-03-10 18:19:28 +05:30
Sameer Kankute
cd80213f1c
Merge pull request #23151 from BerriAI/litellm_preserve-reasoning-summary-for-responses-api
fix(openai): preserve reasoning_effort summary field for Responses API
2026-03-10 18:18:46 +05:30
Sameer Kankute
b3c4326845
Merge pull request #23131 from BerriAI/litellm_vertex_ai_extra_body_cache_fix
fix(vertex_ai): strip LiteLLM-internal keys from extra_body before merging to Gemini request
2026-03-10 18:17:29 +05:30