Commit graph

49203 commits

Author SHA1 Message Date
moe-berri
fc8637ad86 refactor(memory): remove obsolete policy and end-to-end scaffolding 2026-09-15 10:17:03 -07:00
moe-berri
eb72042a0a fix(memory): keep structured streams alive during preparation 2026-09-15 00:14:03 -07:00
moe-berri
4450bfdf79 chore: merge latest main into gateway memory 2026-09-15 00:02:37 -07:00
tin-berri
4805c6d51f
Merge pull request #41072 from BerriAI/litellm_lit5201_provider_split
fix(router): honor team and key provider weights
2026-09-14 23:41:45 -07:00
Mateo Wang
1ce66e98a2
Merge pull request #40989 from BerriAI/litellm_responses_bridge_hoist_additional_tools
fix(responses): hoist Codex additional_tools input items into the chat bridge tools
2026-09-14 23:33:38 -07:00
Tin Chi Lo
398300c4e7 fix(router): honor team and key provider weights 2026-09-14 23:31:52 -07:00
Mateo Wang
b52de1675a
Merge pull request #40994 from BerriAI/litellm_sdk_exception_body_headers
fix(sdk): keep body and proxy headers on BadRequestError mapped from a litellm_proxy 400
2026-09-14 23:27:29 -07:00
Mateo Wang
c93708b2a5
Merge pull request #40228 from AaronHowell/litellm_fix_responses_credentials_affinity
fix(responses): preserve provider affinity
2026-09-14 23:09:55 -07:00
mateo-berri
9fb94ea761 fix(exceptions): keep repeated litellm_proxy response headers on the rebuilt response
httpx.Headers.items() comma-joins repeated header names, so the rebuilt
response iterates multi_items() and keeps every value, matching what the
raw openai client exposes on e.response.headers
2026-09-14 22:59:40 -07:00
mateo-berri
e3152c011d fix(responses): classify streamed tool calls on the chat name and strip guardrail edits around the grammar block
The streaming bridge restored the namespace before deciding whether a tool call was a custom tool, so a namespaced function sharing a short name with a nested custom tool streamed back as a custom_tool_call. Classify on the raw chat tool name first, the way the non-streaming path already does.

The guardrail merge only stripped the namespace prefix and grammar suffix from the ends of the edited description, so a guardrail appending text after the grammar block left the block in the member description and the chat conversion appended it a second time. Strip the first occurrence of each instead.
2026-09-14 22:58:25 -07:00
mateo-berri
62b2b36ce9 test(proxy): drop the reformat-only diff of the request processing tests
The proxy edge test file no longer carries any test of this change, and
the remaining diff was the scoped format gate reflowing the whole file to
the 120 limit, so it goes back to the merge base bytes
2026-09-14 22:39:19 -07:00
yucheng-berri
91588221cd
Merge pull request #39050 from BerriAI/litellm_lit6314_guardrail_metadata_transfer
fix(guardrails): record not_run evaluation when scoping leaves nothing to scan
2026-09-14 22:31:16 -07:00
Mateo Wang
a78b24c195
Merge pull request #41172 from BerriAI/litellm_azure_spend_log_zero_cost
fix(proxy): log the provider usage on deferred /v1/messages calls and price cache writes without a creation rate
2026-09-14 22:26:22 -07:00
mateo-berri
6a635cbb64 fix(sdk): carry a litellm_proxy error's headers on e.response, not e.headers
A mapped litellm_proxy exception now attaches an httpx.Response that
carries the proxy's response headers whenever the handler attached a
header-less synthetic one, on every status branch and on the relay
path. BadRequestError keeps its base-class contract: .headers stays the
proxy-supplied channel, so the proxy edge keeps forwarding an upstream
proxy's headers under the llm_provider- prefix and the date and server
edge change is no longer needed.
2026-09-14 22:22:26 -07:00
yucheng
fe0fb97fd2 fix(guardrails): record not_run when a skipped role mixes text and images
Only image-only unscoped content stays unrecorded; text or tool content
removed by scoping is recorded as not_run even when an image sits beside it.
Also keeps the type-discipline budget flat by returning the reason from the
helper and annotating the accumulator lists _extract_inputs requires.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 05:20:56 +00:00
yucheng
714b113c5f fix(guardrails): leave scoped-out image-only input unrecorded and split the not_run helper
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 05:10:32 +00:00
yucheng
9acdebf563 chore: merge origin/main into litellm_lit6314_guardrail_metadata_transfer
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 05:03:31 +00:00
Mateo Wang
c16c172a65
Merge pull request #40939 from BerriAI/litellm_responses_per_message_guardrail_rewrite
fix(guardrails): write per-message guardrail rewrites back onto Responses input items
2026-09-14 21:57:29 -07:00
mateo-berri
d7a2bdd441 test(cost): type the cache rate cases of the base cost test 2026-09-14 21:56:23 -07:00
mateo-berri
8573241c49 fix(cost): resolve a missing 1h cache write rate after off-peak pricing
The one-hour cache write fallback now takes the applied cache write rate, so an off-peak write price carries into it instead of the input rate

The cost estimate test for a cost-map model without cache prices now expects writes at the input rate, which is what the proxy bills

