Commit graph

357 commits

Author SHA1 Message Date
Yucheng He
b4b6b8b68b fix(proxy): build proxy-only failure logs from an allowlist and ignore request-time GCS credentials
Backport of #26 to rc/1.105.0.
Cherry-picked from 9c2877c4be (main).
2026-10-27 10:32:10 -07:00
Ishaan
d5f676a876 fix(ci): unblock dependency checks (#48055)
* fix(deps): upgrade flagged Python dependencies

* fix(deps): lock patched Python dependency versions

* fix(otel): preserve JSON export with the updated SDK

* test(otel): cover JSON export with the updated SDK

* test(otel): update SDK log records and worker discovery

* fix(ui): align Lens peer dependency with patched Next.js

* fix(otel): hand the AgentOps exporter a session it owns for the JWT header

OpenTelemetry 1.45 moved the OTLP HTTP exporter's requests.Session behind a
transport, so writing the minted JWT to the exporter's private _session raised,
was swallowed, and every AgentOps batch went out unauthenticated. The exporter
now creates the session, passes it through the public session= argument and
sets the Authorization header on it

The tests now drive a real export, serving the token endpoint with respx and
capturing the OTLP POST with requests_mock, instead of reading SDK internals

* fix(otel): skip FastAPI instrumentation once the app has started

opentelemetry-instrumentation-fastapi 0.66b1 wraps build_middleware_stack instead
of calling add_middleware, so instrumenting an app whose middleware stack is
already built no longer raises. The call silently did nothing while we still
registered the global response propagator. Check the built stack up front and
skip both, which is what the existing test expects

* test(otel): assert exported requests and span flags instead of SDK internals

OpenTelemetry 1.45 dropped the exporter's private _headers and sets the W3C
random-trace-id flag on new traces, so traceresponse ends in -03. The Langtrace
and Langfuse tests now export through requests_mock and check the URL and headers
the collector receives, and the traceresponse tests expect the server span's own
trace flags

* fix(deps): bump dashboard zod to 4.6.6 and make the vendored Lens use it

zod 4.6.5 is flagged by the dependency scan and blocks osv-scan on every PR. A
root bump alone leaves the vendored Lens tarball, which pins zod 4.6.5 exactly,
on its own nested copy, so a top-level zod override points every consumer at the
root version and the lock carries a single zod 4.6.6

* test(ui): stub the tag summary fetch the client panel retry refreshes

Retrying the model breakdown refetches /tag/summary, which this integration test
left on the real network. When that request failed before the assertion, the
panel switched to its summary error and unmounted the model row, so the test
passed or failed by timing

* fix(deps): drop the duplicated Lens override from the dashboard package.json

* style(ui): format the client panel fetch stub

---------

Dependency files (pyproject.toml, uv.lock, ui/litellm-dashboard/package.json and package-lock.json) were left out of this pick and are re-derived on the line in the following commits
ClientUsagePanel.integration.test.tsx does not exist on this line, so its stub hunk was dropped
The traceresponse assertions in test_otel_v2_mount.py target tests this line does not have, so those two hunks were dropped and the file is unchanged

Co-authored-by: Yuneng Jiang <yuneng@berri.ai>
(cherry picked from commit 8f9894fbd6)
2026-10-23 14:19:04 -07:00
Mrinal Chanshetty
64262f0f12
test: exempt the providers mirrored from main in the cost-map provider registry test
(cherry picked from commit 9c28744ad5, tests/unit/test_model_prices_schema.py only)
2026-10-21 01:07:01 -07:00
Yuneng Jiang
cee7ad185a
Merge branch 'stable/1.105.x' into litellm_backport_p0_batch_translation_cost_stable_1_105_x 2026-10-21 01:02:47 -07:00
Yuneng Jiang
b77c7b8f97
Merge branch 'stable/1.105.x' into litellm_backport_lit145_batch_stable_1_105_x 2026-10-21 01:01:46 -07:00
Yuneng Jiang
de1fbf1730
Merge branch 'stable/1.105.x' into litellm_backport_45317_46430_stable_1_105_x 2026-10-21 01:01:02 -07:00
Yassin Kortam
0a051ae8cc
fix(mcp): list per-user auth MCP tools without a shared token (#47677)
(cherry picked from commit 49b5444ef9)
2026-10-20 23:54:18 -07:00
mrinal-berri
6d2711631e 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:52:02 +00:00
devin-ai-integration[bot]
2fd80a958a 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:51:45 +00:00
Mrinal Chanshetty
e19652cb0d test: retarget cost-map tests to the cost map synced from main
Takes main's schema for test_aaamodel_prices_and_context_window_json_is_valid and points the per-query rerank test at an uncataloged model, as main does, since main's map now prices semantic-ranker-default-004.
2026-10-20 18:41:20 -07:00
devin-ai-integration[bot]
b15bb3eb93 fix(logging): spilled over PTU requests without base_model log the served model's rates (#47655)
* fix(logging): report pay-as-you-go rates for spilled over PTU requests without base_model

* fix(logging): keep the provider response model so spilled over PTU payloads price the served model

* fix(logging): keep a provider_response_model the response already carries

* fix(logging): read the carried provider_response_model through a typed adapter

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47655 to stable/1.105.x.
Cherry-picked from 6b1f4ed46f (main).
2026-10-21 00:57:50 +00:00
devin-ai-integration[bot]
063f75d0f8 fix(proxy): price earlier timed-out retry attempts at their own deployment's model rate (#47648)
* fix(proxy): bill every earlier timed-out retry attempt at its own deployment's model rate

* fix(router): read the retry record's base_model through the typed metadata helper

* fix(router): keep the four-record retry breadcrumb cap

* fix(router): carry a deployment's litellm_params base_model on its retry record

* chore(router): place the cast-ok reason on the cast line and list the base_model helper as covered through log_retry

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47648 to stable/1.105.x.
Cherry-picked from 27efc387f7 (main).
2026-10-21 00:57:50 +00:00
devin-ai-integration[bot]
011c464a8e fix(router): price cost-based routing through model_info.base_model (#47617)
* fix(router): price cost-based routing through model_info.base_model

* fix(router): keep cost-based routing pricing helpers fully typed

* fix(router): drop typing.cast from cost-based routing pricing helpers

* fix(router): read the cost map through a typed accessor in cost-based routing

* fix(router): avoid a Final rebind inside the cost-based routing loop

* refactor(router): share deployment_pricing_models across spend, listing and cost-based routing

* refactor(router): keep the /v1/models listing key inline, share pricing models for spend and routing

* refactor(router): inline the deployment pricing-model wrapper in cost-based routing

* refactor(router): read deployment pricing models through one shared helper

deployment_pricing_models(deployment) now owns the model_info.base_model / litellm_params.base_model /
litellm_params.model unpacking, used by cost-based routing and the /v1/models listing. pricing_models(base_model, model)
stays for the failure-row spend estimate, which already holds the two names

* refactor(router): share the str-keyed mapping validator with cost-based routing

* ci: re-run after flaky test_aiohttp_transport read timeout in llms-providers

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47617 to stable/1.105.x.
Cherry-picked from 0c6731eb5c (main).
2026-10-21 00:57:50 +00:00
devin-ai-integration[bot]
35204c3644 fix(proxy): price a 499 spend row only for the proxy's own disconnect, and never after the call already completed (#47652)
* fix(proxy): price a 499 spend row only for the proxy's own disconnect, and never after the call already completed

* fix(proxy): gate the zero-cost 499 row on the success log being enqueued, not merely claimed

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47652 to stable/1.105.x.
Cherry-picked from ffb7133d32 (main).
2026-10-21 00:57:50 +00:00
devin-ai-integration[bot]
c83536ce33 fix(proxy): scope the search free-tier counter to the request's provider (#47646)
* fix(proxy): scope the search free-tier counter to the request's provider

* fix(proxy): read the provider with get so partial spend payloads still get the free tier

* test(proxy): give the grounded spend payload fixture its provider

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47646 to stable/1.105.x.
Cherry-picked from 640f2d865b (main).
2026-10-21 00:57:50 +00:00
devin-ai-integration[bot]
5912122393 fix(proxy): price a billed failure row at the deployment's long-context tier like the success path (#47647)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47647 to stable/1.105.x.
Cherry-picked from 70ece3501f (main).
2026-10-21 00:57:50 +00:00
devin-ai-integration[bot]
e4c41e98cd fix(proxy): strip caller base_model from spend pricing and reject lone surrogates in multipart metadata (#47639)
* fix(proxy): strip caller base_model from spend pricing and reject lone surrogates in multipart metadata

* fix(proxy): type the parsed multipart metadata so basedpyright does not grow reportArgumentType

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47639 to stable/1.105.x.
Cherry-picked from 2a268951c4 (main).
2026-10-21 00:57:50 +00:00
devin-ai-integration[bot]
9fa48987fa fix(proxy): bill partial Responses API streams when the client disconnects (#47611)
* fix(proxy): bill partial Responses API streams when the client disconnects

Streamed /v1/responses requests and the default-route OpenAI and Azure /v1/messages requests behind them logged a 499 with zero spend when the client went away mid-stream, while /v1/chat/completions already billed the chunks it had sent. The Responses API iterator now keeps the response.created payload and can hand the disconnect cleanup a response.incomplete event with counted usage and the served service_tier, and the messages-route byte stream and router wrappers delegate to it.

* fix(proxy): satisfy lint gates for partial Responses API disconnect billing

Make the disconnect helper public so the proxy, router and messages adapter can import it without reportPrivateUsage, type the SSE byte stream as an AsyncGenerator so aclose is known, read litellm_call_id off the logging object, and keep the new tests on Final locals with the recorder injected through dynamic_async_success_callbacks instead of litellm.callbacks.

* fix(router): bill the primary stream's tokens after a mid-stream hop and chat-bridge Responses streams on disconnect

The router's fallback wrapper now folds the primary Responses stream's relayed tokens into the fallback's disconnect event the way _combine_responses_fallback_usage does for a natural end of stream, and LiteLLMCompletionStreamingIterator (chat-only providers served through /v1/responses) builds its disconnect event from the chat completion chunks it collected. stamp_responses_usage_cost is now public so the bridge module can price that event.

* Potential fix for pull request finding 'CodeQL / Log Injection'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

Backport of #47611 to stable/1.105.x.
Cherry-picked from f0ae445cc4 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
4ef6f611e0 fix(proxy): flush the spend-log queue only for Responses turns the bridge reads back (#47614)
Every /v1/responses spend log asked its worker to flush the queue right away so a
chained previous_response_id could find the row. Only the chat-completions bridge
reads that row. Native Responses providers hold the conversation upstream, so their
rows now wait for the batch write like chat rows do

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47614 to stable/1.105.x.
Cherry-picked from 423362bab2 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
7ffaaab9a0 feat(proxy): opt-in free-tier allowance for Google Search grounding spend (#47494)
* feat(proxy): opt-in free-tier allowance for Google Search grounding spend

* fix(proxy): declare the search free tier counter's service target

* test(cost_map): allow search_free_requests in the cost map schema

* fix(proxy): skip cache hits and never free more than the billed cost in the search free tier

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47494 to stable/1.105.x.
Cherry-picked from e63aec029a (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
fd5eec97b1 feat(proxy): write one spend row per billed timed-out retry attempt (#47416)
_failure_spend_rows yields the final row plus one re-keyed row per lifted billed_failed_attempts entry (<request_id>-attempt-<position>, the attempt's usage, cost, retry count and deployment id), each written through DBSpendUpdateWriter.update_database so it also deducts from key, team and user spend

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47416 to stable/1.105.x.
Cherry-picked from ad8ca533ca (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
1ef27b4baf fix(proxy): requeue spend logs when a Postgres restart tears down the prisma engine mid-write (#47571)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47571 to stable/1.105.x.
Cherry-picked from ccd0d4ea49 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
a9bb556111 feat(proxy): lift every earlier billed timed-out retry attempt onto the failed request (#47490)
* feat(proxy): lift every earlier billed timed-out retry attempt onto the failed request

_billed_earlier_attempts reads the router's previous_models records, keeps the Timeout ones other than the final attempt (matched on deployment_id plus attempted_retries, since the count restarts after a fallback hop and the fallback handler re-logs the exhausting attempt) and prices each at the deployment that served it. post_call_failure_hook lifts the tuple as billed_failed_attempts; nothing writes it yet. previous_models joins the router-reserved metadata fields so a client-planted record never reaches it

* fix(proxy): price earlier timed-out attempts from the prompt estimate only

The final row may lift a mid-stream recovered usage (prompt plus delivered chunks) or a failed_attempts_usage sum; earlier attempts never produced output, so they are priced from _estimated_prompt_usage, and when failed_attempts_usage already bills them into the final row none is lifted again

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47490 to stable/1.105.x.
Cherry-picked from 7a4a255d1d (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
627b667688 fix(decisions): log non-UTF-8 bytes as base64 so the request reaches validation and gets a 400 (#47564)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47564 to stable/1.105.x.
Cherry-picked from ce63f48ed2 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
7312d216cc fix(litellm_proxy): forward tool_config cache_control_injection_points to the downstream proxy (#47570)
PR #47394 withheld cache_control_injection_points from the OpenAI SDK extra_body for
every provider on that path, which also covers litellm_proxy. The downstream LiteLLM
proxy applies the point itself, so litellm_proxy keeps forwarding it while OpenAI and the
other OpenAI-compatible providers still never receive it

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47570 to stable/1.105.x.
Cherry-picked from 04e9ed4c52 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
0be634a62f fix(logging): report the pay-as-you-go entry billing used on Azure PTU spillover (#47567)
get_standard_logging_object_payload decided custom_pricing from
litellm_params alone, so on an Azure PTU spillover response
model_map_information kept the deployment's zeroed PTU entry while
response_cost already used the standard model rate. Reuse the billing
side LitellmLogging._custom_pricing_for so both read the same decision

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47567 to stable/1.105.x.
Cherry-picked from 4222523261 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
b7cad5b216 fix(proxy): price a billed failure row at the deployment's own rate like the success path (#47437)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47437 to stable/1.105.x.
Cherry-picked from fb555b00dc (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
7e85fb8f4c fix(proxy): price the estimated input tokens on a client-cancelled (499) request's spend row (#47436)
* fix(proxy): price the estimated input tokens on a client-cancelled (499) request's spend row

* fix(proxy): read the provider handoff before the proxy-only error handler stamps it so a pre-handoff 499 is not priced

* fix(proxy): drop the pre-logging handoff read now that pre_call no longer stamps proxy-only failures

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47436 to stable/1.105.x.
Cherry-picked from 0e7c4908bb (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
68140a5f55 fix(batches): apply the Vertex regional endpoint uplift to batch cost (#47466)
* fix(batches): apply the Vertex regional endpoint uplift to batch cost

batch_cost_calculator takes vertex_location and multiplies by the model's
regional_endpoint_uplift_multiplier through get_vertex_regional_endpoint_uplift,
and every batch cost path (aretrieve_batch pricing, completed-batch logging,
native Vertex batch rows, the proxy batch cost poll and its per-line items)
resolves the deployment's location and passes it down

Co-authored-by: Mrun25 <165297479+Mrun25@users.noreply.github.com>

* test(logging): point the resolver tests at resolve_vertex_location_for_cost

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Mrun25 <165297479+Mrun25@users.noreply.github.com>

Backport of #47466 to stable/1.105.x.
Cherry-picked from c6c303a618 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
75a8b1344c fix(vertex_ai): bill per-character text embeddings on Google's billableCharacterCount (#47460)
Vertex text embedding predict responses report metadata.billableCharacterCount, the
unit Google bills text-embedding-005 and text-multilingual-embedding-002 on. Carry it
into usage.prompt_tokens_details.character_count and, when the model carries
input_cost_per_character, bill that count instead of the token count so the prompt is
charged under one unit. Per-token embeddings (gemini-embedding-001) are unchanged.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47460 to stable/1.105.x.
Cherry-picked from d29200fa05 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
6526d62eac fix(logging): do not stamp a provider handoff when pre_call runs for a proxy-only failure (#47456)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47456 to stable/1.105.x.
Cherry-picked from 3fa1587f43 (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
be578726ed fix(proxy): price the estimated input tokens on a read-timed-out request's spend row (#47435)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47435 to stable/1.105.x.
Cherry-picked from 7b76b2b15f (main).
2026-10-21 00:57:49 +00:00
devin-ai-integration[bot]
da2116999b fix(anthropic): apply tool_config cache-control points on chat and /v1/messages (#47394)
* fix(anthropic): apply tool_config cache-control points on chat and /v1/messages

A cache_control_injection_points entry with location tool_config was spread into
the Anthropic request body on /v1/chat/completions, which Anthropic rejected with
400 Extra inputs are not permitted, and the native /v1/messages path dropped the
point silently. Both paths now put the point's control on the last tool Anthropic
caches and never forward the key.

Co-authored-by: Tan Nguyen <tan@pressingly.net>

* refactor(anthropic): validate tool_config inputs instead of casting them

Keeps the lint gates flat: the helper takes untyped tools and points and
narrows them with the existing object validators, the chat transform builds
the body with the marked tools instead of writing into optional_params, and
the handler reads a typed view of kwargs.

* fix(openai): keep tool_config cache points out of extra_body, add integration test

The cache hook hands a tool_config point on for the provider step, and for
providers that call through the OpenAI SDK every non-OpenAI param rides in
extra_body, so OpenAI answered 400 Unrecognized request argument supplied.
The new integration file drives a live proxy against scripted Anthropic,
Bedrock Converse and OpenAI upstreams for /v1/chat/completions and
/v1/messages.

* test(integration): cover tool_config cache points on bridged /v1/messages

Three new cases on /v1/messages for models without a native Anthropic
messages path: OpenAI through the Responses bridge and Gemini through the
chat bridge never see cache_control_injection_points in the body, and
Bedrock Nova through the chat bridge gets the cachePoint on toolConfig

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Tan Nguyen <tan@pressingly.net>

Backport of #47394 to stable/1.105.x.
Cherry-picked from 93b79d2587 (main).
2026-10-21 00:57:48 +00:00
devin-ai-integration[bot]
146df23e1e fix(cost): bill Gemini audio/image/video prompt tokens at the resolved input rate when no modality rate exists (#47373)
* fix(cost): bill Gemini audio/image/video prompt tokens at the resolved input rate when no modality rate exists

Co-authored-by: shivam <shivam@berri.ai>

* style(cost): ruff format the modality cost calls

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: shivam <shivam@berri.ai>

Backport of #47373 to stable/1.105.x.
Cherry-picked from 09e9193514 (main).
2026-10-21 00:57:48 +00:00
devin-ai-integration[bot]
2e1879d8cd feat(router): let a deployment set a timeout per service_tier (#47406)
* feat(router): let a deployment set a timeout per service_tier

Adds timeout_by_service_tier and stream_timeout_by_service_tier to a deployment's
litellm_params. A request whose service_tier matches a key uses that value in place
of the deployment's timeout or stream_timeout. A timeout the client sends still wins
and requests without a matching tier are unchanged

Co-authored-by: adc77 <amandogra2016@gmail.com>

* style(router): sort the request_timeout_resolver import

* fix(router): read the service tier maps without the untyped params get

* fix(router): look the service tier timeout up through a typed get

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: adc77 <amandogra2016@gmail.com>

Backport of #47406 to stable/1.105.x.
Cherry-picked from 62ce515d15 (main).
2026-10-21 00:57:48 +00:00
devin-ai-integration[bot]
7f233c62c4 fix(decisions): log every request field the caller sent on /v1/systemone and /v1/decisions (#47183)
* fix(decisions): log every request field the caller sent on /v1/systemone and /v1/decisions

* fix(decisions): serialize the logged request with model_dump_json so no mutable dict is built

* refactor(decisions): drop the state-only messages pick in function_setup, prepare_call logs the request

* fix(decisions): return the single logged message so no mutable list type is annotated

* fix(decisions): log the caller's raw request fields before validation so a rejected request is still recorded

* fix(decisions): serialize the raw request fields with pydantic_core so question objects and mapping proxies log as JSON

* fix(decisions): log the caller request at the SDK entry so requests rejected before prepare_call are recorded too

* test(decisions): assert the exact BadRequestError for the rejected-questions case

---------

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Backport of #47183 to stable/1.105.x.
Cherry-picked from 53821f6654 (main).
2026-10-21 00:57:48 +00:00
joshua-berri
06325db25f fix(bedrock): resolve profile pricing before applying custom rates (#47419)
Backport of #47419 to stable/1.105.x.
Cherry-picked from 3124797399 (main).
Adapted to the line, on top of the ported helpers in the previous commit:
- runtime_model_cost_registrations reads a per-cost-map store of the fields each register_model call set (_RegisteredPricingFields), which stands in for main's AliasedCostEntry.registered_fields (#41523) so alias entries stay plain dicts. A catalog reload resets it, as main's reload drops registered_fields.
- An inference-profile ARN in model_id is resolved to its profile name inside _bedrock_pricing_info with the line's extract_model_name_from_bedrock_arn, instead of main's get_potential_model_names ARN handling.
- completion_cost keeps the line's candidate list and passes the profile info through; optional_params is read directly (main's _LOGGED_LITELLM_PARAMS is not on the line).
- The router adapters _MODEL_INFO_ADAPTER and _LITELLM_PARAMS_ADAPTER are defined here.
- Tests use the line's private names. Dropped: the AliasedCostEntry routing test, the router cache-only pricing test (main-only fixtures), and the ignore_stamped_cost assertion (main-only parameter).
2026-10-20 17:24:19 -07:00
joshua-berri
bff83d9fc0 fix(batches): retry confirmed pre-accounting failures (#47625)
Backport of #47625 to stable/1.105.x.
Cherry-picked from 6564a490f4 (main).
Adapted to the line: the router budget limiter keeps the line's clock and window TTL (budget_window_seconds from #45797 is not on the line) and its websocket skip, the charge-once helpers move to batch_utils from where the line already defines them, the write-started check drops apply_search_free_tier (#47494, not on the line) and its test, and tests use the line's _ProxyDBLogger name with only this PR's tests appended.
2026-10-20 17:24:19 -07:00
joshua-berri
27edbef05d fix(batch): preserve recoverable costs and prevent poll starvation (#47190)
Backport of #47190 to stable/1.105.x.
Cherry-picked from 0ede0e10e7 (main).
Adapted to the line: the created_at/updated_at protocol fields go on the line's _ManagedObjectRow (managed_object_attribution.py is not on the line), the TestBatchLineItemsFromThePoller tests for #41691 are dropped, and the integration test change is dropped since its helpers (prisma_clients, write_rows) are not on the line.
2026-10-20 16:18:01 -07:00
Kerry Lu
301850f3a3 fix(logging): report the cost-map entry billing used in model_map_information (#47182)
Backport of #47182 to stable/1.105.x.
Cherry-picked from 1212260ab1 (main).
Adapted to the line: calls the line's _select_model_name_for_cost_calc (public on main) and the test uses the line's _response_cost_calculator and a local payload import; the test is appended since its main-side neighbours are not on the line.
2026-10-20 16:18:00 -07:00
Paul El Khoury
f4bbbb28e4 fix(openai): drop unsupported reasoning effort for gpt-6.1-sol (#43935)
Backport of #43935 to stable/1.105.x.
Cherry-picked from d7620c77a1 (main).
Adapted to the line: the Responses bridge change lands in litellm/main.py (the bridge check moved to litellm/responses/bridge_check.py later on main), the line's _get_effort_level and _supports_reasoning_effort_level names are kept, and the test files keep the line's helpers with only this PR's hunks applied.
2026-10-20 16:18:00 -07:00
joshua-berri
d74b58224a fix(batches): preserve spend across malformed output and metadata failures (#47184)
Backport of #47184 to stable/1.105.x.
Cherry-picked from 3fb95c8fe3 (main).
Adapted to the line: keeps the line's _ManagedObjectRow name and adds its status property, ports postgres_storable_json into managed_files for the claim write (the rest of managed_files keeps the line's code), and drops the S3 batch line-item call that #41691 added on main. Tests converted from MagicMock responses to LiteLLMBatch where the claim now copies the response.
2026-10-20 16:18:00 -07:00
joshua-berri
74af50c64a fix(batches): handle empty models when logging batch cost (#47155)
Backport of #47155 to stable/1.105.x.
Cherry-picked from 4143e0869e (main).
2026-10-20 16:18:00 -07:00
devin-ai-integration[bot]
458404c317 fix(anthropic): add the dangerous-tool-use beta when a /v1/messages request carries safeguards (#43955)
Backport of #43955 to stable/1.105.x.
Cherry-picked from eb5295b20c (main).
Handler import conflict resolved by keeping the line's imports plus aload_beta_headers_config; the CLI-beta wire assertion change is dropped since that test is not on the line.
2026-10-20 16:18:00 -07:00
mrinal-berri
385e89d2a5 fix(databricks): send a single plain text block as a string for non-Claude models (#45686)
Backport of #45686 to stable/1.105.x.
Cherry-picked from 1aee1a21ed (main).
Test-file import conflict resolved by keeping the line's imports plus this PR's own.
2026-10-20 16:18:00 -07:00
mrinal-berri
323eb8819a fix(databricks): keep #/$defs refs in json_schema response_format (#45659)
Backport of #45659 to stable/1.105.x.
Cherry-picked from fa7ad80a62 (main).
Test-file conflict resolved by keeping the line's file plus this PR's own additions.
2026-10-20 16:18:00 -07:00
devin-ai-integration[bot]
c85d155864 fix(model_prices): consolidate claude-haiku-5-5 over-100k pricing and capability flags (#45151)
Backport of #45151 to stable/1.105.x.
Cherry-picked from 46d440ae96 (main).
Conflicts resolved by keeping the line's fields and adding only the over-100k fields this PR introduces; cost-map entries replaced per model.
2026-10-20 16:18:00 -07:00
Krrish Dholakia
6ca1efd127 feat(model_prices): add claude-haiku-5-5 model pricing (#45108)
Backport of #45108 to stable/1.105.x.
Cherry-picked from 5cd1126870 (main).
Prerequisite for #45151: adds the claude-haiku-5-5 entries that fix corrects. Cost-map conflicts resolved by appending the new entries.
2026-10-20 15:50:03 -07:00
devin-ai-integration[bot]
f65fb99aa3 fix(responses): report truncated bridged output as incomplete and echo request params (#44460)
Backport of #44460 to stable/1.105.x.
Cherry-picked from f81a3f5243 (main).
2026-10-20 15:49:49 -07:00
Yuneng Jiang
9a4884cd12 fix(anthropic): carry thinking.block_binding only on the exact Anthropic, Azure AI and Bedrock Invoke configs
The #46342 backport carried block_binding through every subclass of the
Anthropic and Bedrock Invoke configs, so Bedrock Mantle, Claude Platform and
OpenAI-compatible Anthropic endpoints started sending it. Each of the six chat
and messages configs now opts in by exact class, and the Bedrock Invoke
display updates and clear_thinking rebuilds carry block_binding only when the
config opts in. Every other config sends the same thinking as 1.105.1
2026-10-20 03:11:23 -07:00