Commit graph

2361 commits

Author SHA1 Message Date
mateo-berri
815fa0ff08 fix(anthropic_adapter): carry web search usage into /v1/messages cost breakdown
For non-Anthropic models served over /v1/messages, the outer wrapper recomputes
cost over the adapter-translated Anthropic response dict. That dict dropped every
web search usage signal, so the recompute overwrote the correct cost breakdown
with a token-only one: x-litellm-response-cost-tool-usage read 0.0 and
x-litellm-response-cost-original excluded the search cost, while the total kept it.

The adapter now maps web search request counts (from Usage.server_tool_use or
Gemini's prompt_tokens_details) into usage.server_tool_use.web_search_requests,
matching the Anthropic API shape, and the Gemini web search cost calculator falls
back to server_tool_use when prompt_tokens_details carries no count. The shared
get_web_search_requests helper is now public since five modules consume it.

Resolves LIT-6288
2026-08-26 18:14:10 -07:00
mateo-berri
901bea41e7 Merge branch 'litellm_internal_staging' of https://github.com/BerriAI/litellm into litellm_gemini_latest_cache_read_rates
# Conflicts:
#	tests/test_litellm/llms/gemini/test_cost_calculator.py
2026-08-26 17:04:59 -07:00
mateo-berri
1e1c231076 fix(model_prices): bill gemini -latest/preview alias cache reads at 10% of input 2026-08-26 16:52:09 -07:00
Mateo Wang
40005cf7f8
Merge pull request #37724 from bisma-nawaz/fix-37647-staging
fix: map Gemini ON_DEMAND_FLEX traffic type to flex service tier
2026-08-26 16:51:56 -07:00
mateo-berri
885d95d71b Merge remote-tracking branch 'origin/litellm_internal_staging' into pr37724
# Conflicts:
#	tests/test_litellm/test_cost_calculator.py
2026-08-26 16:33:28 -07:00
mateo-berri
dca5144dba Merge branch 'litellm_internal_staging' of https://github.com/BerriAI/litellm into litellm_gemini_maps_grounding_cost
# Conflicts:
#	litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
2026-08-26 16:27:40 -07:00
mateo-berri
9003b02c3c Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_gemini_web_search_unique_queries_36377
# Conflicts:
#	tests/test_litellm/llms/vertex_ai/gemini/test_vertex_and_google_ai_studio_gemini.py
2026-08-26 15:39:17 -07:00
Mateo Wang
f7220556e1
Merge pull request #38395 from BerriAI/litellm_gemini_live_voice
fix(gemini-realtime): keep the client's voice on Vertex AI native-audio Live
2026-08-26 15:34:53 -07:00
Hamza Shah
5d4f8b36a6
fix(fireworks_ai): stop using the trace id as the session affinity key (#35754)
get_fireworks_session_id fell back to litellm_trace_id when no session id was
given. That id is generated per request (uuid4 when absent), so x-session-affinity
carried a different value every time and Fireworks prompt caching never hit;
cached_tokens stayed 0 across identical prompts.

The None path the original change described was effectively unreachable because
of it. Drop the fallback so affinity comes only from an id the caller actually
supplied: litellm_session_id, session_id, or metadata.session_id.

Callers who were relying on a trace id for affinity can pass litellm_session_id
instead, which is stable across the requests they want grouped.

Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
2026-08-26 18:33:56 -04:00
mateo-berri
241daa4cb7 Merge branch 'litellm_internal_staging' of https://github.com/BerriAI/litellm into litellm_gemini_maps_grounding_cost
# Conflicts:
#	type-discipline-budget.json
2026-08-26 15:33:28 -07:00
Mateo Wang
a8f3a74360
Merge pull request #38397 from BerriAI/litellm_deepseek_vision_forwarding
fix: forward image content lists to DeepSeek vision models
2026-08-26 15:32:25 -07:00
mateo-berri
b9a790899a fix(gemini): bill Google Maps grounding as its own SKU
Gemini API Maps-grounded prompts were billed as web search and Vertex AI Maps-grounded prompts were not billed at all. Classify grounding metadata per candidate into web search vs Maps requests, carry a distinct google_maps_grounding_requests usage counter through non-streaming and streaming paths, and price it via the new google_maps_grounding_cost_per_query cost map key with per-query and per-prompt defaults keyed off web_search_billing_unit. Fixes #35906
2026-08-26 15:31:27 -07:00
mateo-berri
aabbc3204b fix(gemini-realtime): drop the native-audio speechConfig strip on Google AI Studio too
Live probes against every gemini_native_audio model on both providers show
setup accepts a valid prebuilt voice and 1007s only unknown voice names, so
the strip predicate rested on a false premise and silently discarded the
client's voice on AI Studio native-audio sessions
2026-08-26 15:06:23 -07:00
yuneng-jiang
4148cf7d7d
Merge pull request #38309 from BerriAI/litellm_azure_ai_unprocessable_retry_tests
test(azure-ai): pin the 422 retry that drops the field the provider rejected
2026-08-26 14:52:41 -07:00
Yucheng Zhu
27207659f8 fix(gemini-realtime): drop OpenAI stock voice names instead of pairing them to Gemini voices 2026-08-26 13:56:01 -07:00
Mateo Wang
c66c5eb5e7
Merge pull request #38400 from BerriAI/litellm_lit_3369_global_ssl_verify
fix(aiohttp): honor global ssl_verify on the aiohttp_openai handler path
2026-08-26 13:45:54 -07:00
mateo-berri
f0412345b5 fix(aiohttp): honor global ssl_verify on the aiohttp_openai handler path 2026-08-26 13:24:36 -07:00
Yucheng Zhu
c3c9903ba5 fix: collapse image_url blocks whose payload lacks a url instead of forwarding them 2026-08-26 13:19:06 -07:00
Mateo Wang
abf6ef96db
Merge pull request #36762 from danielva-monday/fix/bedrock-converse-1h-cache-cost
fix(bedrock): parse cacheDetails for Converse 1h/5m cache write cost split
2026-08-26 13:12:33 -07:00
Yucheng Zhu
df7b1f0fce fix: forward image content lists to DeepSeek vision models 2026-08-26 13:08:22 -07:00
Yucheng Zhu
8e1dcf02ea style(gemini-realtime): wrap overlong docstrings to the 120 char limit 2026-08-26 12:54:44 -07:00
Mateo Wang
724c5c2d96
Merge pull request #38390 from BerriAI/litellm_realtime_health_ga_protocol
fix(health): probe Azure GA realtime path for transcription-only models
2026-08-26 12:53:05 -07:00
Yucheng Zhu
002407af90 fix(gemini-realtime): map OpenAI stock voice names to Gemini prebuilt voices 2026-08-26 12:48:01 -07:00
mateo-berri
ca177f9cbc Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_pr36762_bedrock_cache_details
# Conflicts:
#	litellm/llms/bedrock/chat/converse_transformation.py
2026-08-26 12:45:15 -07:00
Mateo Wang
c850ed3c8e
Merge pull request #38393 from BerriAI/litellm_minimax_messages_env_key
fix(minimax): attach MINIMAX_API_KEY on anthropic messages requests
2026-08-26 12:44:01 -07:00
mateo-berri
7c717c7c6a test(realtime): pin mode-only transcription detection and correct a stale docstring 2026-08-26 12:33:46 -07:00
mateo-berri
74263bcb23 fix(minimax): attach MINIMAX_API_KEY on anthropic messages requests 2026-08-26 12:19:37 -07:00
mateo-berri
ece187ea24 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_anthropic_fast_mode_cache_and_response_speed
# Conflicts:
#	tests/test_litellm/test_cost_calculator.py
2026-08-26 12:10:33 -07:00
Marty Sullivan
5d8769bbaf fix(gemini-realtime): keep the client's voice on Vertex AI native-audio Live
Vertex AI Live accepts a speechConfig on setup for native-audio models, so
stripping it silently discarded the voice a client asked for. Confirmed against
a live BidiGenerateContent session on gemini-live-2.5-flash-native-audio and on
gemini-live-2.5-flash-preview-native-audio-09-2025: both return setupComplete
with speechConfig present.

The strip stays in place for Google AI Studio, which was never verified to
accept it, via an overridable predicate matching the existing
_include_function_response_id pattern. The responseModalities TEXT to AUDIO
coercion is unchanged, since Vertex does reject TEXT on these models.
2026-08-26 12:09:07 -07:00
Mateo Wang
8dc17e808a
Merge pull request #38240 from BerriAI/devin_ai_anthropic_messages_missing_key
fix(anthropic): raise missing-credential error on /v1/messages passthrough
2026-08-26 12:06:37 -07:00
Mateo Wang
80843ae7cb
Merge pull request #38279 from 6matt/litellm_bedrock_converse_gpt5_reasoning_effort
fix(bedrock): map reasoning_effort to reasoning.effort for OpenAI GPT-5.x on Converse
2026-08-26 11:48:18 -07:00
mateo-berri
c330d466f3 fix(anthropic): normalize oauth authorization header to one canonical casing 2026-08-26 11:45:51 -07:00
Mateo Wang
767e6015af
Merge pull request #34658 from BerriAI/litellm_azure_realtime_entra_id_auth
fix(azure/realtime): authenticate realtime websocket with Azure AD token when no api-key
2026-08-26 11:44:38 -07:00
Mateo Wang
2d3144c6c8
Merge pull request #38368 from BerriAI/litellm_fix_bedrock_mantle_gpt55_gpt54_context_window
fix(model_prices): raise bedrock_mantle gpt-5.5 and gpt-5.4 max_input_tokens to Mantle's enforced 1050000
2026-08-26 11:42:47 -07:00
mateo-berri
a0d1fef89d fix(anthropic): scale cache costs by fast mode and trust served speed 2026-08-26 11:24:12 -07:00
mateo-berri
2068066d69 fix(anthropic): detect oauth Authorization header case-insensitively 2026-08-26 11:16:17 -07:00
Mateo Wang
d46bcde2b5
Merge pull request #37922 from BerriAI/litellm_techdebt_20260822
chore(typing): roll up the daily tech debt cleanups from Aug 20 to Aug 26
2026-08-26 10:54:50 -07:00
mateo-berri
b97d5e77eb fix(model_prices): raise bedrock_mantle gpt-5.5 and gpt-5.4 max_input_tokens to Mantle's enforced 1050000 2026-08-26 10:42:00 -07:00
Mateo Wang
95285c3433
Merge pull request #38211 from eugene-yao-zocdoc/litellm_anthropic_responses_strictness_pr
fix(anthropic-responses): preserve structured output strictness
2026-08-26 10:39:45 -07:00
mateo-berri
0bfc733278 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_techdebt_20260822 2026-08-26 10:35:55 -07:00
mateo-berri
c449f11451 fix(anthropic): detect client credential headers case-insensitively on /v1/messages 2026-08-26 10:35:39 -07:00
Mateo Wang
cdb60af024
Merge pull request #38269 from BerriAI/litellm_together_structured_outputs
fix(together_ai): fail open on response_format instead of dropping it for unregistered models
2026-08-26 09:34:56 -07:00
mateo-berri
910c41f154 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_branchless_provider_status_mapping
# Conflicts:
#	tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py
2026-08-26 00:55:42 -07:00
Devin AI
2eedcb62ce Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_techdebt_20260822 2026-08-26 07:54:51 +00:00
mateo-berri
53037c34ed fix(exceptions): map upstream status codes for providers with no exception_type branch 2026-08-26 00:47:28 -07:00
Devin AI
055b6f6f69 chore: merge litellm_internal_staging into rolling techdebt branch
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-26 07:44:58 +00:00
mateo-berri
5cfc1608f9 fix(anthropic): map only provider failures on the /v1/messages boundary 2026-08-26 00:31:18 -07:00
mateo-berri
3fe65029bf fix(exceptions): map anthropic 403 to PermissionDeniedError
Now that /v1/messages routes provider failures through exception_type, an
Anthropic permission_error fell through the anthropic branch to the generic
APIConnectionError and reached the client as a 500 where the raw exception
used to answer 403. Map 403 to PermissionDeniedError so the status survives
on every route.
2026-08-26 00:09:10 -07:00
Yuneng Jiang
be4a79710d
test(azure-ai): match the exact route the provider is called on
The fixture was matched by host alone, so it answered any method and path and
the tests would have stayed green if the request went somewhere else. It now
matches POST on the Foundry route, and asserts the route was called.

Worth pinning on its own: the real path carries a /models prefix, which the
first attempt at this got wrong, so the match now also holds the routing in
place rather than only the retry.
2026-08-25 23:43:11 -07:00
Yuneng Jiang
8a61263ab4
test(azure-ai): build each retry test its own tool payload
The source drops the rejected field in place, so a payload shared across
tests could in principle be consumed by whichever case ran first. It does
not happen today, because the request is copied before the transform runs,
and the cases pass in reverse and async-first order alike. Building the
payload per call costs nothing and keeps that true if the copy ever goes.
2026-08-25 23:38:22 -07:00