Commit graph

45043 commits

Author SHA1 Message Date
mateo
3f0306188a fix(slack_alerting): poll while the deprecation alert is disabled instead of sleeping a day
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-12 16:11:50 +00:00
Mateo Wang
8c2edbfc66
Merge pull request #36590 from BerriAI/litellm_lit012_readonly_typeddict
feat(lint): gate writable TypedDict fields with LIT012
2026-08-12 08:39:34 -07:00
mateo-berri
2278118493 fix(slack_alerting): poll for the router inside the loop instead of a capped pre-wait
A capped pre-wait still burns the first daily pass when the router takes
longer than the cap to appear (a >10 minute boot), and reads the router
in two places. Folding the poll into the loop makes the first alert
unconditional on boot duration and keeps a single read per pass.
2026-08-12 08:34:10 -07:00
mateo
6276eabf19 fix(proxy): wait for the router before the first deprecation alert
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-12 15:19:26 +00:00
Praveen11558
0ca0fa22b8
fix: refactor HTTP handler initialization with client support (#30952)
* bug: Refactor HTTP handler initialization with client support

* Update transformation.py

* bug: fixing the passing of clientID for the psc calls

* Update llm_http_handler.py

* Update llm_http_handler.py

* Update transformation.py

* Remove duplicate 'plugins' field definition

Removed duplicate definition of 'plugins' field.

* Update proxy_server.py

* Update transformation.py

* Update transformation.py

* Update test_vertex_gemma_transformation.py

* Refactor HTTP client handling for Vertex Gemma

* Refactor tests to use mock_get_client for HTTP calls

* Update transformation.py

* Update transformation.py

* Refactor patches for async HTTP client in tests

* fix: refactor HTTP handler initialization with client support

---------

Co-authored-by: michelligabriele <gabriele.michelli@icloud.com>
2026-08-12 15:17:51 +02:00
Devin AI
d79b56481d fix(model_prices): sync Groq registry with provider docs
Add missing Groq models and provider-announced deprecation dates

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-12 13:15:14 +00:00
Mateo Wang
f64479e74d
Merge pull request #34177 from atomic/fix/nvidia-nim-ranking-image-passages-top-n
fix(nvidia_nim): preserve image passages and stop sending top_k to /v1/ranking
2026-08-12 01:42:00 -07:00
Marty Sullivan
b048ce4cc1 refactor(logging): drop the type-gate commentary
The comment restated what the gate does and carried incident detail that would drift,
including a claim about downstream callbacks that the evidence does not support. The
rationale belongs in the regression test, which fails if the copy is ever reintroduced
ahead of the gate, rather than in prose that can rot silently

Also corrects that test's docstring for the same overclaim: the raise aborts the handler
body at the redaction call, and what that costs a given deployment was not established
2026-08-12 04:15:33 -04:00
mateo-berri
6dea3a5715 fix(router): spend only the router-selecting tags, keep the caller's other tags constraining the routed tier 2026-08-12 01:10:55 -07:00
Mateo Wang
f8caaf4d2d
Merge pull request #32536 from dcadenas/litellm_fix_codex_responses_namespace_tools
fix(responses): preserve Codex namespace tool calls
2026-08-12 01:10:30 -07:00
Marty Sullivan
132bee892a fix(logging): stop deepcopying results redaction cannot redact
perform_redaction deepcopies the result before inspecting it, but every shape it does not
recognize falls through to the placeholder return at the end of that block, so the copy is
built and then discarded. Binary and HTTP response bodies land in exactly that case: batch
output, file content and audio responses hold an unpicklable `_thread.lock`, so
copy.deepcopy raises TypeError

The raise lands inside the try in Logging.success_handler that also wraps the callback
loop, so the handler body aborts at the redaction call and everything after it is skipped.
It surfaces only as "[Non-Blocking] Exception occurred while success logging cannot pickle
'_thread.lock' object", which is why it can run unnoticed. The async handler body reaches
perform_redaction the same way. Only deployments with message redaction enabled are
affected, since perform_redaction runs only when turn_off_message_logging resolves true

Deciding redactability before copying fixes the crash as a consequence rather than catching
it, and keeps the deepcopy off large batch bodies it was never going to help. Behaviour for
every recognized shape is unchanged: the copy still shields the caller's object from
in-place redaction

Observed on a live gateway with turn_off_message_logging enabled, where every managed-batch
output download logged that error; after this change the error no longer appears
2026-08-12 03:59:22 -04:00
mateo-berri
29c13c47d0 test(router): reference _model_group_with_consumed_request_tags directly for the router coverage gate 2026-08-12 00:37:33 -07:00
mateo-berri
3e41941e35 test(router): reference _forwardable_alias_marker_params directly for the router coverage gate 2026-08-12 00:36:01 -07:00
Mateo Wang
cfcd0cda8a fix(responses): leave namespace unset on non-namespace tool calls 2026-08-12 00:28:15 -07:00
mateo-berri
0f6e5abd49 test(router): reference _model_name_has_plain_deployments directly for the router coverage gate 2026-08-12 00:28:13 -07:00
Mateo Wang
9cc5a818c3
Merge pull request #36154 from BerriAI/devin_ai_sse_keepalive_openai_routes
feat(proxy): global SSE keepalive ping interval for OpenAI-shaped streaming routes
2026-08-12 00:19:13 -07:00
Mateo Wang
a64a83bf36 fix(responses): keep custom_tool_call echoes on their advertised short name 2026-08-12 00:19:08 -07:00
mateo-berri
b7136243c7 test(router): cover the non-mapping litellm_params marker guard and drop redundant docstrings 2026-08-12 00:17:52 -07:00
Mateo Wang
9bfe593241
Merge pull request #35880 from BerriAI/devin_ai_fix_cost_estimate_onprem_provider_35210
fix(proxy): forward resolved provider and deployment pricing in /cost/estimate
2026-08-12 00:08:40 -07:00
Mateo Wang
23b805d5a4
Merge pull request #36447 from BerriAI/litellm_anthropic_fast_mode_speed_usage
fix(anthropic): preserve speed=fast in usage for /v1/messages and pass-through
2026-08-12 00:05:59 -07:00
Mateo Wang
ca14e52b08 fix(responses): requalify echoed namespace tool calls with their flattened name 2026-08-12 00:01:34 -07:00
mateo-berri
bff10db90f fix(router): consume router-selecting tags on litellm_metadata-shaped requests too
/v1/messages and other litellm_metadata endpoints store proxy metadata,
including x-litellm-tags header tags, under litellm_metadata instead of
metadata. The pre-routing hook read request tags with a hardcoded
metadata bucket, so it never saw the tags that selected the marker and
cleared the consumed-tags stamp, and tag filtering then 401'd the routed
tier. Resolve the bucket from the request kwargs instead, matching how
the stamp write and the tag-filter read already resolve it.
2026-08-11 23:46:38 -07:00
mateo-berri
bcba392b21 fix(router): exclude strategy marker deployments from selection when plain siblings exist 2026-08-11 23:44:13 -07:00
yuneng-jiang
5e620af405
Merge pull request #36600 from BerriAI/litellm_/bedrock-retired-sonnet-test-model
test(bedrock): repoint live Claude tests off the retired Claude 3 Sonnet
2026-08-11 23:42:03 -07:00
mateo-berri
1d7c23a424 Merge branch 'litellm_internal_staging' into fix/nvidia-nim-ranking-image-passages-top-n 2026-08-11 23:41:54 -07:00
yuneng-jiang
e5e6728c8e
Merge pull request #36597 from BerriAI/litellm_/litellm-test-failures-debug-b4200d
fix(model_prices): advertise native structured output on every Bedrock DeepSeek V3.2 and GLM 5 id
2026-08-11 23:41:46 -07:00
Mateo Wang
397fcd0e6b fix(responses): serialize flattened namespace tools and keep tool results adjacent to tool_calls 2026-08-11 23:41:44 -07:00
mateo-berri
e53f044d20 fix(proxy): resolve the global SSE keepalive interval through the per-deployment engine
The outer wrap_sse_stream_with_keepalive_pings layer duplicated the
keepalive engine that PR #34423 already runs inside async_data_generator
for chat completions and responses streams, and it kept pinging
deployments whose operator set keepalive_seconds: 0 as a hard disable.
sse_keepalive_ping_interval_seconds is now the global fallback inside
_resolve_keepalive_seconds, so deployment and request values keep
precedence, an explicit 0 still disables, the [1, 300]s clamp applies,
and router-less proxies arm the wrap when the global default is set.
2026-08-11 23:37:43 -07:00
mateo-berri
d5a1896cf4 test: drop rerank package marker colliding with voyage test package 2026-08-11 23:37:27 -07:00
mateo-berri
0fdbe03c50 fix(proxy): honor model_info custom pricing in /cost/estimate 2026-08-11 23:25:01 -07:00
mateo-berri
efa5f6b7ad fix(router): stop re-applying router-selecting request tags to the routed tier's deployments 2026-08-11 23:24:33 -07:00
mateo-berri
d9ad21699c fix(anthropic): preserve fast-mode speed on parsed messages responses
The Rust messages bridge logs a parsed Anthropic response without an
httpx_response, so the fallback transform dropped the request speed and
billed fast-mode calls at the standard rate. Thread optional_params
speed into transform_parsed_response and add a regression test for the
parsed-response branch.
2026-08-11 23:21:23 -07:00
Mateo Wang
ae2a1f4aba Merge branch 'litellm_internal_staging' into litellm_fix_codex_responses_namespace_tools 2026-08-11 23:16:34 -07:00
mateo-berri
aa24263651 fix(router): let untagged requests bypass a tagged pre-routing strategy on shared model names 2026-08-11 23:09:05 -07:00
mateo-berri
22088138ca test(nvidia_nim): move ranking transform regressions to the covered unit tree 2026-08-11 23:08:46 -07:00
mateo-berri
96c82f1c0c fix(router): forward auto-router alias params from the marker entry, not the first same-name deployment 2026-08-11 23:07:39 -07:00
mateo-berri
464a4cf207 Merge remote-tracking branch 'origin/litellm_internal_staging' into pr35880_local 2026-08-11 23:01:05 -07:00
Mateo Wang
7e80e094c4
Merge pull request #36529 from william-xue/fix-responses-passthrough-stream-cost
fix(proxy): track streamed passthrough Responses cost
2026-08-11 21:58:42 -07:00
Shivam Rawat
89217c4012
Merge pull request #36496 from BerriAI/litellm_dashscope_latest_models
feat(dashscope): add latest Model Studio models to the cost map
2026-08-11 21:40:50 -07:00
mateo-berri
08a73740ec fix(passthrough): keep prompt/completion token split for streamed OpenAI rows 2026-08-11 21:28:55 -07:00
mateo-berri
5e14649c54 fix(passthrough): bill streamed Responses calls that end failed
A stream can terminate with a response.failed event that still reports
consumed tokens; those were rebuilt as None and logged at zero spend.
Parse response.failed alongside completed and incomplete, matching the
buffered path, which prices any terminal response that reports usage.
2026-08-11 21:01:18 -07:00
yucheng-berri
8bfb7772e4
fix(batches): attribute Anthropic passthrough batch cost to the creating key, team and tags (#36468)
The Anthropic batch create never persisted the creating key's hashed token or its
request tags on the managed object, so when CheckBatchCost billed the batch hours
later there was nothing to attribute it to. Key spend, key budgets and tag spend
never moved for batch usage.

Persist both from the create, the way the Vertex passthrough already does, and
register the batch only from the collection route. An id-scoped route cannot
rebuild the unified object id, because it embeds the model and the model comes
from the create's request body, so it could only claim a row it did not create or
fail the model_object_id unique constraint.

The shared metadata helpers, the route predicate and the registration-result
logging now live in batch_attribution instead of being copied per provider. The
Anthropic write previously logged success unconditionally, before the
fire-and-forget task had run.

Resolves LIT-5288
2026-08-11 20:52:43 -07:00
devin-ai-integration[bot]
7a55ca811b
fix(responses): init completed_response on bridge streaming iterator (#35413)
LiteLLMCompletionStreamingIterator overrides __init__ without calling
super().__init__(), so completed_response was only set once the stream
reached RESPONSE_COMPLETED. On a mid-stream provider error the router's
_extract_partial_responses_usage read source_iterator.completed_response
during fallback recovery and raised AttributeError, masking the real
provider error (e.g. Anthropic 529) and bypassing configured retries and
fallbacks. Initialize the attribute to None so recovery degrades to no
partial usage instead of crashing.

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-12 03:45:34 +00:00
mateo-berri
2df121c821 fix(passthrough): bill streamed Responses calls that end incomplete
Streams that terminate with response.incomplete (e.g. max_output_tokens
reached) carry real usage in the terminal event but were rebuilt as None
and logged at zero spend, letting callers bypass budget enforcement.
Parse response.incomplete alongside response.completed when
reconstructing the streamed response.
2026-08-11 20:21:17 -07:00
mateo-berri
dc30e1816d refactor(passthrough): move Responses stream terminal-event parsing into OpenAI provider config
Addresses review feedback: the ResponseCompletedEvent SSE parsing now lives
in OpenAIResponsesAPIConfig next to the other Responses stream event handling,
and the proxy logging handler calls it. Adds coverage for streams that end
without a response.completed event.
2026-08-11 20:11:53 -07:00
Daniel Meismer
84c1df918d fix(mcp): decouple OAuth discovery from startup
Register remote MCP servers without awaiting OAuth metadata, warm discovery in the background, and share bounded request-time retries with per-server cooldowns.

Preserve the existing discovered-tool boundary for explicit server calls.

Co-Authored-By: Codex
2026-08-11 22:59:02 -04:00
Mateo Wang
b4f5e46a44
Merge pull request #30817 from geraint0923/litellm_fix_xai_web_search_cost_billing
Some checks are pending
Unit Tests: LLM Provider Transformations / All Other Providers (push) Waiting to run
Unit Tests: MCP, Secrets, Containers & Misc / misc (push) Waiting to run
Unit Tests: Proxy Auth & Key Management / proxy-auth (push) Waiting to run
Unit Tests: Proxy DB Operations / assert-shard-coverage (push) Waiting to run
Unit Tests: Proxy DB Operations / auth-checks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / budgets (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / custom-logging (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / db-and-spend (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / endpoints-and-responses (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / guardrails-hooks (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-utils (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / jwt-and-keys (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / key-generation (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / logging-misc (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-runtime (push) Blocked by required conditions
Unit Tests: Proxy Infrastructure / proxy-infra (push) Waiting to run
Unit Tests: Proxy Legacy Tests / auth-and-jwt (push) Waiting to run
Unit Tests: Proxy Legacy Tests / key-generation (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-config (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-response-and-misc (push) Waiting to run
Unit Tests: Proxy DB Operations / proxy-server-core (push) Blocked by required conditions
Unit Tests: Proxy API Endpoints / proxy-endpoints (push) Waiting to run
Unit Tests: Proxy API Endpoints / proxy-server (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-server (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-server-extras (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-token-counter (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-user-auth-and-spend (push) Waiting to run
Unit Tests: Proxy Legacy Tests / proxy-utils (push) Waiting to run
Unit Tests: Responses, Caching & Types / responses-caching-types (push) Waiting to run
GitHub Actions Security Analysis / zizmor (push) Waiting to run
fix(xai): bill web_search from server_side_tool_usage_details
2026-08-11 19:40:27 -07:00
mateo-berri
d96f76ca66 fix(cost-tracking): bill web searches reported only in server_side_tool_usage_details 2026-08-11 19:24:53 -07:00
Yuneng Jiang
5e094cd266
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_/bedrock-retired-sonnet-test-model 2026-08-11 18:52:32 -07:00
Yuneng Jiang
d49114b101
test(bedrock): repoint live Claude tests off the retired Claude 3 Sonnet
AWS no longer serves `anthropic.claude-3-sonnet-20240229-v1:0`. The streaming
path returns a plain 404, "Model with the provided id
anthropic.claude-3-sonnet-20240229-v1:0 is not found", and the non-streaming
path answers 500 for the same reason. Our own cost map has carried a
2026-07-30 deprecation date for it since #36538

That accounts for 20 failures across local_testing_part1, local_testing_part2
and llm_translation_testing. litellm maps both statuses correctly, so the
tests are what went stale, not the client

Replacement is `us.anthropic.claude-sonnet-4-5-20250929-v1:0`: a like-for-like
Sonnet, and the newest Bedrock Sonnet this repo exercises against the real API
in tests/e2e. Newer ids exist in the cost map, but nothing in the repo calls
them live, so picking one would be an unverified guess about model access on
the CI account

Scope is limited to the tests that actually issue a request. The occurrences
that assert on the model string itself, or that feed mocked transformations,
keep the old id so their assertions stay meaningful
2026-08-11 18:49:47 -07:00