Commit graph

15506 commits

Author SHA1 Message Date
mateo
5a3a2f3d0a Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_registry_audit_2026_09_02 2026-09-03 21:09:30 +00:00
Mateo Wang
5a821b593c
Merge pull request #38440 from BerriAI/litellm_prompt_registry_env
fix(prompts): key the in-memory prompt registry by environment
2026-09-03 14:09:26 -07:00
Mateo Wang
025a3ca42f
Merge pull request #39631 from BerriAI/litellm_gpt_6_astra_detection
fix: treat gpt-6 names as the gpt-5 request family in OpenAI and Azure configs
2026-09-03 14:00:59 -07:00
yuneng-jiang
de87b198ea
Merge pull request #39630 from BerriAI/litellm_router_get_configured_mode_test
test(router): cover get_configured_mode so router_code_coverage passes
2026-09-03 13:57:57 -07:00
devin-ai-integration[bot]
eb6c24a2a0
fix(auto_router): bill the routing embedding to the caller's key and team (#39532)
* fix(auto_router): bill the routing embedding to the caller's key and team

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

* refactor(auto_router): validate the forwarded caller metadata with a pydantic model

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-09-03 13:53:30 -07:00
Yuneng Jiang
52e24aebba
refactor(tests): assign the streamed id and lock poll once instead of rebinding
The cancel test accumulated chunk_count and reassigned response_id on every
iteration, and the lock watcher rebound its query result on every poll. Both are
the mutable-local pattern the repo avoids.