The recording logger in the deferred guardrail test types its callback parameters
2026-09-14 21:46:33 -07:00
mateo-berri
f4f1e2eace refactor(sdk): move the None sentinel to constants and freeze the init kwargs filter 2026-09-14 21:46:22 -07:00
mateo-berri
f8c2539ba7 Merge remote-tracking branch 'origin/main' into litellm_azure_spend_log_zero_cost 2026-09-14 21:37:19 -07:00
yuneng-jiang
b4cff58be7
Merge pull request #41181 from BerriAI/litellm_pin_ci_pricing
fix(ci): test checked-out model pricing in unit jobs
2026-09-14 21:31:34 -07:00
yuneng-jiang
26a13132f8
Merge pull request #41149 from BerriAI/litellm_strict_provider_identity
test: add strict stateless provider replay identity
2026-09-14 21:31:25 -07:00
mateo-berri
e01d97ea08 fix(guardrails): read Prompt Security modified rows with the slot count's own predicate
A chat row whose content carried an empty text part counted two slots in the
chat completions handler while Prompt Security read one text out of the
modified row, so the structured rewrite was dropped and the request got the
named rejection. One shared helper now lists a row's slot texts and both the
slot count and the modified-row reader use it.
2026-09-14 21:31:22 -07:00
mateo-berri
879fcd847f Merge remote-tracking branch 'origin/main' into litellm_sdk_exception_body_headers_do0914 2026-09-14 21:28:23 -07:00
Yuneng Jiang
6969bd9c54
ci: run replay harness on every admitted CircleCI pipeline 2026-09-14 21:12:16 -07:00
Yuneng Jiang
16fb44f23a
ci: run provider replay harness in CircleCI 2026-09-14 21:03:58 -07:00
Mateo Wang
94f08636c7
Merge pull request #40315 from rad-p44/fix/headroom-protect-cache-control-rows
fix(headroom): protect cache_control-marked rows anywhere in history
2026-09-14 21:03:16 -07:00
Yuneng Jiang
a1d216b7d7
fix(ci): test checked-out model pricing in unit jobs 2026-09-14 21:00:00 -07:00
Mateo Wang
2bdafa1206
Merge branch 'main' into fix/headroom-protect-cache-control-rows 2026-09-14 20:53:07 -07:00
yuneng-jiang
9d7f2aad04
Merge branch 'main' into litellm_strict_provider_identity 2026-09-14 20:43:55 -07:00
yuneng-jiang
15bd8b0e4a
Merge pull request #40892 from BerriAI/litellm_jwt_management_callers
test: bind management E2E callers and isolate JWT actors
2026-09-14 20:30:52 -07:00
kerry-berri
03a4c806c4
Merge pull request #41157 from BerriAI/litellm_gemini_embedding_2_per_token_billing
fix(cost): bill gemini-embedding-2 per token and stop double charging audio
2026-09-14 19:49:11 -07:00
kerry
954dfa6ba7 test(utils): allow modality batch cost fields in cost map schema test
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 02:38:53 +00:00
kerry
7761d04450 test(vertex): cover malformed batch usage details
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 02:37:51 +00:00
kerry
168d0d3d99 fix(cost): drop remaining unnecessary cast in batch cost calculator
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 02:26:19 +00:00
mateo-berri
22b377fe2a fix(proxy): log the provider usage on deferred /v1/messages calls and price cache writes without a creation rate
With a post-call guardrail the proxy defers async success logging, and every nested wrapper on a
/v1/messages call bridged to the Responses API overwrote the stored closure, so the spend log was
built from the outermost Anthropic-shaped reply under Responses semantics and recorded the prompt
tokens without the cache hit. The first wrapper to exit now keeps the slot, which is the innermost
provider response, the same one the non-deferred path logs.

The flat cost path also billed cache-creation tokens at 0 when the model had no
cache_creation_input_token_cost. It now falls back to the input rate, and the 1h rate to the
creation rate, matching the tiered path and the custom pricing helper.
2026-09-14 19:21:03 -07:00
kerry
a5f00b9189 fix(cost): drop unnecessary cast in batch rate lookup
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 02:15:22 +00:00
kerry
bf1bdb3045 fix(ci): keep cost map schema generated by the base branch generator
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 02:07:44 +00:00
kerry
a5fc880c90 refactor(vertex): move batch usage modality parsing under llms
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 02:03:32 +00:00
moe-berri
ba7857a49d fix(memory): preserve strict output formats around tool rounds 2026-09-14 19:03:03 -07:00
kerry
ca7364fb05 fix(batches): avoid strict lint violation in usage parser
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 02:00:48 +00:00
kerry
c0c5044c45 fix(batches): keep modality token details in raw vertex batch usage
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 01:57:50 +00:00
kerry
2b32f586c0 refactor(cost): extract batch modality rate lookup
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 01:51:41 +00:00
kerry
ce83fac351 fix(cost): bill batch embeddings per modality token rate
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 01:50:21 +00:00
moe-berri
6f024adfcc fix(memory): reuse shared credential redaction before persistence 2026-09-14 18:42:53 -07:00
mateo-berri
16c326537f fix(guardrails): define UnappliableRequestRewrite in the shared guardrail translation utils
The three guardrail translation handlers imported the exception from the proxy policy engine through a function-local import, which CodeQL flagged as a cyclic import. The exception and its helper now live next to the handlers in the shared guardrail translation utils, and the tests import it from there.

The Prompt Security modify-mode helper is also restructured into early-return TypedDict displays so the LIT002 budget stays at its limit
2026-09-14 18:39:54 -07:00
Mateo Wang
d2859e18d7
Merge pull request #40988 from BerriAI/litellm_responses_stream_error_exception_mapping
fix(responses): route mid-stream error events through exception_type so content_policy_fallbacks fire
2026-09-14 18:36:20 -07:00
kerry
a28ea22ec1 fix(cost): move gemini-embedding-2-preview to per-token rates
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-15 01:34:22 +00:00