Commit Graph
34811 Commits
Author SHA1 Message Date
Cesar GarciaandGitHub 6bca746d23 Merge pull request #21601 from Chesars/feat/model-cost-aliases
feat: add model_cost aliases expansion support
2026-03-10 18:07:23 -03:00
Cesar GarciaandGitHub e4fddb9f24 Merge pull request #23093 from MaxwellCalkin/fix/thinking-blocks-interleave-23047
fix: preserve thinking block order with multiple web searches
2026-03-10 18:06:45 -03:00
Cesar GarciaandGitHub b905e1493b Merge pull request #23201 from Chesars/claude/brave-ritchie
feat(images): support input_fidelity parameter for image edit API
2026-03-10 18:05:02 -03:00
Cesar GarciaandGitHub d34999900c Merge pull request #23265 from Chesars/fix/vertex-gemini2-tool-schema-minimal-transform
fix(vertex): skip schema transforms for Gemini 2.0+ tool parameters
2026-03-10 18:04:46 -03:00
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 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 RobertsandGitHub 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 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
Chesars 7ccb14cab4 feat: add model cost aliases expansion support 2026-03-10 15:57:23 -03:00
xykongandGitHub 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
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 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 AlamandGitHub 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
Sameer KankuteandGitHub 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 KankuteandGitHub 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 KankuteandGitHub 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
Sameer KankuteandGitHub 9bc7357e7c Merge pull request #23222 from BerriAI/litellm_oss_staging_02_18_2026
Litellm oss staging 02 18 2026
2026-03-10 17:46:06 +05:30
Sameer KankuteandGitHub b211b67cea Merge pull request #23164 from BerriAI/litellm_oss_staging_03_09_2026
oss staging 03/09/2026
2026-03-10 17:45:17 +05:30
Sameer KankuteandGitHub d0d1291c15 Merge pull request #22628 from BerriAI/litellm_oss_staging_03_02_2026
Litellm oss staging 03 02 2026
2026-03-10 17:40:31 +05:30
Sameer KankuteandGitHub 9bee76c30d Merge pull request #23253 from BerriAI/main
merge main
2026-03-10 17:25:01 +05:30
Sameer KankuteandGitHub 72fc2f77cf Merge pull request #23252 from BerriAI/main
merge main
2026-03-10 17:24:19 +05:30
Sameer KankuteandGitHub 3f17a63b81 Merge branch 'main' into litellm_oss_staging_03_02_2026 2026-03-10 17:19:37 +05:30
Sameer KankuteandGitHub 94b002066e Merge pull request #23244 from BerriAI/litellm_skills_api_folder_name_match
fix(skills): match zip folder name to skill name in SKILL.md for Anthropic API
v1.82.1-nightly v1.82.1.rc.1
2026-03-10 14:11:49 +05:30
Sameer Kankute 88c4079b16 fix(skills): match zip folder name to skill name in SKILL.md for Anthropic API
Made-with: Cursor
2026-03-10 14:11:11 +05:30
Sameer KankuteandClaude Sonnet 4.6 0122abfa2b fix(bedrock): populate completion_tokens_details in converse _transform_usage
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
2026-03-10 13:17:28 +05:30
Sameer KankuteandGitHub 3e1f343d1a Merge pull request #23242 from BerriAI/litellm_fix_redaction_and_charity_engine_provider
fix(tests): update cache hit redaction assertion to expect choices fo…
2026-03-10 12:27:59 +05:30
yuneng-jiangandGitHub d39a3a90b4 Merge pull request #23241 from BerriAI/litellm_/elastic-gagarin
[Feature] UI - Virtual Keys: Add refetch button, keep stale data during refetch
2026-03-09 23:52:11 -07:00
yuneng-jiangandClaude Opus 4.6 129ed1014b [Fix] UI - Virtual Keys: Reset refetch button on error so user can retry
When a fetch fails, the button now exits the loading state instead of
staying stuck on "Fetching" indefinitely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 23:46:45 -07:00
Sameer KankuteandGitHub f33f446476 Merge pull request #23240 from BerriAI/litellm_bedrock-nova-output-config-spend-tracking
fix(bedrock): strip output_config from Converse requests; fix spend tracking redaction test
2026-03-10 12:15:06 +05:30
Sameer Kankute 30fde1de7f fix(tests): update cache hit redaction assertion to expect choices format
Made-with: Cursor
2026-03-10 12:14:24 +05:30
yuneng-jiangandClaude Opus 4.6 9ee489863d [Feature] UI - Virtual Keys: Add refetch button and keep stale data during refetch
Show a Fetch/Fetching button next to "Showing X of Y results" that acts as
both a manual refetch trigger and a loading indicator. The "Loading keys..."
message now only appears on initial load; subsequent refetches keep the table
visible with stale data (via React Query's keepPreviousData).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 23:30:55 -07:00
yuneng-jiangandGitHub b8886568f0 Merge pull request #23236 from BerriAI/litellm_/flamboyant-leakey
[Fix] All Proxy Models Not Including Model Access Groups in Key Creation
2026-03-09 23:27:38 -07:00
Sameer Kankute 200b001633 fix(bedrock): strip output_config from Converse requests; fix spend tracking redaction test
Made-with: Cursor
2026-03-10 11:53:36 +05:30
Sameer KankuteandGitHub d9d81175b6 Merge pull request #23238 from BerriAI/litellm_mcp_openapi_tool_fixes
fix(mcp): OpenAPI tool listing and execution for relative URLs and camelCase
2026-03-10 11:48:33 +05:30
Sameer Kankute db99fdeff3 fix(mcp): OpenAPI tool listing and execution for relative URLs and camelCase
- Fix case-insensitive tool name matching in _tool_name_matches() so that
  OpenAPI operationIds (camelCase) match lowercase registered tool names
  when filtering by allowed_tools
- Fix get_base_url() to resolve relative server URLs (e.g. /api/v3) by
  deriving full base URL from spec_path when OpenAPI spec has relative URLs
- Add tests for case-insensitive matching and filter_tools_by_allowed_tools

Made-with: Cursor
2026-03-10 11:34:23 +05:30
yuneng-jiangandClaude Opus 4.6 1755a281bd Fix mutation bug: copy lists in get_key_models to prevent corrupting cached UserAPIKeyAuth
`all_models = user_api_key_dict.models` was creating an alias, so
`_get_models_from_access_groups` (which uses `.pop()`/`.extend()`) would
mutate the cached object in-place. Now both `.models` and `.team_models`
assignments create copies via `list()`.

Added test to verify the input is not mutated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 22:55:53 -07:00
yuneng-jiangandClaude Opus 4.6 1cf191d9ad [Fix] Deduplicate model lists and remove dead assignment
Adds dedup to get_key_models and get_team_models to prevent duplicate
entries when access group member models overlap with proxy_model_list.
Removes dead assignment of all_models in get_team_models.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 22:44:45 -07:00
Sameer KankuteandGitHub cf84072662 Merge pull request #23235 from BerriAI/litellm_fix_redaction_and_charity_engine_provider
fix(logging): preserve ModelResponse choices format in redacted standard_logging_object + add Charity Engine provider endpoint
2026-03-10 11:00:24 +05:30
yuneng-jiangandClaude Opus 4.6 c829733200 [Fix] Include model access groups when expanding All Proxy Models
When a team has "all-proxy-models", the model list expansion now includes
model access group names so they appear in the UI key creation form.
Also fixes get_key_models not forwarding include_model_access_groups to
_get_models_from_access_groups, and removes unused _unfurl_all_proxy_models.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 22:30:07 -07:00
Sameer Kankute b08445837b fix(logging): preserve ModelResponse choices format in redacted standard_logging_object + add Charity Engine provider endpoint
- Fix perform_redaction to handle dict representation of ModelResponse (from model_dump())
- Preserve full choices structure when redacting, redact content/audio in place
- Add _redact_standard_logging_object helper for standard_logging_object field
- Update test_logging_redaction_e2e_test assertions to expect choices format
- Add charity_engine to provider_endpoints_support.json

Fixes: test_standard_logging_payload, test_standard_logging_payload_audio
Made-with: Cursor
2026-03-10 10:22:57 +05:30
Sameer KankuteandGitHub 09919a81b2 Merge pull request #23234 from BerriAI/revert-23224-cursor/get-optional-params-behavior-ed4a
Revert "Get optional params behavior"
2026-03-10 10:22:10 +05:30
Sameer KankuteandGitHub 504e66ccd4 Revert "fix: forward recognized OpenAI params from kwargs in completion() (#2…"
This reverts commit dd6f0d6c55.
2026-03-10 10:22:00 +05:30
Carlo Alberto FerrarisandClaude Opus 4.6 9d2b0117d9 docs: add DB performance guidelines to CLAUDE.md
Extend the "Proxy database access" section with guidelines to prevent
common DB performance issues, tailored to actual Prisma usage patterns
in the litellm codebase: N+1 queries, client-side processing, batching
writes, bounding result sets, select on wide tables, index coverage,
and schema file sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:40:13 +09:00
Sameer KankuteandGitHub 32e7b22f05 Merge pull request #23233 from BerriAI/revert-23231-litellm_cicd_100326
Revert "Fix logging tests"
2026-03-10 10:00:04 +05:30
Sameer KankuteandGitHub 3f30f6a49c Revert "Fix logging tests" 2026-03-10 09:59:53 +05:30
Sameer KankuteandGitHub 9402a8b57e Merge pull request #23231 from BerriAI/litellm_cicd_100326
Fix logging tests
2026-03-10 09:59:00 +05:30
Sameer Kankute 7542845e8d Revert "fix: strip empty text content blocks in /v1/messages endpoint (#23097)"
This reverts commit 2c738cc939.
2026-03-10 09:56:39 +05:30