The stream now drains through a generator that stops at the first chunk carrying
a response id, so the caller binds streamed_ids once and reads the id off the
tail. Empty stream, no-id stream and first-chunk-id all behave exactly as the
loop did. The watcher inlines its poll result.
2026-09-03 13:49:43 -07:00
mateo-berri
108f558946 test: drop the internal patch from the gpt-6-astra bridge test 2026-09-03 13:46:33 -07:00
mateo-berri
e65e3d0e2b fix(cost): bill fireworks cached tokens at the off-peak input rate when no cache-read rate exists 2026-09-03 13:45:17 -07:00
mateo-berri
e297968826 feat(cost): honor off_peak_pricing reasoning and cache-creation rates
The block accepts output_cost_per_reasoning_token and cache_creation_input_token_cost. The generic
cost path and the DashScope calculator swap them in while a window is open, and unset keys keep the
standard rate. One shared TokenRates value replaces the DashScope-local copy, and
apply_off_peak_pricing takes and returns it.
2026-09-03 13:45:06 -07:00
moe-berri
a264c62b04 test(router): cover configured mode lookup 2026-09-03 13:43:30 -07:00
mubashir1osmani
4e0907fb2d test(router): use an unmapped model so get_configured_mode tests do not write into the global cost map 2026-09-03 16:40:58 -04:00
tin-berri
df73c623b2
feat(router): limit heuristic_v2 auto-routers to one without the auto_router license feature (#39468)
Without the auto_router feature in the signed enterprise license a proxy may hold
one complexity router with classifier_type heuristic_v2 across config.yaml and the
DB; with it the limit is lifted. The ceiling is derived once from LicenseCheck and
handed to the Router, which refuses the extra router at registration. config.yaml
over the limit refuses to start, and /model/new, /model/update and
PATCH /model/{id}/update refuse the write with a 403 before touching the DB.
Expiry follows the existing max_users/max_teams pattern: judged when the
license is verified, not on every call, and a verify that rejects the license
(expired or unreadable) leaves no signed payload behind. The rollback after a
failed upsert re-admits state that was already serving, so it is exempt from the
ceiling: an edit that fails, including one refused by a ceiling that has since
tightened, leaves the router serving its previous configuration.
A write that leaves a row on heuristic_v2 under a limited license runs in one
transaction that takes a Postgres advisory lock before counting the DB rows plus
this proxy's config.yaml routers, so concurrent writes on any pod cannot both
claim the sole slot and no surplus row is ever persisted.
Only the row insert runs under that lock: the team model bookkeeping, which
needs a second pool connection, runs after the transaction has committed.
PATCH /model/{id}/update follows the same order as create: the row is written
through the slot first and the team's model list is updated only afterwards, so
a refused write leaves the team as it was.
The slot transaction bypasses the repository's publish-on-write, so it
publishes the config change once after commit, as delete_team_models does.
2026-09-03 13:39:58 -07:00
mateo-berri
bba75c7ce9 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_mistral_voxtral_tts_speech
# Conflicts:
#	tests/test_litellm/test_cost_calculator.py
#	tests/test_litellm/test_main.py
2026-09-03 13:35:30 -07:00
mateo-berri
d0ac494144 fix(cost): honor off_peak_pricing in the fireworks_ai and perplexity cost calculators 2026-09-03 13:31:56 -07:00
mateo-berri
35d3478818 fix(responses/mcp): keep reasoning order and caller previous_response_id on stateless follow-ups 2026-09-03 13:27:48 -07:00
mubashir1osmani
b86a0b5562 test(router): cover get_configured_mode so router_code_coverage passes
425e3069b9 added Router.get_configured_mode but only exercised it
through create_model_info_response, which the router coverage gate does
not count. The code-quality workflow has been failing on staging and on
every open PR since.
2026-09-03 16:26:51 -04:00
mateo-berri
ab515dbc90 fix: treat gpt-6 names as the gpt-5 request family in OpenAI and Azure configs 2026-09-03 13:20:13 -07:00
Mateo Wang
828d561fcc
Merge pull request #39622 from BerriAI/litellm_gpt_6_astra
feat(models): add gpt-6-astra pricing and metadata
2026-09-03 13:18:34 -07:00
devin-ai-integration[bot]
1f20b38115
fix(vector_stores): only list vector stores the caller was granted (#39612)
* fix(vector_stores): only list vector stores the caller was granted

/vector_store/list returned every managed vector store with no team_id to any
key, and let a dashboard session see stores created from the dashboard because
every session shares the litellm-dashboard team id. Non-admin listings now show
a store only when the key or one of the caller's real teams is allowlisted for
it via object_permission.vector_stores, or the team owns it

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

* fix(vector_stores): keep a dashboard session key's own grants when the user has no teams

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-09-03 13:17:48 -07:00
mateo-berri
60b725cfd8 test(vertex): type the parametrized versionless route test parameters 2026-09-03 13:16:57 -07:00
Mateo Wang
e4b8caeb36
Merge pull request #38975 from BerriAI/litellm_fix_azure_ai_reclassify
fix(azure_ai): don't reclassify Foundry deployments as azure provider
2026-09-03 13:15:40 -07:00
Mateo Wang
cff2fd4f80
Merge pull request #39610 from BerriAI/litellm_bedrock_mantle_web_search_cost
fix(cost): bill bedrock_mantle web search at $12 per 1k queries using Bedrock's reported count
2026-09-03 13:14:20 -07:00
Mateo Wang
c137828a92
Merge pull request #39594 from BerriAI/litellm_lit6867_jwt_deployment_affinity
fix(router): pin JWT-authenticated callers by user id in deployment_affinity
2026-09-03 13:14:17 -07:00
Mateo Wang
0eed564ee3
Merge pull request #39587 from BerriAI/litellm_fix_responses_bridge_privatelink_api_base
fix(openai): bridge gpt-5.4+ tool calls to /v1/responses on every api.openai.com host
2026-09-03 13:13:27 -07:00
Mateo Wang
80250807db
Merge pull request #38808 from BerriAI/litellm_headroom_ccr_streaming_responses
fix(headroom): resolve CCR retrieval on streaming /v1/responses
2026-09-03 13:13:18 -07:00
Mateo Wang
8cf3bc87a2
Merge pull request #39597 from BerriAI/litellm_lit6642_vertex_count_tokens_anthropic_beta
fix(proxy): drop anthropic-beta on the Vertex passthrough count-tokens route
2026-09-03 13:13:11 -07:00
Mateo Wang
1e2d6abc18
Merge pull request #39614 from BerriAI/litellm_fix_stream_usage_default_openai_hosts
fix(openai): default stream usage on PrivateLink and regional api.openai.com hosts
2026-09-03 13:13:00 -07:00
Mateo Wang
f98d1aac2f
Merge pull request #39608 from BerriAI/litellm_ci_bedrock_cohere_eol
test(bedrock): drop EOL cohere.command-r-plus-v1:0 from local_testing
2026-09-03 13:12:58 -07:00
Mateo Wang
7d6b7dcca0
Merge pull request #39592 from BerriAI/litellm_lit6782_dashscope_off_peak_pricing
fix(cost): apply off_peak_pricing in the dashscope cost calculator
2026-09-03 13:12:55 -07:00
mateo-berri
f40f14ae39 fix(tests): fold the local price map into the provider model sets
CI unit shards load the price map from main at import, so a model that only
exists on the branch never reaches open_ai_chat_completion_models and
cost_per_token cannot infer its provider. Refresh the sets after swapping in
the local map so the tier pricing cases resolve gpt-6-astra before merge
2026-09-03 13:09:46 -07:00
mateo-berri
19c819a69e fix(vertex): add the API version to versionless project routes on the Vertex passthrough 2026-09-03 13:04:06 -07:00
ryan-crabbe-berri
1c14ded0e4
Merge pull request #39598 from BerriAI/litellm_lit_4929_session_token_aggregation
fix(ui): aggregate session token usage in the logs table
2026-09-03 12:57:27 -07:00
mateo-berri
0904a9223b test(responses): collect the admitted stream events without local mutation 2026-09-03 12:56:56 -07:00
moe-berri
f5f78fbb97
Merge pull request #39619 from BerriAI/litellm_fix_39451_model_mode
fix(proxy): expose configured mode for auto-router models
2026-09-03 12:56:44 -07:00
mateo-berri
de4c3e9006 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_mcp_stateless_follow_up_zdr 2026-09-03 12:55:28 -07:00
mateo
2c4eb693ed fix(model_prices): absorb Baseten GLM-5.3 and OpenRouter live prices, fix Bedrock Qwen3 Coder 480B input price and Gemini Live image price
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-03 19:53:58 +00:00
ryan-crabbe-berri
f173a6baf1
Merge pull request #39215 from BerriAI/litellm_lit_6592_team_overview_inherited_mcp_agents
fix(ui): show MCP servers and agents inherited from access groups on team overview
2026-09-03 12:53:27 -07:00
mateo-berri
5acb81888d fix(proxy): settle rate-limit reservations at a failed stream's partial usage 2026-09-03 12:52:58 -07:00
mateo-berri
4991d0bf3e fix(models): match gpt-6-astra reasoning effort levels to OpenAI docs
OpenAI documents low, medium, high, xhigh, and max for gpt-6-astra, with no none level, so the entry stops advertising none and starts advertising max.
2026-09-03 12:47:25 -07:00
mateo-berri
897fba08c8 feat(models): add gpt-6-astra pricing and metadata
Adds the OpenAI gpt-6-astra entry to both price files with standard, flex, priority (fast mode), batch, and above-272K long-context rates, and regression tests covering each tier and the batch rates.
2026-09-03 12:47:25 -07:00
moe-berri
425e3069b9 fix(proxy): expose configured model mode 2026-09-03 12:40:22 -07:00
mateo-berri
b38516da88 test(responses): make the background stream cancel deterministic
A five-token response can complete before the cancel lands, which put the
test back on the "Cannot cancel a completed response" path it used to
swallow. Ask for a long generation so the cancel always beats completion,
and assert the cancelled status unconditionally
2026-09-03 12:37:31 -07:00
mateo-berri
1e75668a25 fix(openai): default stream usage on PrivateLink and regional api.openai.com hosts 2026-09-03 12:37:17 -07:00
mateo-berri
339da4183d test(cost): type the web search cost helpers and cover OpenAI-shaped tool_usage 2026-09-03 12:34:54 -07:00
mateo-berri
36143b53f9 test(responses): bound the background stream cancel e2e so an upstream stall skips fast
test_cancel_streaming_response drained the whole background stream before
cancelling, so an OpenAI keepalive stall held the e2e_openai_endpoints job for
301s and failed it on a generic APIError, and on a healthy day it cancelled an
already completed response and swallowed the 400 without verifying a cancel.
Cancel at the first event carrying a response id, bound admission to 90s, skip
naming the stall when only keepalives arrived, and assert status == cancelled
2026-09-03 12:34:27 -07:00
Yuneng Jiang
16ac67d683
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_/dazzling-ellis-c9e9ff 2026-09-03 12:22:45 -07:00
mateo-berri
51d821ae45 fix(cost): bill bedrock_mantle web search at $12 per 1k queries using Bedrock's reported count 2026-09-03 12:21:54 -07:00
Yuneng Jiang
8ac704a855
test(responses): cancel the streaming response while it is still in flight
test_cancel_streaming_response drained the whole stream and only then called
cancel, by which point the response had finished and the cancel was expected to
fail. The test passed only because the surrounding except matched the literal
string "Cannot cancel a completed response", which is upstream OpenAI's wording,
not ours: it appears nowhere in this repo. Any change to that text, a different
status code, or the background job still running flipped the result. The test
also never exercised cancellation, and its only positive assertion was
hasattr(cancel_response, "id").

Break out of the stream at the first chunk carrying a response id and cancel
there, with a prompt long enough that the response cannot have completed in the
meantime. Both proxy cancel paths, the polling handler and the provider
passthrough, settle on status "cancelled", so assert that and the returned id
rather than a provider error string.
2026-09-03 12:16:16 -07:00
Yuneng Jiang
fb4b1e728a
test(team-race): wait on pg_locks instead of a fixed sleep
The three race tests claimed to pin the interleaving deterministically, but
lock_acquired.set() ran as the first statement of the task coroutine, before the
awaited endpoint call, so it only signalled that the task had started. The real
synchronisation was `await asyncio.sleep(0.2)` followed by
`assert not task.done()`, which is a timing assumption on a box running four
xdist workers against one Postgres.

Take the blocking connection's advisory lock key straight out of pg_locks, then
poll from the unblocked watcher connection until a non-granted lock on that same
key appears. That is the condition the sleep was standing in for, and it holds
however slow the machine is. If the endpoint returns without ever queueing, the
helper now fails with the endpoint's own exception chained on instead of a bare
assert.

The two tests reported failing in CI used sleep(0.2); the third used sleep(0.3)
and was not reported, which is consistent with the margin being the cause.
2026-09-03 12:16:08 -07:00
devin-ai-integration[bot]
92122086ec
fix: stop a cleared Organization field from failing key creation (#39316)
* fix: stop a cleared Organization field from failing key creation

Clearing the Organization combobox in the Create Key modal left organization_id set to an empty string, so /key/generate looked up an organization named "" and failed with "Organization doesn't exist in db. Organization=".

OrganizationDropdown now emits null on clear, and GenerateKeyRequest normalizes an empty organization_id or project_id to None the same way it already does for team_id.

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

* test: drop customer-specific docstring from key request normalization test

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>
Co-authored-by: yassin <yassin@berri.ai>
2026-09-03 19:12:11 +00:00