Commit graph

20777 commits

Author SHA1 Message Date
devin-ai-integration[bot]
689494ad5f test(passthrough): type the team deployment helper and mark test locals Final 2026-11-05 16:09:04 +00:00
devin-ai-integration[bot]
78f53a1a5e fix(passthrough): skip team deployments when picking proxy-wide pass-through credentials on lts/1.108.x 2026-11-05 16:02:13 +00:00
kerry
d07d295ad5 bump: version 1.108.1
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 01:39:40 +00:00
Kerry Lu
9f0484b987 fix(openai): send chat completions through client.post so the SDK's per-message param transform stops holding the event loop (#46967)
* fix(openai): send chat completions through client.post so the SDK's per-message param transform stops holding the event loop

create() walks every message, content part and tool of the request through
openai._utils._transform before posting, 91 ms at 300k tokens and ~300 ms at
1M tokens on the event loop, and returns the same dict for the plain dicts
litellm builds. client.post is what create() calls after that walk, same
request, headers, retries, raw response and stream objects, so the chat
helpers now call it directly through the helper embeddings already used

* fix(openai): type the chat client.post result as LegacyAPIResponse so the type gate sees .headers and .parse

* fix(openai): assert the chat client.post result is a LegacyAPIResponse instead of casting it

* test(openai): stub client.post with a LegacyAPIResponse spec in the empty-response and no-leak tests

* test(core-utils): stub client.post with a LegacyAPIResponse spec in the agentic loop leak test

