Commit graph

49053 commits

Author SHA1 Message Date
jesus
08ff09f585 fix(responses): finalize the managed row before the billing read so a stolen claim cannot rebill
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 17:23:38 +00:00
ryan-crabbe-berri
33d9464f25 test(responses): cover the gate that decides a background row gets written
The storage branch's three conditions sat inline in `responses_api`, so nothing
proved a foreground create or an already-terminal one stays out of the managed
table. They move into `should_store_background_response`, which the endpoint
calls and the tests exercise across both arms.

Claude-Session: https://claude.ai/code/session_01RHAjRxNhXTpKHeGMZ1nDKi
2026-09-15 00:38:09 +00:00
ryan-crabbe-berri
9a1d574493 refactor(responses): name the background row store by protocol, not the enterprise class
The seam's type annotation pulled `litellm_enterprise` into this module's import
graph, which check_unsafe_enterprise_import rejects outside a try-except. A
Protocol carrying the one method the seam calls types it without the import and
drops the local one the cast needed too.

Claude-Session: https://claude.ai/code/session_01RHAjRxNhXTpKHeGMZ1nDKi
2026-09-15 00:38:09 +00:00
ryan-crabbe-berri
cacfc47089 refactor(responses): give ResponsesIDSecurity a public provider_response_id
Two callers only want the provider's own id behind an advertised one, and both
reached past the class to get it out of the decrypt tuple. The poller also typed
its rows as the pydantic projection, which has no `id`, while it is handed a
Prisma row and reads `job.id` six times.

Claude-Session: https://claude.ai/code/session_01RHAjRxNhXTpKHeGMZ1nDKi
2026-09-15 00:38:09 +00:00
ryan-crabbe-berri
2aac6e109d refactor(responses): cut the cost poller's docstrings back to the non-obvious why
The poller narrated its own straightforward behavior in seven multi-paragraph
docstrings, which the repo's comment policy rules out. Each is now the claim a
reader needs to avoid a wrong edit and nothing more. Also drops the deprecated
`Dict` and `Optional` aliases the file still used.

Claude-Session: https://claude.ai/code/session_01RHAjRxNhXTpKHeGMZ1nDKi
2026-09-15 00:37:54 +00:00
ryan-crabbe-berri
5aa1901249 test(responses): drive the poller tests through the injected router
The eight claim/release tests reached into `litellm.aget_responses` with
`patch`, which the test-quality gate flags and which couples them to an
import path rather than to the poller's own seam. Each job now carries a
LiteLLM-encoded provider id, so the read routes through the router the
fixture already injects and the assertions run against that mock.

Claude-Session: https://claude.ai/code/session_01RHAjRxNhXTpKHeGMZ1nDKi
2026-09-15 00:37:54 +00:00
ryan-crabbe-berri
492336a50b refactor(responses): give the background row store an injectable seam
The store lived inline in responses_api, so covering it meant patching five
proxy_server globals per test, which the test-quality gate counts as pinning
the test to the wiring rather than the behaviour. It is now a module-level
function that takes the managed-files hook as an argument, and the tests hand
it a fake directly.

The poller tests reach the same fetch through the router fixture that is
already injected, instead of patching litellm.aget_responses.

A response with no model_id now returns early rather than raising into the
caller's except block. Nothing is stored either way and the warning is
unchanged, so only the redundant second log line goes away.

Claude-Session: https://claude.ai/code/session_01RHAjRxNhXTpKHeGMZ1nDKi
2026-09-15 00:37:54 +00:00
ryan-crabbe-berri
49a8ce5e42 fix(responses): key a background response's managed row by the provider id
model_object_id is documented as "the id returned by the backend API
provider", and that is what batches and fine-tuning jobs store there. The
background responses create stored the advertised id in it instead, which
is encrypted with a fresh nonce on every call, so the row had no stable
handle on the generation it describes.

The cost poller now reads the provider id straight off the row. Rows
written before this still carry the advertised id there, and decrypting is
a no-op on an id that is already the provider's, so both shapes resolve
through the same call.

Claude-Session: https://claude.ai/code/session_01RHAjRxNhXTpKHeGMZ1nDKi
2026-09-15 00:37:54 +00:00
ryan-crabbe-berri
ffa52f2f6a refactor(responses): mark a billed row completed without copying the response onto it
The previous commit stored the finished ResponsesAPIResponse in file_object. That
duplicates content the provider still serves from its own copy, and the usage and
spend it was meant to preserve already land in LiteLLM_SpendLogs on every billed
call regardless of store_prompts_in_spend_logs, which gates only the messages and
response body columns.

