Commit graph

51791 commits

Author SHA1 Message Date
Yuneng Jiang
d7b606ac91
Merge stable/1.103.x (#47743, #47763) into litellm_backport_p0_batch_translation_cost_stable_1_103_x
# Conflicts:
#	litellm/model_prices_and_context_window_backup.json
#	litellm/proxy/hooks/proxy_track_cost_callback.py
#	litellm/responses/litellm_completion_transformation/streaming_iterator.py
#	model_prices_and_context_window.json
#	tests/test_litellm/proxy/hooks/test_proxy_track_cost_callback.py
#	tests/test_litellm/test_utils.py
#	uv.lock
2026-10-21 00:55:49 -07:00
yuneng-jiang
a3c62f9f48
Merge pull request #47763 from BerriAI/litellm_backport_lit145_stable_1_103_x
fix(proxy): backport the LIT-145 spend tracking fixes to stable/1.103.x and bump to 1.103.7
2026-10-21 00:54:25 -07:00
yuneng-jiang
3902cba8a0
Merge pull request #47743 from BerriAI/litellm_backport_45317_46430_stable_1_103_x
fix(count_tokens): backport Bedrock Mantle count_tokens fallback to stable/1.103.x
2026-10-21 00:54:08 -07:00
devin-ai-integration[bot]
a29a29a7c0 bump: version 1.103.7 2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
de59732383 chore(deps): bump aiohttp to 3.14.4 in uv.lock for GHSA-2g87-pp6c-29x5, GHSA-5wr8-gcqf-gqf3 and GHSA-494j-54xm-rwp3 2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
8948ab4d0c fix(logging): spilled over PTU requests without base_model log the served model's rates (#47655)
Backport of #47655 to stable/1.103.x

Cherry-picked from 6b1f4ed46f (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
bd68d04aae fix(proxy): price a 499 spend row only for the proxy's own disconnect, and never after the call already completed (#47652)
Backport of #47652 to stable/1.103.x

Cherry-picked from ffb7133d32 (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
db8f45dc87 fix(proxy): price earlier timed-out retry attempts at their own deployment's model rate (#47648)
Backport of #47648 to stable/1.103.x

Cherry-picked from 27efc387f7 (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
7e630b07d4 fix(proxy): price a billed failure row at the deployment's long-context tier like the success path (#47647)
Backport of #47647 to stable/1.103.x

Cherry-picked from 70ece3501f (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
8147f8d68f fix(proxy): scope the search free-tier counter to the request's provider (#47646)
Backport of #47646 to stable/1.103.x

Cherry-picked from 640f2d865b (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
6dd7b489de fix(proxy): strip caller base_model from spend pricing and reject lone surrogates in multipart metadata (#47639)
Backport of #47639 to stable/1.103.x

Cherry-picked from 2a268951c4 (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
aa838f931b fix(router): price cost-based routing through model_info.base_model (#47617)
Backport of #47617 to stable/1.103.x

Cherry-picked from 0c6731eb5c (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
be085c9028 fix(proxy): flush the spend-log queue only for Responses turns the bridge reads back (#47614)
Backport of #47614 to stable/1.103.x

Cherry-picked from 423362bab2 (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
bb2ec9a422 fix(proxy): bill partial Responses API streams when the client disconnects (#47611)
Backport of #47611 to stable/1.103.x

Cherry-picked from f0ae445cc4 (main)
2026-10-21 03:37:25 +00:00
devin-ai-integration[bot]
d7e344440c fix(proxy): requeue spend logs when a Postgres restart tears down the prisma engine mid-write (#47571)
Backport of #47571 to stable/1.103.x

Cherry-picked from ccd0d4ea49 (main)
2026-10-21 01:55:14 +00:00
devin-ai-integration[bot]
6120ddf786 fix(litellm_proxy): forward tool_config cache_control_injection_points to the downstream proxy (#47570)
Backport of #47570 to stable/1.103.x

Cherry-picked from 04e9ed4c52 (main)
2026-10-21 01:55:14 +00:00
devin-ai-integration[bot]
20c0e82370 fix(logging): report the pay-as-you-go entry billing used on Azure PTU spillover (#47567)
Backport of #47567 to stable/1.103.x

Cherry-picked from 4222523261 (main)
2026-10-21 01:55:14 +00:00
devin-ai-integration[bot]
c6ee8e0d54 feat(proxy): write one spend row per billed timed-out retry attempt (#47416)
Backport of #47416 to stable/1.103.x

Cherry-picked from ad8ca533ca (main)
2026-10-21 01:55:14 +00:00
devin-ai-integration[bot]
c23f17dcff feat(proxy): opt-in free-tier allowance for Google Search grounding spend (#47494)
Backport of #47494 to stable/1.103.x

Cherry-picked from e63aec029a (main)
2026-10-21 01:55:14 +00:00
mateo
696e1c3c87 fix(bedrock): add Claude Mantle model helper
Minimal prerequisite from #43646 for stable/1.104.x.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 6a801372ac)
2026-10-21 01:54:50 +00:00
mrinal-berri
de896efc8e fix(count_tokens): fall back to Mantle on Bedrock 404 (Bedrock part of #46430)
(cherry picked from commit 08a24d391a)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-10-21 01:51:08 +00:00
devin-ai-integration[bot]
71118e893e fix(bedrock): count tokens on bedrock-mantle when bedrock-runtime cannot count a Claude model (#45317)
(cherry picked from commit 577d74c1ce)
2026-10-21 01:50:30 +00:00
Mrinal Chanshetty
d898de4253 bump: version 1.103.7 2026-10-20 18:20:54 -07:00
Mrinal Chanshetty
81b67d70c1 chore(deps): bump aiohttp to 3.14.5 and claude-agent-sdk to 0.2.165
Matches main's resolved aiohttp and its claude-agent-sdk pin (==0.2.165, dev group). Lock moved only those two packages.
2026-10-20 18:20:30 -07:00
Mrinal Chanshetty
f419a596a7 test: retarget cost-map tests to the rows mirrored from main
Test-only. Takes main's version of test_shipped_tool_search_rule_fills_mapped_claude_entries_without_flag, test_cache_control_injection_tool_config_honors_ttl_for_regional_model_lacking_own_pricing and test_get_model_info_gemini; retargets three tests whose rows main changed or removed (gemini-2.0-flash-001 -> gemini-2.5-flash, gpt-5.1-codex-max -> gpt-5.2 for xhigh, gpt-5.1-chat-latest -> gpt-5.1); registers this line's unsupported providers in PROVIDER_LABELS_WITHOUT_A_MODEL_SET; adds extraction mode, main's enum lists and every key main's map uses to test_utils' inline schema, plus main's seedance cost exceptions.
2026-10-20 18:20:07 -07:00
Mrinal Chanshetty
dc314e7f6a chore(cost-map): accept the mirrored map's new keys in the schema
Adds search_free_requests, token_count_model (with litellm_provider enum bedrock/bedrock_mantle), token_count_framing and token_count_tokenizer to ci_cd/generate_model_prices_schema.py using main's definitions, and regenerates model_prices_and_context_window.schema.json. Schema keys are CI-only; the line already fetches main's map at runtime.
2026-10-20 18:02:25 -07:00
Mrinal Chanshetty
105a342e77 chore(cost-map): mirror main's model cost map at 6083cf9776
Both model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json are byte-identical to main at 6083cf9776.
2026-10-20 17:52:13 -07:00
devin-ai-integration[bot]
81b9ab7e51 feat(proxy): lift every earlier billed timed-out retry attempt onto the failed request (#47490)
Backport of #47490 to stable/1.103.x

Cherry-picked from 7a4a255d1d (main)
2026-10-21 00:45:27 +00:00
devin-ai-integration[bot]
e7e1aa8984 fix(vertex_ai): bill per-character text embeddings on Google's billableCharacterCount (#47460)
Backport of #47460 to stable/1.103.x

Cherry-picked from d29200fa05 (main)
2026-10-21 00:45:27 +00:00
devin-ai-integration[bot]
183e1c8a49 fix(logging): do not stamp a provider handoff when pre_call runs for a proxy-only failure (#47456)
Backport of #47456 to stable/1.103.x

Cherry-picked from 3fa1587f43 (main)
2026-10-21 00:45:27 +00:00
devin-ai-integration[bot]
c793111f40 fix(proxy): price a billed failure row at the deployment's own rate like the success path (#47437)
Backport of #47437 to stable/1.103.x

Cherry-picked from fb555b00dc (main)
2026-10-21 00:45:27 +00:00
devin-ai-integration[bot]
6a65634599 fix(proxy): price the estimated input tokens on a client-cancelled (499) request's spend row (#47436)
Backport of #47436 to stable/1.103.x

Cherry-picked from 0e7c4908bb (main)
2026-10-21 00:45:27 +00:00
devin-ai-integration[bot]
543f1899d4 fix(proxy): price the estimated input tokens on a read-timed-out request's spend row (#47435)
Backport of #47435 to stable/1.103.x

Cherry-picked from 7b76b2b15f (main)
2026-10-21 00:45:27 +00:00
devin-ai-integration[bot]
37b7c14830 feat(router): let a deployment set a timeout per service_tier (#47406)
Backport of #47406 to stable/1.103.x

Cherry-picked from 62ce515d15 (main)
2026-10-21 00:45:27 +00:00
devin-ai-integration[bot]
8147fae4d6 fix(anthropic): apply tool_config cache-control points on chat and /v1/messages (#47394)
Backport of #47394 to stable/1.103.x

Cherry-picked from 93b79d2587 (main)
2026-10-21 00:45:27 +00:00
joshua-berri
56b0f9c3c2 fix(batches): retry confirmed pre-accounting failures (#47625)
Backport of the router charge-once part of #47625 to stable/1.103.x, from main 6564a490f4 via the stable/1.104.x port 91cb4a55b5.
The batch accounting retry already landed in the earlier #47625 commit; this adds the charge-once helpers moved into router_utils.batch_utils and RouterBudgetLimiting's per-batch marker using the line's duration_in_seconds window. The shared-worker test waits for this line's background Redis push before reading spend.
2026-10-20 17:36:04 -07:00
daqiangganjun
823e533f12 fix(router): count provider budget spend on every API surface (#38172)
Backport of #38172 to stable/1.103.x, from main 8327cd6d47 via the stable/1.104.x port 844e02f602.
Prerequisite for #47625: RouterBudgetLimiting reads the provider from the logging payload, so the batch poller's aretrieve_batch events reach router budgets at all. Test file placed at tests/test_litellm/router_strategy/ on this line.
2026-10-20 17:36:04 -07:00
mateo-berri
150b843cc2 fix(proxy): charge a finished batch once against per-model budgets
Prerequisite for the #47625 backport to stable/1.103.x, from main 8a33b37c39.
Adds the per-counter batch charge-once marker that #47625 moves into router_utils.batch_utils.
2026-10-20 17:36:04 -07:00
mateo-berri
a8b8b3bd60 chore(router): add is_batch_retrieve_call_type for the batch charge-once backport
Prerequisite for the #47625 backport to stable/1.103.x. Ports only the BATCH_RETRIEVE_CALL_TYPES / is_batch_retrieve_call_type helper from main 9acf09f60d, which #47625's charge-once helpers call. The rest of that commit (keeping batch retrieves out of router tpm/rpm counters) is not taken: its test passes on this line's tip, since batch retrieves are not stamped with a model group here.
2026-10-20 17:36:04 -07:00
joshua-berri
a83924f8c8 fix(bedrock): resolve profile pricing before applying custom rates (#47419)
Backport of #47419 to stable/1.103.x.
Cherry-picked from 3124797399 (main), via the stable/1.104.x port c88cf13cd3.
Adapted to the line: the cost-calc threshold changes are applied to this line's loop without the 1.104 base's batch-tier helpers; ModelNotMappedError from #42497 is hand-ported (exception class plus the get_model_info raise and re-raise) so registration lookups can tell an unmapped model from a transient failure; tests whose catalog rows (gpt-6-sol, gpt-6-luna from #42515) are not on this line are retargeted to amazon.nova-micro-v1:0 and gpt-5.6-sol profiles; the test conftest also snapshots _runtime_registered_fields. Billing checked unchanged on this line for a cross-provider alias (keeps cache prices) and for unpriced openai/ft: and bedrock/ap-northeast-1 deployments.
2026-10-20 17:35:56 -07:00
Mrinal Chanshetty
19264830f2 fix(pricing): port pricing helpers needed by #47419
Prerequisite for the #47419 backport to stable/1.103.x, taken from the stable/1.104.x hand-port 49cacdb4b2.
Minimal port of helpers from #41523/#43890/#46647 needed by #47419; behavior changes of those PRs not included. Registrations are tracked in a _runtime_registered_fields side table and cost-map entries stay plain dicts.
2026-10-20 17:35:56 -07:00
Mrinal Chanshetty
03fdb8c555 chore: bump litellm-enterprise 0.1.69.post1 -> 0.1.69.post2 2026-10-20 17:35:56 -07:00
Mrinal Chanshetty
4a49f841a8 chore(deps): bump aiohttp to 3.14.4 2026-10-20 17:35:56 -07:00
joshua-berri
32bfdeaf31 fix(batches): retry confirmed pre-accounting failures (#47625)
Backport of #47625 to stable/1.103.x.
Cherry-picked from 6564a490f4 (main).
Adapted to the line: the batch accounting retry (track_batch_accounting in proxy_track_cost_callback and its use in check_batch_cost) is ported, while this PR's router-budget charge-once changes in router_utils/batch_utils, budget_limiter and model_max_budget_limiter are left out, since they refactor charge-once code from main (8a33b37c39, 9acf09f60d) that is not on this line. The write-started mark keys on a budget reservation only, as the search free tier is not on this line. Tests use the line's _ProxyDBLogger, and the router-budget and search-allowance assertions are dropped.
2026-10-20 17:35:56 -07:00
devin-ai-integration[bot]
1f47a4b5e7 fix(cost): bill Gemini audio/image/video prompt tokens at the resolved input rate when no modality rate exists (#47373)
Backport of #47373 to stable/1.103.x

Cherry-picked from 09e9193514 (main)
2026-10-20 23:56:56 +00:00
joshua-berri
2f3d44b469 fix(batch): preserve recoverable costs and prevent poll starvation (#47190)
Backport of #47190 to stable/1.103.x.
Cherry-picked from 0ede0e10e7 (main).
Ported from the stable/1.104.x hand-port (3b7b5ab319). Carries the small typed table helpers that port relies on (_ManagedObjectRow protocol and the _managed_object_table/_user_table/_token_table/_team_table accessors, from the stable/1.104.x base). The poll-starvation integration test is dropped since its base and harness (#42622, integration/_support/prisma_clients) are not on this line. The 404-recovery unit test resets the litellm callback lists so a callback left by an earlier test cannot shadow it.
2026-10-20 16:43:54 -07:00
joshua-berri
8bbd2c0601 fix(batches): preserve spend across malformed output and metadata failures (#47184)
Backport of #47184 to stable/1.103.x.
Cherry-picked from 3fb95c8fe3 (main).
Ported from the stable/1.104.x hand-port (f7b0b09e75) onto this line's poller, which keeps LiteLLM_ManagedObjectTable and direct prisma table access. Brings the managed-files postgres_storable_json sanitizer from #45703 that this fix needs. Test files keep the line's content plus this PR's own cases.
2026-10-20 16:43:54 -07:00
Paul El Khoury
ab69d8489c fix(openai): drop unsupported reasoning effort for gpt-6.1-sol (#43935)
Backport of #43935 to stable/1.103.x.
Cherry-picked from d7620c77a1 (main).
Ported from the stable/1.104.x adaptation (54f9259b40): the bridge check lives in litellm/main.py and the effort helpers keep the line's private names. Cost-map edits replay only this PR's reasoning-effort flags (gpt-6-astra and gpt-5.3-codex rows), plus supports_none_reasoning_effort=false on the azure gpt-6.1-sol rows from #46377, which the fix's tests key on. Tests built on gpt-6-sol rows (#42515), the Foundry tools-to-Responses bridge, or a full azure/eu/gpt-6-astra row are dropped since none of those are on this line.
2026-10-20 16:43:54 -07:00
devin-ai-integration[bot]
de7a2cda10 chore(cost-map): add azure and openrouter gpt-6.1-sol rows (#43744)
Backport of #43744 to stable/1.103.x.
Cherry-picked from bda2763f2c (main).
Prerequisite for #43935: adds the azure and openrouter gpt-6.1-sol rows that fix corrects. Cost-map conflict resolved by appending the new entries.
2026-10-20 16:43:54 -07:00
berriai-litellm-provider-info-sync[bot]
e2072b7aa8 chore(cost-map): add openai gpt-6.1-sol from the pricing page (#43738)
Backport of #43738 to stable/1.103.x.
Cherry-picked from a3552c451b (main).
Prerequisite for #43935: adds the gpt-6.1-sol entry that fix corrects. Cost-map conflict resolved by appending the new entry.
The cost-map schema and its schema test also allow the *_above_272k_tokens_batches keys this row carries, which main already allows.
2026-10-20 16:43:54 -07:00