* test: every client.post stub on the OpenAI chat path returns a LegacyAPIResponse-spec'd mock

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit e8550c1454)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 01:39:40 +00:00
paveln83
d089d524a3 fix(caching): key cached async clients by a per-loop token instead of id(loop) (#48877)
* fix(caching): key cached async clients by a per-loop token instead of id(loop)

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

* fix(caching): drop deferred closes queued on a collected event loop

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

* test(caching): pin that a close queued on a live loop waits for that loop

* test(caching): run loop-reuse tests until a loop address repeats

The collected-loop tests ran a fixed 50 loops and passed with the fix reverted whenever no loop reused an earlier address. They now stop at the first reuse and skip if none happens, through a shared helper.

* test(caching): cover the cache key fallback for loops without weak references

Also corrects the evicted client closer docstring: a dropped bucket's clients are left to the garbage collector.

* fix(http): free short-lived event loops whose handler finalizer close finished as the loop stopped

* fix(caching): share sync clients across event loops and catch a failed finalizer close

* fix(agentops): stop closing the shared sync http client after the auth call

---------

Co-authored-by: mateo <mateo@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
(cherry picked from commit 4ce724e3df)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 01:39:40 +00:00
Kerry Lu
79a3567b66 feat(videos): serve custom_provider_map BaseVideoConfig providers on /v1/videos (#49785)
Backport of #49785 to lts/1.108.x.
Cherry-picked from fcef9cd0a3 (main).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 01:39:40 +00:00
Kerry Lu
f559536757 fix(logging): bill each SDK call its own native Bedrock guardrail trace when calls share one metadata dict (LIT-10239) (#48923)
Backport of #48923 to lts/1.108.x.
Cherry-picked from e21de0e418 (main).
2026-11-05 01:39:40 +00:00
Kerry Lu
a2e7cdcf7c feat(bedrock): price native guardrailConfig trace usage into spend and x-litellm-response-cost (#48278)
Backport of #48278 to lts/1.108.x.
Cherry-picked from 0b66a27528 (main).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 01:39:40 +00:00
devin-ai-integration[bot]
8fa525c90d fix(vertex-ai): sync tier prices and retirement floors (#49964)
Backport of #49964 to lts/1.108.x.
Cherry-picked from 62f85afacf (main). The cost-map schema keys and the schema test were re-applied by hand onto the line's test_utils.py, and the priority-markup test the line does not have was left out.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:26:44 +00:00
Kerry Lu
4f6bc3c507 fix(proxy): cancel the Admin UI's raw spend-log reads in Postgres after 30s (#49965)
Backport of #49965 to lts/1.108.x.
Cherry-picked from 2d0c720425 (main). The line keeps its inline session page query, so that read and the grouped count go through _query_spend_logs directly and _SpendLogsReader is not ported.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:26:44 +00:00
Kerry Lu
30c7420c4e fix(cost): bill gemini audio input and cached audio at flex, priority and batch rates (#48086)
Backport of #48086 to lts/1.108.x.
Cherry-picked from dc0237ccd7 (main).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:26:44 +00:00
Kerry Lu
de425fb956 fix(watsonx): read pass-through credentials from use_in_pass_through deployments (#49462)
Backport of #49462 to lts/1.108.x.
Cherry-picked from 948445c828 (main). get_proxy_wide_deployment_credentials hand-ported onto the line's _resolve_matching_deployment_api_key, since the line has no _get_deployment_credentials.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:26:44 +00:00
Kerry Lu
7dffccccae fix(batches): cost an unmanaged gs:// batch through the deployment that created it (#49301)
Backport of #49301 to lts/1.108.x.
Cherry-picked from 298911d61b (main).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:26:44 +00:00
Kerry Lu
277ee2e943 fix(proxy): abort the request with a 499 when the client disconnects during the body upload (#48640)
Backport of #48640 to lts/1.108.x.
Cherry-picked from 59b8c73930 (main). Dropped the pick's edit to the ValidationError branch the line does not have.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:26:44 +00:00
Kerry Lu
bc4c89bfc3 fix(proxy): cancel /team/spend/by_user in Postgres after 30s (#49922)
Backport of #49922 to lts/1.108.x.
Cherry-picked from 391c8013c9 (main).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:26:43 +00:00
Kerry Lu
6becdf304e fix(proxy): buffer tool discoveries in Redis and write LiteLLM_ToolTable in one statement per drain, on its own lock (#48089)
Backport of #48089 to lts/1.108.x.
Cherry-picked from e6a32bbeeb (main).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:15:40 +00:00
Kerry Lu
4bb0c86b2d test(router): set string fallback targets after Router init in the sdk cooldown cases (#48954)
Backport of #48954 to lts/1.108.x.
Cherry-picked from e4932a4539 (main).
2026-11-05 00:15:40 +00:00
Kerry Lu
8304f16942 fix(router): reject string fallback targets at Router init (LIT-10238) (#48943)
Backport of #48943 to lts/1.108.x.
Cherry-picked from 96fe78f96e (main).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:15:40 +00:00
Kerry Lu
825a555b5b fix(router): cool down failing deployments when fallbacks use string targets (LIT-10238) (#48913)
Backport of #48913 to lts/1.108.x.
Cherry-picked from 84c4c5aa5c (main).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:15:40 +00:00
Kerry Lu
3a5abcfe1c fix(router): keep a lone deployment warm under router allowed_fails unless the policy names the exception (#48644)
Backport of #48644 to lts/1.108.x.
Cherry-picked from 8f31c7171d (main). Dropped the pick's edit to a stream-stall test the line does not have.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-05 00:15:40 +00:00
Rick
3df724803f fix(logging): drop a first-token time left over from a previous attempt (#47541)
Backport of #47541 to lts/1.108.x.
Cherry-picked from ced995df6e (main).
2026-11-05 00:15:40 +00:00
Kerry Lu
90bdf7fd01 fix(aiohttp_transport): keep the owned session open while a response stream is still being read (LIT-10237) (#48920)
Backport of #48920 to lts/1.108.x.
Cherry-picked from 4a70d80aef (main).
2026-11-05 00:15:40 +00:00
Kerry Lu
987819afd1 fix(anthropic): count search results and reject unsupported token-count blocks (#48699)
Backport of #48699 to lts/1.108.x.
Cherry-picked from 7acdf9f00d (main).
2026-11-05 00:15:40 +00:00
Ambuj Upadhyay
e7cb9a6483 fix(streaming): dict-usage arm drops prompt_tokens_details/completion_tokens_details its sibling arms preserve (#36678)
Backport of #36678 to lts/1.108.x.
Cherry-picked from cb70bc560e (main).
2026-11-05 00:15:40 +00:00
Kerry Lu
5b73742e4e fix(aiohttp_transport): close an owned aiohttp session when its transport is collected (#48650)
Backport of #48650 to lts/1.108.x.
Cherry-picked from d6edd37810 (main).
2026-11-05 00:15:40 +00:00
Kerry Lu
4695ad1deb fix(bedrock): price claude_platform calls from their own cost map rows (#48150)
Backport of #48150 to lts/1.108.x.
Cherry-picked from 560372456e (main).
2026-11-05 00:15:39 +00:00
Yuneng Jiang
bbc8484790
test(utils): stop the register_model replay test leaking gpt-4o pricing on 1.108
Brings over the test_utils.py isolation fix from #47135. The replay test registered openai/gpt-4o with supports_function_calling false into the shared cost map, so a later function calling test on the same worker failed depending on xdist ordering
2026-11-04 12:23:06 -08:00
Yuneng Jiang
0b5b41ca1b
test(bedrock): let GovCloud lag on native structured output on 1.108
Brings over the test-only GovCloud exemption from #46870. The 1.108 cost map already mirrors main, where us-gov Sonnet 5 profiles mark supports_bedrock_native_structured_output false while the commercial base marks it true
2026-11-04 12:04:41 -08:00
Yuneng Jiang
003192d5df
test(proxy): drop stale team cache update test on 1.108
main removed test_team_cache_update_called in #35643. The 1.108 line already carries the auth cache freshness backport, so update_cache no longer reads the team cache and the test fails
2026-11-04 12:01:20 -08:00
Yuneng Jiang
573c0f6659
test(e2e): backport owned A2A integration coverage to rc 108 2026-11-03 14:38:59 -08:00
Yuneng Jiang
c86300491f
test(integration): use rc 108 database read helper 2026-11-03 14:27:15 -08:00
Yuneng Jiang
b5049a43ce
test(integration): backport Presidio Sail and Weave migrations to rc 108 2026-11-03 14:23:50 -08:00
Yuneng Jiang
e02e279d6a
test(e2e): backport qualification repairs to rc 1.108.0 2026-11-03 13:35:26 -08:00
Yuneng Jiang
d1b3f10c6f
test(integration): compare long-input bursts with matched benign traffic 2026-11-02 17:29:26 -08:00
Yuneng Jiang
de19b8d7ce
test(integration): await completed callbacks and observe locks directly
(cherry picked from commit 85e698a1ec)
2026-11-02 16:46:39 -08:00
Yuneng Jiang
ddb384ff61
test(integration): require deployment IDs on cache-hit failures
(cherry picked from commit f6498c364c)
2026-11-02 14:16:00 -08:00
Yuneng Jiang
35e68021ab
test(observability): backport calibrated restart budget
Backport the K4 restart-budget changes from #48665 while retaining all functional assertions.

(cherry picked from commit 21ab2cb87b)
2026-11-02 13:58:18 -08:00
yuneng-jiang
835a3fa12e
test(integration): repair agent reads and bulk deletion setup (#49719)
(cherry picked from commit 0ea7e96a66)
2026-11-02 13:58:11 -08:00
Yuneng Jiang
5352ed94fb
fix(proxy): backport auth cache freshness and spend updates
(cherry picked from commit b55024658c)
2026-11-02 13:58:11 -08:00
yuneng-jiang
76e42d73bd
fix(prometheus): retain deployment attribution on proxy failures (#49717)
(cherry picked from commit 1563776cd8)
2026-11-02 13:09:39 -08:00
yuneng-jiang
61fe5be5b8
Merge pull request #49553 from BerriAI/litellm_chore_8c713d
fix(proxy): backport the /v1/messages retry spend log fix and team delete test fix to rc/1.108.0
2026-11-02 09:23:35 -08:00
Yuneng Jiang
ba18de8a06
test(integration): fix four flaky integration tests (#49554)
Scope the Prisma migration lock test's advisory lock check to its own database, so a lock another xdist worker holds in its database no longer trips it

Keep in-process MCP peers' idle connections open for 30s instead of 1s, so the gateway's pooled HTTP client doesn't reuse a connection the peer is closing and hang the tool call

Delete database guardrails in the logging-only scope tests through DELETE /guardrails/{id} on the shared gateway instead of raw SQL, so a default-on guardrail stops applying to the next test on the same worker right away

Bound the wedged coordination Redis /customer/update check by the shortest Redis wait the proxy uses, like the burst check, so a slow runner can't fail it while a handler that waits on Redis still does

(cherry picked from commit 4f2c75ddf5)
2026-10-31 21:15:30 -07:00
Yuneng Jiang
9a929f871d
test(integration): backport the wedged Redis burst bound from #47108 to rc/1.108.0
Takes only #47108's (e85cb4052e) changes to coordination_redis_proxy_config.yaml and test_user_updates_wedged_coordination_redis.py. They set the coordination Redis socket timeout and define the shortest Redis wait bound that #49554's /customer/update fix uses
2026-10-31 21:15:23 -07:00
yucheng-berri
3592d9038f
test(integration): hold the upstream until the disconnect is settled before reading its spend row (#47303)
test_client_disconnect_before_any_content_sends_no_response_scan released the gated upstream right after
the client closed, so the upstream's next chunk raced the disconnect into the proxy. When the chunk won,
the proxy had " tail" on record for the client and the cut-short scan recorded a post_call success on
the spend row, which the test asserts is absent (CircleCI integration-extensions job 2263560 on
68db022d57: `AssertionError: (('success',),)`).

The test now reads the spend row first, which is written once the proxy has settled the disconnect, and
releases the upstream after it. The proxy's behavior is unchanged; only the test's ordering is.

Co-authored-by: yucheng-berri <293926326+yucheng-berri@users.noreply.github.com>
(cherry picked from commit 89a194bbd0)
2026-10-31 21:15:18 -07:00
Yuneng Jiang
13218620ed
test(integration): backport the team delete warmup fix from #47135 to rc/1.108.0
Takes only the max_workers change in test_team_delete_large_membership.py from 7e8be61fa0. The 16-thread key warmup slowed the /team/delete that follows it to 5.4-11.6s locally against the client's 15s timeout, and 2 threads brings it to 4.1-5.4s
2026-10-31 18:02:12 -07:00
devin-ai-integration[bot]
f86f570aca
fix(proxy): keep a retried /v1/messages stream's spend log by logging the superseded attempt as a failure (#45136)
* fix(proxy): keep a retried /v1/messages stream's spend log by logging the superseded attempt as a failure

A /v1/messages stream the router retries before any content shares one logging object across both attempts. The superseded attempt's end-of-stream logging ran as a success (a usage-only or placeholder result) and claimed the request's one-shot success log, so the recovered stream's spend row was either missing or written under the superseded attempt's message id. The passthrough logging path now logs an Anthropic stream whose frames carry an `event: error` as a failure with whatever usage the provider reported, the way a dropped stream already does, and the router closes the superseded stream before it opens the retry so that logging is queued first.

* fix(proxy): log a provider error frame through an attempt-scoped logging copy

The error-frame failure stashed the superseded attempt's usage on the logging
object the retry shares, so the retry's success log carried the failed
attempt's token counts. The failure now logs through a copy of the logging
object with its own model_call_details, and the helper moves into the
Anthropic passthrough logging handler so the proxy streaming handler only
routes by endpoint type.

* fix(proxy): scope the error-frame failure log to streams closed at the frame

A stream that ran to its end at the provider's error frame kept logging
through the success route before this PR, and the attempt-scoped failure
log is now taken only for a stream the router closed at that frame, with
the copy made at the close so the retry's deployment never reaches it

* chore: drop duplicate litellm import and mark the stream_ended rebind

* fix(proxy): log only router-superseded attempts as error-frame failures

A client that hangs up at a forwarded error frame closed the stream the same way the router closes a superseded attempt, so a non-retried stream lost its spend. The router now closes a superseded attempt through aclose_superseded_attempt, and only that close routes the attempt to the failure log

* test: type the _settle helper's recorded events

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
(cherry picked from commit 8bb8ac7f18)
2026-10-31 18:02:04 -07:00
Yuneng Jiang
8415e2d44b
Merge remote-tracking branch 'origin/rc/1.108.0' into litellm_chore_575e7d 2026-10-31 16:43:45 -07:00
yucheng-berri
57b539bf99
Merge pull request #49482 from BerriAI/litellm_backport_49262_49264_rc_1_108_0
fix(guardrails): backport #49262 and #49264 to rc/1.108.0, name only the pipeline steps that ran in x-litellm-applied-guardrails
2026-10-31 15:57:50 -07:00
Yuneng Jiang
187d933de2
test(integration): backport the stale-test fixes from #48665 that rc/1.108.0 needs
rc/1.108.0 carries OpenTelemetry 1.45.1 (#48055), #47611 and the #47639 base_model strip, so the OTel traceresponse header, langtrace outage, guardrail concurrent-disconnect and Bedrock lookaround tests expected the old behavior. This takes #48665's hunks for those four files only, without the unhandled to non_object_body rename, which depends on #48438 that rc does not have

(cherry picked from commit 21ab2cb87b, four test files only)
2026-10-31 15:47:07 -07:00
Yuneng Jiang
38482f7cda
test(integration): backport the cursor responses wire test fix from #47600 to rc/1.108.0
rc/1.108.0 carries the #43935 backport, which enforces gpt-5's supports_none_reasoning_effort and supports_xhigh_reasoning_effort flags, so the test now reads the levels it parametrizes from the cost map like main does. Only this file of #47600 is taken. Its other files follow changes rc does not have

(cherry picked from commit e78f7b4602, tests/integration/providers/test_cursor_responses_wire.py only)
2026-10-31 15:47:06 -07:00