The poller now writes status alone, as it did before. The write stays per job
rather than one bulk update so a single failure cannot strand the rest of the
cycle.

Claude-Session: https://claude.ai/code/session_01Hn5E8Jz1LjGLFyiYxBRcBW
2026-09-15 00:37:54 +00:00
ryan-crabbe-berri
0235dbd7f2 fix(responses): claim a background response before the read that bills it
Every pod and uvicorn worker schedules its own CheckResponsesCost against the
shared LiteLLM_ManagedObjectTable. The poller selected eligible rows, performed
the billed retrieval, and only then marked them completed in one bulk write, so
two pollers could select the same terminal response and both record a charge
before either completion update landed.

Each row is now claimed with a compare-and-swap on batch_processed before the
read, because the read is what prices the job: aget_responses stamped with the
poll origin writes the spend log itself, so there is no later point at which to
serialize. A row whose read raised, or whose provider status is still
non-terminal, releases its claim so a later cycle retries it rather than
retiring it unbilled. That is the failure #37050 fixed on the batch side.

A pod that dies between winning the claim and billing would otherwise strand the
row: it holds a claim nobody will release and its status never reaches terminal,
so every later cycle re-selects it and loses. The updated_at arm of the claim
takes such a row back after three poll cycles, and since updated_at is @updatedAt
a healthy in-flight claim written moments ago is never stolen.

The poller now also persists the finished response onto its managed row instead
of writing status alone, so the row carries the generation's usage rather than
the stale queued copy stored at create time.

Reuses the existing batch_processed column, so no migration. It already sits on
the shared table defaulted to false and was unused by response rows.

