Commit graph

48834 commits

Author SHA1 Message Date
mateo-berri
edde95197a test(proxy): cover every /v1/files route error type and param 2026-09-08 11:11:48 -07:00
mateo-berri
57fd8f6f49 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_openai_error_payload_non_llm_routes
# Conflicts:
#	litellm/proxy/anthropic_endpoints/endpoints.py
#	litellm/proxy/image_endpoints/endpoints.py
2026-09-08 11:09:54 -07:00
mateo-berri
deaadc21d3 fix(fireworks_ai): fold instructions and developer items into one leading system message on the Responses path 2026-09-08 11:08:03 -07:00
Mateo Wang
82e6b84f5a
Merge pull request #39384 from BerriAI/litellm_fix_invalid_index_after_migration_deadlock
fix(proxy-extras): rebuild indexes left INVALID by a migration deadlock
2026-09-08 10:35:40 -07:00
yassin
84a5136f45 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_invalid_index_after_migration_deadlock 2026-09-08 17:25:50 +00:00
Mateo Wang
9b74e6f34e
Merge pull request #40009 from BerriAI/litellm_lit_7039_least_busy_shared_counts
fix(least-busy): share in-flight request counts across proxy workers
2026-09-08 10:21:32 -07:00
Mateo Wang
f769aa4675
fix(router): give cooldowns their own cache so siblings see a bench in ~1s (#40025)
Cooldown entries rode the router-wide DualCache, which re-reads a key that is
missing from memory at most once every 10s. A deployment benched on one replica
therefore kept taking traffic on its siblings for up to 10 seconds, and the same
shared in-memory tier could evict a live cooldown once 200 unrelated router keys
crowded it out, which sent even the benching replica back to the dead deployment.

CooldownCache now owns a DualCache over the router's Redis with a 1s read
interval and an in-memory tier that only holds cooldown keys. Redis is attached
lazily because the router builds the cooldown cache before it wires Redis up.
2026-09-08 10:11:20 -07:00
yassin
eeef03f122 chore: merge litellm_internal_staging into litellm_lit_7039_least_busy_shared_counts
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 17:11:05 +00:00
Mateo Wang
a85c3152ca
fix(proxy): load db credentials in the model reconcile so a worker never serves a model before its credential (#39876)
* fix(proxy): load db credentials inside the model reconcile so a worker never serves a model before its credential

* fix(proxy): load db credentials in the model read-through so a request miss never adds a model before its credential

* fix(proxy): read credentials from the writer db before the router update and look a credential up once

* test(proxy): assert the credential is loaded when db models reach the router instead of the call order
2026-09-08 10:08:24 -07:00
yassin
6a30467948 chore: merge litellm_internal_staging into litellm_fix_invalid_index_after_migration_deadlock
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 17:07:34 +00:00
Mateo Wang
99824533ff
fix(proxy): kill the whole prisma process group when a boot migration command times out (#39509)
* fix(proxy): kill the whole prisma process group when a boot migration command times out

* fix(proxy): keep boot alive when the installed proxy extras has no prisma runner
2026-09-08 10:06:53 -07:00
devin-ai-integration[bot]
978f93ce9c
fix(tool_permission): log expected skip and deny events below WARNING (#40208)
The no-tools skip path in async_pre_call_hook now logs at DEBUG and the
denied-by-rule messages in async_pre_call_hook and _evaluate_tool_calls
log at INFO. The malformed tool arguments warning is unchanged. Adds
regression tests pinning each level

Co-authored-by: yucheng <yucheng@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 10:05:32 -07:00
Clement
95c0f9db7d
fix(router): rank streaming latency routing by raw TTFT, not TTFT per token (#40202)
* fix(router): rank streaming latency routing by raw TTFT, not TTFT per token

Latency-based routing divided time-to-first-token by completion_tokens
before storing it, so a deployment that streamed a long answer looked
faster to first token than one that answered briefly. TTFT is now stored
as plain seconds (first token time minus request start) in both the sync
and async success handlers, which is what the routing decision compares.

Non-streaming latency normalization per output token is unchanged.

Claude-Session: https://claude.ai/code/session_01Ttd5Q9ZhRPB4ch5guos3rj

* fix(router): store streaming TTFT under a seconds-only cache key

Workers on the previous release keep writing seconds-per-token samples
under "time_to_first_token" in the shared router cache during a rolling
deploy, so mixing the new raw-seconds samples into the same list averaged
incompatible units. Raw TTFT now lives under "time_to_first_token_seconds"
and routing reads only that key.

Also fix the regression test's token counts: with 50 tokens on the fast
deployment and 500 on the slow one the old per-token formula picks the
slow deployment, so the routing assertion now catches the bug.

Claude-Session: https://claude.ai/code/session_01Ttd5Q9ZhRPB4ch5guos3rj

* test(router): cover the TTFT sliding window from the unit-test shard

Move the TTFT list trimming checks from the CircleCI-only suite into the
mapped unit test file as one sync/async parametrized test, so the changed
lines in lowest_latency.py are exercised by the GitHub unit-test shard
that reports patch coverage.

Claude-Session: https://claude.ai/code/session_01Ttd5Q9ZhRPB4ch5guos3rj
2026-09-08 10:05:23 -07:00
jesus
06497ab42a fix(ui): guard playground cost metric against null and NaN
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 15:13:53 +00:00
jesus
6f3b3c7957 test: cover responses bridge reasoning at HTTP boundary
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 14:27:12 +00:00
mateo-berri
bf9437780b refactor(types): replace Any with real types across 11 more backend files
Final batch of the fifth basedpyright Any reduction round. Every change is
typing-only and leaves runtime behavior identical.

These are the densest remaining files, so the yield per file is small and most
of the batch was left alone deliberately. The Riva transcription handler
describes the SDK module attributes it reads with Protocols instead of a bare
ModuleType, the AWS secret manager stops hiding a botocore header object behind
Any, and the sensitive data masker, MCP SSO assertion store and Ovalix guardrail
move payload and option annotations to object and Mapping[str, object].
2026-09-08 14:09:22 +00:00
jesus
5520c3bb1a refactor: simplify allowed_openai_params bridge override
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 13:53:02 +00:00
jesus
17dd6afbaa fix: keep reasoning_effort for mode: responses bridge deployments
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 13:51:58 +00:00
mateo
fd1fad5e05 test: annotate registry metadata test parameters
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 13:37:56 +00:00
mateo
cb8daee55f chore(registry): absorb #40185 daybreak-blue and #40159 cloudflare rpm limits
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 13:23:25 +00:00
mateo
e8423695c1 chore: merge litellm_internal_staging into rolling registry PR
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 13:10:36 +00:00
mateo-berri
1ec5083ab4 refactor(types): replace Any with real types across 54 more backend files
Third batch of the fifth basedpyright Any reduction round. Every change is
typing-only and leaves runtime behavior identical.

Provider transformation configs, video and rerank base classes, OTel metadata
and the guardrail and realtime type modules move their payload, header and
optional-parameter annotations from Any to object, Mapping[str, object] or the
concrete model the call site already produces. Repositories and endpoints that
reached Prisma through an untyped handle now name the actions they call with the
repo's own TableActions protocol. The pydantic field retypes were checked
against pydantic to confirm object and Any validate, serialize and generate JSON
schema identically.
2026-09-08 12:41:07 +00:00
Oliver Jensen
992ee37258
Update litellm/proxy/health_endpoints/_health_endpoints.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-09-08 13:21:45 +02:00
Oliver Jensen
78893723f7 fix(auth): drop env-credential hint from 401 when env login is disabled 2026-09-08 13:05:38 +02:00
mateo-berri
f747bc6704 refactor(types): replace Any with real types across 29 more backend files
Second batch of the fifth basedpyright Any reduction round. Every change is
typing-only and leaves runtime behavior identical.

Guardrail hooks and file, vector store and usage endpoints move their payload,
header and response annotations from Any to object, Mapping[str, object] or the
concrete response model the call site already produces. Two private aggregation
helpers in the guardrail usage endpoints take a key accessor function instead of
an attribute name string, so the key they read is checked against the row type.
The verification token repository reaches its two tables through Protocols that
name the handles it calls, rather than reading them off an untyped prisma
client, and the Azure AD credential wrapper describes the azure-identity
credential it wraps the same way.
2026-09-08 10:14:07 +00:00
mateo
61e664088c test: make the explicit stagger offset assertion independent of the wall clock
Some checks failed
LiteLLM Rust / rust-lint (push) Waiting to run
LiteLLM Rust / rust-test (push) Waiting to run
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-08 09:51:09 +00:00
mateo
ebf6ef642e Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_deflake_20260905 2026-09-08 09:19:21 +00:00
mateo-berri
fa966ca2d0 refactor(types): replace Any with real types across 20 backend files
Fifth round of basedpyright Any reduction. Every change is typing-only and
leaves runtime behavior identical.

Prisma table access now goes through the PrismaTableRepository and TableActions
protocols the repo already has, instead of reading untyped attributes off
prisma_client.db. Payload and parameter annotations move from dict[str, Any] to
dict[str, object] or Mapping[str, object]. Guardrail constructors that took
**kwargs: Any now take Unpack of a PEP 728 TypedDict, the same
_CustomGuardrailOptions shape three other guardrails already use. Calls into the
OpenAI and Azure assistants SDKs pass explicit keywords rather than splatting a
dict, so the arguments are checked against the real SDK signatures.
2026-09-08 08:10:30 +00:00
Yuneng Jiang
0c519b162f
fix: preserve MongoDB deadlines and secure remote sidecar transport 2026-09-07 23:43:21 -07:00
tin-berri
1af7a403c6
feat(mcp): start the named server's OAuth directly for a resource-scoped gateway flow (#39933)
An aggregate gateway DCR authorize whose RFC 8707 resource resolves to exactly one
gateway-managed oauth2 server sealed that server into the flow and then sent the browser to
the generic connect grid anyway, so the user had to find the server the client had already
named and click Connect.

The connect URL now carries only the flow handle. GET /authorize/flow classifies the sealed
flow as unscoped, interactive, M2M, or stale, and returns the matching state to the page.
Interactive flows require a live per-user vendor credential before minting and do not burn the
flow on an early submit. M2M flows use the gateway's configured service credential and finish
without an interactive OAuth trip. Stale flows fail closed instead of becoming unscoped.
The existing explicit Finish action and a new Cancel path preserve deliberate user intent.
2026-09-07 23:40:02 -07:00
tin-berri
9a9b4c4c25
feat(ui): show auto-router classification rate (#40192) 2026-09-07 23:37:42 -07:00
tin-berri
1a6aa98230
fix(spend): compare auto-router targets by deployment identity (#40206)
Preserve deployment identity through savings calculation, with canonical model fallback only when either ID is absent. Cover negotiated rates, unchanged deployments, alias/base-model cache accounting and missing IDs.

Fixes #38811. Based on the deployment-identity approach proposed by @QuantumBreakz in #38834.

Co-authored-by: Claude Code <noreply@anthropic.com>
2026-09-07 23:29:42 -07:00
Yuneng Jiang
5c037299f4
feat: move MongoDB vector search to an optional sidecar 2026-09-07 23:02:27 -07:00
mateo-berri
13db79da46 fix(azure_ai): price streamed Responses relays from their terminal event
A streamed Responses API relay handed the success handler a bare ResponsesAPIResponse, which the streaming assembly step drops, so the relay never reached the spend callbacks. Hand it the terminal response.completed event instead, which the assembly step already converts, and cover the whole flush path with a regression test that fails on the previous tip.
2026-09-07 22:38:41 -07:00
mateo-berri
3cadf2f8f7 test(azure_ai): charge the router fee over cached prompt tokens too 2026-09-07 22:35:19 -07:00
mateo-berri
5706952588 fix(azure_ai): drop gpt-chat-latest effort levels, test prices via calculator
litellm's azure_ai config rejects reasoning_effort for gpt-chat-latest and Azure documents a fixed reasoning level for it, so the entry no longer advertises reasoning_effort_levels. The catalog metadata tests compare cost_per_token and the whisper transcription cost with the entry the calculator read instead of with list-price literals, the pattern #40195 removed
2026-09-07 22:22:51 -07:00
mateo-berri
d202885f8b fix(proxy): run prompt caching counts and custom tokenizer loads off the event loop 2026-09-07 22:21:45 -07:00
mateo-berri
704013dbb6 fix(init): keep non-flag LITELLM_DROP_PARAMS values on with a warning
The merge base read the variable by truthiness, so any non-empty value
turned the global flag on. Parsing it as a flag made a value such as
temperature or enabled silently turn it off, and the only docs for the
variable describe it as a list of parameter names, so keep those values
on and log a warning that asks for true or false. A blank value stays off
without a warning
2026-09-07 22:13:23 -07:00
mateo-berri
9fcc64fbf9 fix(files): only proxy admin keys may delete raw cloud storage file ids
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
A key allowed to call a Bedrock model could delete any object under the
deployment's buckets through DELETE /bedrock/v1/files/{s3 id}?model=...
because the managed-file ownership check only runs for unified ids. Raw
cloud storage ids now answer 403 on every delete route unless the caller
is a proxy admin; managed ids and require_managed_files are unchanged
2026-09-07 22:09:44 -07:00
mateo-berri
9666a21cf0 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_lit_7022_azure_ai_passthrough_config 2026-09-07 21:57:00 -07:00
mateo-berri
52e9cfe254 fix(azure): price streamed Responses relays and keep a full-URL api_base from doubling the native path 2026-09-07 21:57:00 -07:00
mateo-berri
1de369a1a4 fix(passthrough): bound azure relays to the key's model group and reject foreign deployment segments 2026-09-07 21:54:37 -07:00
mateo-berri
08b60c409a refactor(guardrails): drop the unused rewrites_streamed_output hook
Nothing calls it since the streaming pipeline detects rewrites at run time
through the stream observer, so the base method and the content filter's
override were dead code with dead tests
2026-09-07 21:53:26 -07:00
mateo-berri
d08a177bc7 fix(policy_engine): keep a policy-added guardrail's other stages when a pipeline steps it
A policy that both adds a guardrail and steps it in a post_call pipeline
used to drop the guardrail from the request's guardrail list outright, so
its pre_call stage never ran. The per-hook loops already skip guardrails
by pipeline mode, so the mode-agnostic subtraction only lost coverage
2026-09-07 21:51:34 -07:00
mateo-berri
91fc1b2010 fix(policy_engine): record a streaming pipeline step once and in the applied guardrails header
CustomGuardrail.__init_subclass__ wrapped _StreamRewriteObserver.apply_guardrail in log_guardrail_information, so every streaming step recorded a second standard_logging_guardrail_information entry and span next to the inner guardrail's own. The observer's method now carries the marker that skips the wrapper. The step also adds the guardrail to the applied guardrails header the way the non-streaming unified path does, so streamed spend rows name the guardrail that scanned them
2026-09-07 21:48:19 -07:00
mateo-berri
69d2ac1edb fix(policy_engine): run iterator-hook guardrails whose post_call pipeline cannot stream
The streaming loop skipped every guardrail stepped by a post_call pipeline, even when the pipeline was dropped from the stream for lacking the unified apply_guardrail interface, so a default_on guardrail that only implements async_post_call_streaming_iterator_hook stopped governing streams it governed on the merge base. The skip set now comes from the pipelines that will gate the stream
2026-09-07 21:46:00 -07:00
mateo-berri
55c10c1983 fix(azure_ai): charge the router fee once for any router name and price grok-4-20 cache reads
Direct litellm.cost_per_token callers that name a Model Router deployment as
the model get the routing fee again, as they did before this branch, and the
fee is still charged exactly once on every completion_cost path. The
grok-4-20 entries bill cached prompt tokens at the input rate, since Azure has
no cached-input meter for them, and the model_router twin carries the same
limits and retirement date as model-router. The catalog test now exercises
the cost calculator and map relations instead of pinning map fields.
2026-09-07 21:34:34 -07:00
mateo-berri
83d500bac9 fix(router): count deployment itpm reservations off the event loop 2026-09-07 21:29:26 -07:00
mateo-berri
5f4d667365 fix(files): keep the SDK listing a list and build the OpenAI page at the proxy route 2026-09-07 21:17:37 -07:00
mateo-berri
c02f2dc0fe fix(azure_ai): keep the request_model keyword on cost_per_token
Restores the public keyword removed at 415bdbfd8f. A direct caller that
names the Model Router as the request model gets the routing fee folded
into the prompt cost once; completion_cost never passes it and charges
the fee through the additional-costs hook as before
2026-09-07 21:10:54 -07:00