Commit graph

44634 commits

Author SHA1 Message Date
yassin
782d1ebb40 fix(auth): honour cached CLI session revocations before checking DB availability
Some checks failed
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-08-25 20:21:51 +00:00
yassin
e57250f5f8 test: suppress TQ008 on new CLI session tests that stub proxy_server globals
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 20:13:13 +00:00
yassin
9c031d208e fix(auth): drop expired CLI session rows on registration
Every lite login inserted a row that was never removed, so the registry grew without bound as logins accumulated. Registration now deletes rows whose expires_at has passed, bounding the table by the number of live sessions.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 20:13:13 +00:00
Yassin Kortam
217d3f38de test(cli-sessions): drop the cwd-relative sys.path.insert hacks
The two new CLI-session test files were added before #37802 swept the
suite's sys.path.insert(0, os.path.abspath(...)) calls, so rebasing onto
staging put them over the TQ003 test-quality-budget ceiling and failed lint.
2026-08-25 20:13:13 +00:00
Yassin Kortam
b78be07134 feat(auth): list and revoke lite login CLI sessions from the Admin UI
`lite login` mints a self-contained encrypted UserAPIKeyAuth blob rather than a
virtual key, so nothing about the session was stored server side and the auth
path authenticated it by decrypting it. An admin had no way to see who held a
live CLI credential and no way to cut one off before it expired.

Every login now registers a row in LiteLLM_CLISessionTable, keyed by the sha256
of the session token, and the auth path refuses a session whose row is revoked.
The lookup is cached in the shared auth DualCache for DEFAULT_IN_MEMORY_TTL, so
a session costs one read per cache interval per replica and a revoke converges
on every replica within that same interval. A CLI Sessions page in the dashboard
lists the sessions with their user, issue time and expiry, and revokes one.

Registration is fail-closed: a session that cannot be recorded is never handed
to the CLI, since it could never be revoked. Sessions minted before this change
have no row and keep working until they expire. A lookup that cannot reach the
database follows the proxy-wide allow_requests_on_db_unavailable posture rather
than inventing its own, so the credential's availability during an outage is
whatever the operator already chose for every other DB-backed auth read.
2026-08-25 20:13:13 +00:00
Yassin Kortam
104fe73113
fix(dashboard): don't show a stale provider prompt-cache chip on a response-cache hit (#37951)
* fix(dashboard): don't show a stale provider prompt-cache chip on a response-cache hit

The playground's non-streaming chat completion and responses paths replayed a cache hit's original usage payload verbatim, so ResponseMetrics kept rendering the provider's prompt-cache-write/read chips using token counts from the original request. Detect the hit via the x-litellm-cache-key response header and render a Response Cache indicator instead.