Claude-Session: https://claude.ai/code/session_01Hn5E8Jz1LjGLFyiYxBRcBW
2026-09-15 00:37:54 +00:00
jesus
bb81a9f9f1 fix(responses): bill a background response once via the cost poller, not on every read
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 00:37:54 +00:00
yucheng-berri
b67137b67f
Merge pull request #40702 from BerriAI/litellm_model_armor_logging_only_streaming
feat(model_armor): logging_only mode scans completed streams after delivery
2026-09-14 17:23:32 -07:00
Yassin Kortam
d1fc231545
Merge pull request #41145 from BerriAI/litellm_health_check_skip_save_on_failed_read_main 2026-09-14 16:48:47 -07:00
yucheng-berri
99245f9323
Merge pull request #41131 from BerriAI/litellm_prompt_security_created_status
fix(prompt_security): keep polling file sanitization through non-terminal statuses
2026-09-14 16:43:37 -07:00
tin-berri
c626ff098b
Merge pull request #40877 from BerriAI/litellm_lit7658_cache_cost_v0_fresh
feat(proxy): predict prompt-cache costs across deployments
2026-09-14 16:25:41 -07:00
yuneng-jiang
9e485b0d5c
Merge pull request #41142 from BerriAI/litellm_codeql_import_noise
ci(codeql): exclude noisy Python quality queries
2026-09-14 16:25:38 -07:00
kerry-berri
9481556b5d
Merge pull request #40955 from BerriAI/litellm-providers/price-sync
Some checks are pending
LiteLLM Rust / rust-test (push) Waiting to run
Unit Tests: Documentation Validation / documentation (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 / 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 DB Operations / proxy-server-core (push) Blocked by required conditions
Unit Tests: Proxy DB Operations / proxy-utils (push) Blocked by required conditions
Unit Tests / caching-local (push) Waiting to run
Unit Tests / core-utils (push) Waiting to run
Unit Tests / enterprise-package (push) Waiting to run
Unit Tests / enterprise-routing (push) Waiting to run
Unit Tests / integrations (push) Waiting to run
Unit Tests / All Other Providers (push) Waiting to run
Unit Tests / Vertex AI (push) Waiting to run
Unit Tests / misc (push) Waiting to run
Unit Tests / proxy-auth (push) Waiting to run
Unit Tests / proxy-extras (push) Waiting to run
Unit Tests / proxy-infra (push) Waiting to run
Unit Tests / proxy-server (push) Waiting to run
Unit Tests / responses-caching-types (push) Waiting to run
GitHub Actions Security Analysis / zizmor (push) Waiting to run
Unit Tests / proxy-endpoints (push) Waiting to run
chore(prices): sync Vertex AI prices: 14 models
2026-09-14 16:16:07 -07:00
Yassin Kortam
9cbd239488
Merge pull request #41056 from BerriAI/litellm_moderation_call_id_header
fix(proxy): resolve x-litellm-call-id from response metadata when routes omit call_id
2026-09-14 16:14:13 -07:00
Yuneng Jiang
15fdc5f0f0
ci(codeql): retain Python log-injection coverage 2026-09-14 16:09:27 -07:00
yassin
c6a36fb8b6 fix(health): skip background health check DB writes when the latest-row read fails
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
(cherry picked from commit 6d2c4899b0)
2026-09-14 23:03:30 +00:00
yassin
ece2bbfed7 fix(proxy): resolve x-litellm-call-id from response metadata when routes omit call_id
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 23:03:27 +00:00
Yuneng Jiang
270ce9d8ca
ci(codeql): exclude remaining audited Python query categories 2026-09-14 16:01:12 -07:00
yuneng-jiang
63386d6cc6
Merge pull request #41070 from BerriAI/litellm_integration_management
test: cover persisted updates and warmed authorization policies
2026-09-14 15:57:32 -07:00
Yuneng Jiang
97e9748048
ci(codeql): exclude noisy Python import-cycle queries 2026-09-14 15:57:24 -07:00
Yassin Kortam
de55e22899
Merge pull request #41141 from BerriAI/litellm_lit7694_forwarded_headers_body_leak
fix(openai): keep extra_headers out of the chat request body on the httpx handler path
2026-09-14 15:52:31 -07:00
Yassin Kortam
1f46e58494
Merge pull request #41018 from BerriAI/litellm_fix_model_alias_map_leak
fix(utils): keep litellm params out of provider request bodies
2026-09-14 15:51:23 -07:00
yuneng-jiang
c57957f45d
Merge pull request #41066 from BerriAI/litellm_integration_foundation
test: add dedicated CircleCI integration contract foundation
2026-09-14 15:50:22 -07:00
kerry
b25b6eb5a4 test(cost_calc): pin vertex_ai gemini-3.5-flash-lite priority cache reads at the published 5.4e-08
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 22:48:59 +00:00
yassin
e2e1d36804 fix(openai): keep extra_headers out of the chat request body on the httpx handler path
Forwarded client headers on bridged /v1/responses calls were serialized into the
OpenAI JSON body as extra_headers when EXPERIMENTAL_OPENAI_BASE_LLM_HTTP_HANDLER
was set, and OpenAI rejected the request with unknown_parameter. The headers are
already merged into the outgoing HTTP headers, so only set the SDK-style
optional param on the SDK client path

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 22:27:35 +00:00
Devin AI
6f9915b650 fix(utils): keep litellm params out of provider request bodies
get_litellm_params() keys such as model_alias_map, completion_call_id and
custom_prompt_dict were missing from all_litellm_params, so when a bridge
forwarded litellm_params as completion kwargs they were swept into extra_body
and OpenAI rejected the call with "Unknown parameter: 'model_alias_map'".

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 22:07:27 +00:00
ryan-crabbe-berri
7fd541efb9
Merge pull request #41048 from HUAHAODIA/litellm_ratchet_strict_rules
chore(lint): graduate 12 rules from the strict-gate ratchet
2026-09-14 15:06:16 -07:00
ryan-crabbe-berri
7b6d223105
Merge pull request #40196 from BerriAI/litellm_team_admin_all_proxy_models
fix(ui): let team admins grant a team all proxy models
2026-09-14 15:05:01 -07:00
ryan-crabbe-berri
51926c2e79
Merge pull request #41023 from BerriAI/litellm_ui_move_metadata_tags_to_tags_field
fix(ui): move tags typed into key metadata JSON into the Tags field
2026-09-14 15:03:54 -07:00
yucheng
3a3075b8a2 fix(prompt_security): poll only on queued statuses, keep 500 for terminal or missing status
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 22:01:39 +00:00
berriai-litellm-provider-info-sync[bot]
c3f8c07c43
chore(prices): sync Vertex AI prices: 14 models
vertex_ai/deep-research-pro-preview-12-2025: cache_read_input_token_cost
vertex_ai/gemini-2.5-flash-image: input_cost_per_token_flex, output_cost_per_token_flex, input_cost_per_token_batches, input_cost_per_token_priority, output_cost_per_token_batches
vertex_ai/gemini-3-flash-preview: input_cost_per_token_flex, output_cost_per_token_flex, input_cost_per_token_batches, output_cost_per_token_batches, cache_read_input_token_cost_flex, cache_read_input_audio_token_cost
vertex_ai/gemini-3-pro-image: input_cost_per_token_flex, output_cost_per_token_flex, cache_read_input_token_cost, input_cost_per_token_priority, output_cost_per_token_priority, cache_read_input_token_cost_flex, cache_read_input_token_cost_priority, input_cost_per_token_above_200k_tokens, output_cost_per_token_above_200k_tokens, cache_read_input_token_cost_above_200k_tokens, input_cost_per_token_above_200k_tokens_priority, output_cost_per_token_above_200k_tokens_priority, cache_read_input_token_cost_above_200k_tokens_priority
vertex_ai/gemini-3.1-flash-image: input_cost_per_token_flex, output_cost_per_token_flex, cache_read_input_token_cost, input_cost_per_token_batches, output_cost_per_token_batches, cache_read_input_token_cost_flex
vertex_ai/gemini-3.1-flash-lite: cache_read_input_audio_token_cost
vertex_ai/gemini-3.1-flash-lite-image: input_cost_per_token_flex, output_cost_per_token_flex, cache_read_input_token_cost_flex
vertex_ai/gemini-3.1-pro-preview: input_cost_per_token_flex, output_cost_per_token_flex, cache_read_input_token_cost_flex
vertex_ai/gemini-3.5-flash: 
vertex_ai/gemini-3.5-flash-lite: cache_read_input_token_cost_priority
vertex_ai/gemini-3.6-flash: 
vertex_ai/gemini-3.7-flash: 
vertex_ai/gemini-3.8-flash: 
vertex_ai/gemini-embedding-2:
2026-09-14 22:00:57 +00:00
Yassin Kortam
e766277846
Merge pull request #40991 from BerriAI/litellm_team_model_cooldown_siblings
fix(router): cool down team deployments on 429 when a sibling serves the same public model
2026-09-14 14:57:07 -07:00
Yassin Kortam
3e417fa6e0
Merge pull request #41113 from BerriAI/litellm_realtime_release_max_parallel_slot
fix(proxy): release max_parallel_requests slot when a realtime session ends without LLM callbacks
2026-09-14 14:56:11 -07:00
ryan-crabbe-berri
f9ba42860c fix(azure_ai): keep api_version as a property alongside the new getter
The PLR0206 fix renamed the property to get_api_version and dropped it.
AzureFoundryModelInfo().api_version does resolve today, so removing it
breaks external callers. Restore it as a zero-arg property delegating to
the staticmethod, which satisfies PLR0206 either way.
2026-09-14 14:56:07 -07:00
ryan
52a3b0ede7 fix(ui): trim and drop blank tags moved out of key metadata JSON
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 21:50:25 +00:00
yujonglee
9bbb869b13
Merge pull request #41120 from BerriAI/litellm_trace_profiler_threads
refactor(harness): expand independent trace coverage
2026-09-14 14:50:18 -07:00
Devin AI
e4ebeae800 fix(prices): add text output rate to Vertex TTS entries, sync gemini-embedding-2 alias
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 21:49:15 +00:00
Yassin Kortam
24bfd5fba1
Merge pull request #41102 from BerriAI/litellm_team_membership_once_main
fix(auth): load team membership once per request and skip prisma on an L1 hit
2026-09-14 14:46:06 -07:00
yassin
fbc1011d27 fix(bedrock): end the realtime session when the client disconnects instead of waiting for Nova Sonic
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 21:42:42 +00:00
Devin AI
f45e20e6c2 fix(prices): mark Vertex Gemini TTS entries as audio_speech
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 21:41:43 +00:00
kerry
abbf5aae20 chore(prices): flag gpt-5.5-cyber as a reasoning model
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 21:41:10 +00:00
ryan
df87a49f8b fix(ui): offer no models when an org team's ceiling never arrives
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 21:35:55 +00:00
yassin
b4d0f4ad26 refactor(realtime): move session ownership marker keys into constants
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-14 21:33:48 +00:00
berriai-litellm-provider-info-sync[bot]
93e65995d6
chore(prices): sync Vertex AI prices: 4 models
gemini-2.5-flash: cache_read_input_audio_token_cost
gemini-2.5-flash-lite: cache_read_input_audio_token_cost
gemini-3-flash-preview: cache_read_input_audio_token_cost
gemini-3.1-flash-lite: cache_read_input_audio_token_cost
2026-09-14 21:26:02 +00:00
kerry
ddf13e9505 Merge remote-tracking branch 'origin/main' into litellm-providers/price-sync 2026-09-14 21:21:55 +00:00
kerry-berri
c6e4c5582d
Merge pull request #41093 from BerriAI/litellm_fallback_backfill_opt_in_main
feat(model_info): provider-scoped fill_missing_for_providers backfill from fallback generalization rules
2026-09-14 14:20:36 -07:00