Commit graph

13510 commits

Author SHA1 Message Date
Mateo Wang
d77eef3d11
Merge pull request #38414 from BerriAI/litellm_fix_speech_metadata_spend_tracking
fix(speech): keep proxy metadata and completion cost through the TTS completion bridge
2026-08-26 16:51:50 -07:00
Mateo Wang
ad00d90b99
Merge pull request #38418 from BerriAI/litellm_gemini_maps_grounding_cost
fix(gemini): bill Google Maps grounding as its own SKU
2026-08-26 16:47:05 -07:00
tin-berri
cebf0d6f21
fix(responses): let cache-control injection reach the system prompt from instructions (#38120)
`AnthropicCacheControlHook` spends the configured injection points on the first
message list it is shown and drops the message points that matched nothing. That is
right when the messages it sees are the ones going upstream. It is wrong for
/v1/responses: the system prompt lives in `instructions`, which only becomes a system
message once the chat-completion bridge builds one, so a role-targeted point matched
nothing and was thrown away before the message it wanted existed. Injection silently
did nothing across the whole surface.

Hand those points back instead, stamped as judged, when the caller says its message
list is provisional. The stamp is what makes carrying them safe: without it the next
pass re-judges the points against messages this pass has already marked and stands the
whole configuration down. Callers holding the final messages -- /chat/completions and
/v1/messages -- do not raise the signal and keep dropping unmatched points as before.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 16:43:26 -07:00
tin-berri
d8edfb69c2
fix(proxy): derive auto-router health from its underlying models (#38174)
An auto_router deployment is a marker, not something a probe can contact, so
`_run_model_health_check` returns `{}` for it and it lands healthy whatever is
behind it. This derives its verdict from the models it actually resolves.

Rules and owners:

- `strategy_router_dependencies` is the single answer to "what does this router
  call": tier, default, classifier and embedding names per router kind, aligned
  with what init and the request path actually use.
- `_health_check_eligible` is the single probe-eligibility gate, applied to the
  requested set and to the pool a router's dependencies are drawn from alike, so
  an opted-out deployment cannot re-enter through a router that depends on it.
- `_resolved_deployment_ids` resolves names through `get_model_list`, the same
  composition of alias, routing-group and wildcard channels a request uses.
- A dependency reds its router only when *every* deployment behind the name is
  known unhealthy. A replica this run never judged, hidden from the caller or
  opted out of health checks, can still serve what the dead one drops, so
  partial evidence leaves the verdict green. Absent information never reds.
- Verdicts settle over rounds, because a marker never fails a probe of its own
  and a parent whose tier is a red router must inherit that fault. Both sweeps
  are bounded loops, so a router cycle terminates green.
- Dependency probes are added only on the targeted `/health?model_id=` path the
  dashboard uses per deployment, and are dropped from the response.

Resolves LIT-6073

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 16:41:54 -07:00
Mateo Wang
b98b2d562b
Merge pull request #38416 from BerriAI/litellm_fix_lazy_openapi_stubs_for_imported_modules
fix(proxy): key lazy openapi stubs off registered features, not sys.modules
2026-08-26 16:32:02 -07:00
mateo-berri
f758e9c30a Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_speech_metadata_spend_tracking 2026-08-26 16:30:30 -07:00
mateo-berri
6c07fd547b test: accept the Maps grounding rate in the intended cost map schema 2026-08-26 16:28:00 -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
fdeab570a1 fix(speech): forward api_key to the TTS bridge and isolate response hidden params 2026-08-26 16:23:33 -07:00
Mateo Wang
9e6d9e5964
Merge pull request #38417 from BerriAI/litellm_image_edit_health_probe_moderation_safe
fix(health): make the image_edit health probe moderation-safe
2026-08-26 16:03:14 -07:00
mateo-berri
2f796530d0 test(health): parse the probe PNG without mutation 2026-08-26 15:50:51 -07:00
mateo-berri
31f0d82f00 fix(ptu): zero the Maps grounding rate on PTU deployments 2026-08-26 15:50:36 -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
4d1d7b446f test(speech): type the bridge spend regression test helpers 2026-08-26 15:27:38 -07:00
mateo-berri
416984a5e0 fix(health): make the image_edit health probe moderation-safe
The image_edit health probe sent a 512x512 solid-gray PNG with the generic
chat prompt "test from litellm", an ambiguous pair OpenAI's gpt-image-1
output moderation sometimes rejects as moderation_blocked, which reported a
working deployment as unhealthy. The probe now sends a blue circle on a
white background with a descriptive edit prompt, and a provider moderation
verdict (ContentPolicyViolationError or a moderation_blocked error body) is
treated as proof the endpoint works rather than as an unhealthy deployment.
2026-08-26 15:23:08 -07:00
mateo-berri
fd751a5023 fix(proxy): key lazy openapi stubs off registered features, not sys.modules 2026-08-26 15:18:55 -07:00
ryan-crabbe-berri
52b7bea6f3
Merge pull request #37708 from BerriAI/litellm_team_member_budget_no_reset
fix(team): allow no-reset default budgets for team members
2026-08-26 15:14:30 -07:00
mateo-berri
3418d7baf9 fix(speech): keep proxy metadata and completion cost through the TTS completion bridge 2026-08-26 15:12:41 -07:00
Mateo Wang
632a007967
Merge pull request #38406 from BerriAI/litellm_fix_db_router_settings_overwrite
fix(proxy): stop empty DB router_settings lists from clobbering yaml fallbacks
2026-08-26 15:06:26 -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
Mateo Wang
77bce45100
Merge pull request #38405 from BerriAI/litellm_lit6243_prompt_cache_min_tokens
fix(cost-map): correct prompt_cache_min_tokens for Claude Fable 5 and backfill Anthropic re-export entries
2026-08-26 14:51:56 -07:00
Mateo Wang
9888830207
Merge pull request #38344 from ksk2023/fix-cost-alias-double-prefix
fix(cost_calculator): resolve real cost key when model_name alias contains '/'
2026-08-26 14:51:53 -07:00
Mateo Wang
16e9efccaf
Merge pull request #38404 from BerriAI/litellm_fix_prompt_data_double_nest
fix(prompts): reject keyed prompt_data with prompt_id and populate prompt version
2026-08-26 14:47:59 -07:00
mateo-berri
3b9f6ee2aa fix(proxy): apply empty DB router_settings lists only where yaml sets no value 2026-08-26 14:37:29 -07:00
mateo-berri
f772cad959 fix(cost-map): backfill prompt_cache_min_tokens for the remaining Claude 4.x re-export entries 2026-08-26 14:31:45 -07:00
mateo-berri
43b8ed0fd9 fix(prompts): validate only the litellm_params a PATCH sends 2026-08-26 14:20:26 -07:00
mateo-berri
951cef1e98 fix(cost_calculator): strip duplicated region segment from alias cost keys 2026-08-26 14:10:05 -07:00
Mateo Wang
f57e4b812c
Merge pull request #38403 from BerriAI/litellm_lit3373_valkey_acl
fix(caching): require the namespace delimiter when checking already-namespaced redis keys
2026-08-26 14:04:51 -07:00
ryan-crabbe-berri
870328f8cc test(team): fake the budget table instead of patching new_budget and update_budget
The three member-budget tests patched litellm internals and asserted only on
the mock, which tripped the TQ002 and TQ008 test-quality ratchet. Fake the
prisma budget table on the shared client and assert on the row that reaches
the database plus the returned team payload.
2026-08-26 14:00:45 -07:00
mateo-berri
caa97eea22 fix(cost-map): correct prompt_cache_min_tokens for Claude Fable 5 and backfill Anthropic re-export entries 2026-08-26 14:00:39 -07:00
mateo-berri
6d1b295dae fix(proxy): stop empty DB router_settings lists from clobbering yaml fallbacks 2026-08-26 13:58:00 -07:00
mateo-berri
6fa5164d86 fix(prompts): reject keyed prompt_data with prompt_id and populate prompt version
POST /prompts silently stored an empty template when litellm_params.prompt_id
was combined with prompt_data keyed by template name, because the loader
wrapped the already-keyed dict under prompt_id a second time. The loader now
wraps only a flat template (a dict carrying a content key), and create,
update, and patch reject the ambiguous keyed+prompt_id combination with a 400
that names both valid shapes. The API also returned version null on every
create and lost version, environment, and created_by on registry reload; both
now carry through. Versioned ids like my-prompt.v1, which the create API
itself returns, now resolve to their base template on the SDK prompt hooks,
and a flat DB prompt with no litellm_params.prompt_id registers under its base
API id instead of garbage.
2026-08-26 13:57:10 -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
3c24f37502
Merge pull request #38394 from BerriAI/litellm_lit6253_cache_hit_callback_flush
fix(logging_worker): rescue dequeued logging tasks lost at event loop close
2026-08-26 13:50:02 -07:00
mateo-berri
57f553aec8 fix(caching): treat an empty cache namespace as no namespace 2026-08-26 13:48:45 -07:00
milan
99d4741586 fix(team): allow no-reset default budgets for team members
The Default Budget Duration field in Team Member Settings only offered daily, weekly and monthly, so a team member budget could never be set to never reset. It now uses the shared BudgetDurationDropdown, and /team/update writes an explicitly null duration through to the member budget row along with its reset time.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-26 13:48:08 -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
yuneng-jiang
a5d8963616
Merge pull request #38308 from BerriAI/litellm_key-update-redis-evict
fix(proxy): stop cache eviction errors from failing /key/update
2026-08-26 13:44:20 -07:00
ryan-crabbe-berri
22b503d337
Merge pull request #36518 from kunal2002/enforce-rpm-tpm-on-model-add
feat(proxy): enforce rpm/tpm on model add + fix validation error title in UI
2026-08-26 13:42:17 -07:00
tin-berri
e4037978f1
fix(router): resolve model_group_alias before pre-routing strategy dispatch (#38382)
A model_group_alias whose target is an auto-router shows up in /v1/models and
/model_group/info but 400s on call with "Unmapped LLM provider for this
endpoint. You passed model=complexity_router, custom_llm_provider=auto_router".
async_pre_routing_hook picks the strategy using the name the caller passed,
while the alias is only resolved further down in
_common_checks_available_deployment, so the four strategy registries, all keyed
by the marker deployment's model_name, never match. The hook then declines, and
the auto_router/ marker deployment goes out as if it were a real model

Resolve the alias once at the top of the hook, for lookups only, so the
registries, the tag-filtering escape hatch and the marker's forwardable params
all see the name they are keyed under. The caller-facing name is untouched:
spend metadata is stamped before routing and the response still carries the
alias the client sent

Second half, so the same symptom cannot reach a provider through the entry
points this does not fix (the sync selection path that never runs the hook, a
team-scoped router keyed on its internal name), a group that resolves only to
strategy markers is no longer callable: it raises a BadRequestError naming the
marker instead of handing the auto_router/ pseudo-model to the provider
2026-08-26 13:38:55 -07:00
mateo-berri
ef7ba3e54b fix(logging_worker): swallow cancellation in exit flush and revive dequeued tasks on loop change 2026-08-26 13:30:40 -07:00
ryan-crabbe-berri
968c96143f test(proxy): assert the rpm/tpm guard returns None on the passing paths
Satisfies the TQ001 zero-assert gate
2026-08-26 13:27:02 -07:00
mateo-berri
7b8d48782b fix(caching): require the namespace delimiter when checking already-namespaced redis keys 2026-08-26 13:25:23 -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