* fix(dashboard): expose x-litellm-cache-key through CORS for the playground cache-hit indicator
2026-08-25 13:07:09 -07:00
Yassin Kortam
27ca05a707
fix(ui): read reasoning tokens from Responses API output_tokens_details (#37952) 2026-08-25 13:01:51 -07:00
Mateo Wang
ece03ceafe
Merge pull request #38248 from BerriAI/litellm_together_chat_config
fix(together_ai): route chat completions through a dedicated TogetherAIChatConfig
2026-08-25 12:55:31 -07:00
devin-ai-integration[bot]
0458accaa0
perf(auth): drop guaranteed-miss internal-cache Redis read from team object lookup (#38073)
Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 12:47:37 -07:00
devin-ai-integration[bot]
896e2598da
fix(caching): keep upstream RedisCluster on redis-py with per-connection recovery (#38171)
Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 12:45:23 -07:00
devin-ai-integration[bot]
e25ce85dbc
fix(proxy): stop expected 4xx responses from saturating worker CPU on failure logging (#38102)
* fix(proxy): stop expected 4xx responses from saturating worker CPU on failure logging

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): keep threaded sync failure handler so CustomLogger sync callbacks still run

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* chore: remove redundant comments per review

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yassin <yassin@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 12:44:16 -07:00
Mateo Wang
c6082c5255
Merge pull request #37897 from BerriAI/litellm_reasoning_effort_capability_v2
feat(router): per-group supported reasoning efforts with the max level
2026-08-25 12:41:21 -07:00
ryan-crabbe-berri
3db6c5ab18
Merge pull request #37770 from BerriAI/litellm_fix_model_router_spend_log_model
fix(proxy): store the actual selected model in spend logs for Azure Model Router
2026-08-25 12:35:35 -07:00
mateo-berri
5b2d1874b0 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_reasoning_effort_capability_v2
# Conflicts:
#	tests/test_litellm/test_router.py
2026-08-25 12:07:05 -07:00
Mateo Wang
a9f42f0ccf
Merge pull request #38227 from BerriAI/litellm_mantle_codex_input_items
fix(bedrock_mantle): normalize Codex input item types Mantle rejects
2026-08-25 12:04:13 -07:00
mateo-berri
32ebfba5ed refactor(together_ai): build the trimmed supported-params list without mutating the inherited list 2026-08-25 12:03:51 -07:00
mateo-berri
636ae5d3c7 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_mantle_codex_input_items 2026-08-25 11:56:13 -07:00
Mateo Wang
c543461297
Merge pull request #38225 from BerriAI/litellm_fix_bedrock_mantle_gpt5_context_window
fix(model_prices): raise bedrock_mantle gpt-5.6 max_input_tokens to Mantle's enforced 1050000
2026-08-25 11:51:19 -07:00
Mateo Wang
76e1105f74
Merge pull request #38235 from BerriAI/litellm_router_api_base_resolution
fix(router): resolve provider from api_base in deployment validation and acompletion
2026-08-25 11:51:15 -07:00
Mateo Wang
18108ecc24
Merge pull request #38231 from BerriAI/litellm_fix_bedrock_mantle_passthrough_invoke
fix(bedrock_mantle): register a Bedrock runtime passthrough config so /bedrock/model/<deployment>/invoke works
2026-08-25 11:51:03 -07:00
mateo-berri
62ec3b6116 fix(together_ai): route chat completions through a dedicated TogetherAIChatConfig 2026-08-25 11:44:06 -07:00
milan
6cd1fcdcf0 test: drop unneeded proxy_server patches and ratchet lint budgets
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 18:37:26 +00:00
milan
77f22be207 style: apply ruff format to common_utils
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 18:27:19 +00:00
milan
559588a473 fix(azure_ai): remove new LIT002 violations to satisfy type-discipline budget
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 18:23:09 +00:00
Mateo Wang
41aa1caff1
Merge pull request #38233 from BerriAI/litellm_together_api_host
fix(together_ai): default endpoints to api.together.ai instead of api.together.xyz
2026-08-25 11:17:17 -07:00
milan
dacb1473bc chore: merge remote branch and resolve test conflicts
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 18:00:19 +00:00
milan
7a4567b6b3 chore: merge branch updates and resolve test conflicts
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 17:59:30 +00:00
Yassin Kortam
5470c1bccb
fix(ui): forward OAuth issuer/authorization/token/registration URLs from the MCP server edit form (#38154)
The edit form's Authorize & Fetch Token button built its temporary OAuth
session payload without issuer, authorization_url, token_url, or
registration_url, unlike the create form's equivalent payload builder. The
backend's temporary-session endpoint builds its ephemeral server purely from
that payload, so any admin-configured OAuth endpoints on an existing server
were silently dropped, endpoint discovery fell back to (and failed against)
the plain server url, and Authorize & Fetch Token 400'd with "authorization
url is not configured" even though the saved server had those fields filled
in. Add the four missing fields to the edit form's temporary payload builder,
mirroring the create form.
2026-08-25 10:59:26 -07:00
mateo-berri
e8bdbcd1cf fix(bedrock_mantle): parse converse passthrough bodies with the converse shape config for logging 2026-08-25 10:56:55 -07:00
ryan-crabbe-berri
c04b5dba32 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_model_router_spend_log_model
# Conflicts:
#	tests/test_litellm/litellm_core_utils/test_litellm_logging.py
#	tests/test_litellm/llms/azure_ai/chat/test_azure_ai_transformation.py
2026-08-25 10:55:53 -07:00
milan
65c0521b01 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_model_router_spend_log_model 2026-08-25 17:54:45 +00:00
ryan-crabbe-berri
c3bcb6f64f
test(mcp): drain the logging worker after each test so queued callbacks cannot leak into the next test (#38228)
LoggingWorker now carries still-queued coroutines onto the next event loop (12a34a10d8). Under xdist,
a success-logging coroutine queued by test_acompletion_mcp_respects_manual_approval ran nine seconds
later inside test_mcp_tool_call_hook on the same worker, resolved litellm.callbacks at run time and
overwrote that test's captured payload with a gpt-4o-mini completion (assert 1.35e-05 == 1.42).

Run clear_queue() in the suite's autouse teardown so every coroutine a test enqueues finishes before the
next test registers its callbacks, and add a subprocess regression test that runs the real conftest
against a stopped worker with work still queued.
2026-08-25 10:50:35 -07:00
ryan-crabbe-berri
0ea6f5e159 fix(azure_ai): stamp the model router's selected model instead of matching on the model name
The model Azure Model Router served was recovered by checking whether the text
"model_router" or "model-router" appeared in a model string. Spend logs applied that
check to the litellm model path, where the route prefix guarantees a match, but the
proxy applied it to the client's model group alias, which carries no prefix. A model
group named anything else therefore lost the selected model in both the response and
the spend row.

AzureModelRouterConfig now stamps the served model onto _hidden_params, and the spend
log payload and the proxy's response restamping read that stamp. The name heuristic
survives as a fallback for callers with no response in hand, routed through
get_azure_ai_route so it lives in one place.
2026-08-25 10:50:11 -07:00
Mateo Wang
751976db8b
Merge pull request #38229 from BerriAI/litellm_vertex_ai_interactions
feat(vertex_ai): add native Vertex AI Interactions API support
2026-08-25 10:50:02 -07:00
mateo-berri
5e6b6c6281 fix(together_ai): let an explicit api_key beat the Together env key on api_base match 2026-08-25 10:39:10 -07:00
mateo-berri
367a6e5dc5 test(router): pin the guard that keeps a junk-typed operator effort value out of model group info 2026-08-25 10:37:48 -07:00
mateo-berri
0bd4d323da fix(router): resolve provider from api_base in deployment validation and acompletion
Router._add_deployment called get_llm_provider without the deployment's api_base, so a config entry with a bare model plus a known OpenAI-compatible endpoint failed startup validation with LLM Provider NOT provided and the proxy returned 400 no healthy deployments for that model group. acompletion had the same gap at request time: it forwarded only base_url into its get_llm_provider call, dropping the api_base kwarg the router passes. Both now forward api_base so endpoint matching resolves the provider the same way sync completion already does
2026-08-25 10:33:40 -07:00
mateo-berri
6be000f1f3 test(bedrock_mantle): type _repo_cost_map return instead of bare dict 2026-08-25 10:23:12 -07:00
mateo-berri
fd1dca05de fix(bedrock_mantle): type the codex item dispatcher without Any 2026-08-25 10:19:56 -07:00
mateo-berri
b46f17faf5 fix(together_ai): default endpoints to api.together.ai instead of api.together.xyz
Together AI moved its canonical API host from api.together.xyz to
api.together.ai. Default the provider api_base and the rerank handler to
the new host, make rerank honor api_base and TOGETHER_AI_API_BASE like
chat already does, map both hosts to together_ai when passed as
api_base, and delete the dead models/info fetch in factory.py.
2026-08-25 10:18:55 -07:00
mateo-berri
68ad575fc2 fix(bedrock_mantle): register a Bedrock runtime passthrough config so /bedrock/model/<deployment>/invoke works 2026-08-25 10:10:38 -07:00
Mateo Wang
92fe35854b
Merge pull request #38222 from BerriAI/litellm_fix_mantle_reasoning_effort_max
fix(completion_extras): forward reasoning_effort=max through the Responses API bridge
2026-08-25 10:06:08 -07:00
Mateo Wang
9dff9cdd9a
Merge pull request #37979 from BerriAI/litellm_lit5714_adaptive_thinking_display
fix(anthropic/bedrock): request summarized adaptive thinking for reasoning_effort and use provider thinking token counts
2026-08-25 09:58:03 -07:00
mateo-berri
ed28581d79 fix(bedrock_mantle): normalize Codex input item types Mantle rejects
Mantle 400s ("Invalid 'input': value did not match any expected variant")
on the Codex history item types agent_message, context_compaction, and
local_shell_call, killing every Codex multi-agent session on the first
sub-agent turn. Rewrite agent_message into an assistant output_text message
(preserving encrypted_content slot payloads, which carry the plaintext task
through Mantle), context_compaction into Mantle's supported compaction
spelling, and local_shell_call into the function_call its recorded
function_call_output already pairs with.
2026-08-25 09:57:25 -07:00
mateo-berri
530dab32b9 feat(vertex_ai): add native Vertex AI Interactions API support 2026-08-25 09:55:13 -07:00
mateo-berri
f583151a5b fix(model_prices): raise bedrock_mantle gpt-5.6 max_input_tokens to Mantle's enforced 1050000 2026-08-25 09:53:19 -07:00
mateo-berri
9224b2ce5d fix(router): freeze reasoning effort flag mappings 2026-08-25 09:50:23 -07:00
Yassin Kortam
1d695a714b
fix(proxy): reset a stuck team member's budget (#37971)
* fix(proxy): reset a stuck team member's budget

A per-team-member budget check reads a cross-pod spend counter that
nothing ever invalidates. Once a member exceeds their per-member
budget, resetting the key's spend, raising the user's or the team's
own budget, or issuing a new key all leave the member stuck, because
none of them touch this counter or its cached membership object.

Add POST /team/{team_id}/member/{user_id}/reset_spend to reset a
member's tracked spend, and invalidate the same cached state from
/team/member_update when it raises a member's own budget, so that
path also takes effect immediately instead of waiting on the
membership cache's TTL. Name the entity in the check's error message
so a stuck member is diagnosable from the 429 body alone.

* fix(proxy): close reset-vs-floor-read race and surface double Redis write failure on member spend reset

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): broadcast spend reset as a SET so the handler's self-delivered message cannot erase the reset guard

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix(proxy): omit null fields from the invalidation message so plain evictions keep the old wire format

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-25 09:50:09 -07:00
mateo-berri
a73f11ae9c fix(completion_extras): forward reasoning_effort=max through the Responses API bridge 2026-08-25 09:40:23 -07:00
mateo-berri
7dc5a1682d Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_reasoning_effort_capability_v2 2026-08-25 09:28:55 -07:00