Commit graph

6382 commits

Author SHA1 Message Date
mateo-berri
e327a6ae76 test(guardrails): drop regression docstrings from the api_version tests 2026-09-19 02:52:42 -07:00
mateo-berri
24064e3b31 fix(guardrails): treat the stored Javelin api_version default as unset for Azure Content Safety
Guardrails created through POST /guardrails on older releases have api_version "v1" saved in the database, because the writer persists every default. Azure Content Safety never accepts that value, so those guardrails kept answering 404 after the default moved to None. The Azure base now resolves "v1" to 2024-09-01 the same way it resolves a missing value. Also restores the OpenAPI snapshot line that a Python 3.14 regeneration had dedented
2026-09-19 02:29:43 -07:00
mateo-berri
6f4d1c5911 fix(guardrails): stop the Javelin api_version default leaking into Azure Content Safety
LitellmParams mixes every provider config model into one class, so the
Javelin api_version default of "v1" reached the Azure Content Safety
guardrails whenever config.yaml omitted api_version and Azure answered 404.
The shared field now defaults to None, Javelin keeps filling in "v1" itself,
and the Azure guardrails fall back to the documented 2024-09-01 at request
time so a DB update that omits api_version stays on the default too.
2026-09-19 01:41:35 -07:00
Mateo Wang
5f1268c056
Merge pull request #41933 from BerriAI/litellm_deliver_multi_choice_stream_rewrites
fix(policy_engine): deliver guardrail text rewrites on multi-choice, unfinished, and envelope-less streams
2026-09-19 00:22:02 -07:00
yucheng-berri
8afbc51cb7
Merge pull request #41685 from BerriAI/litellm_prompt_injection_llm_api_check_dispatch
* fix(proxy): dispatch llm_api_check moderation through during_call_hook

ProxyLogging.during_call_hook only ran async_moderation_hook for CustomGuardrail callbacks, so a
CustomLogger such as the prompt injection detector with llm_api_check enabled never called the
configured moderation model. Dispatch any CustomLogger that overrides async_moderation_hook and hand
the proxy router to every registered prompt injection detector at startup so that call can route

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

* fix(enterprise): resolve openai_moderations model at call time and default to omni-moderation-latest

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

* fix(proxy): keep queued moderation running past a V1 pre_call guardrail

A V1 CustomGuardrail with moderation_check pre_call returned out of
during_call_hook before asyncio.gather, abandoning already-queued
CustomLogger moderation coroutines and skipping every later callback.
Skip only that guardrail instead.

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

* fix(utils): skip null tool_calls when formatting prompts for moderation hooks

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

---------

Co-authored-by: yucheng <yucheng@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 23:53:14 -07:00
mateo-berri
4fe1549432 fix(policy_engine): keep the per-choice rebuilt response's choices a list so legacy hook rewrites survive the model_dump round-trip 2026-09-18 23:53:02 -07:00
Mateo Wang
56116079c8
Merge pull request #41930 from BerriAI/litellm_mat602_upstream_500_error_type
fix(exceptions): keep internal_server_error as the public type of an upstream 500
2026-09-18 23:19:52 -07:00
mateo-berri
b3d9ba9e7b fix(policy_engine): deliver guardrail text rewrites on multi-choice, unfinished, and envelope-less streams
Post-call pipeline rewrites on buffered streams failed open on three shapes:
chat streams with n > 1 (the rebuilt response collapsed every choice into
index 0), streams that ended without a finish marker, and Responses streams
whose final event carried no response envelope.

The chat handler now rebuilds the ended stream one choice index at a time and
writes each choice's rewrite back to that choice's buffered deltas. The
Anthropic handler writes an unended stream's rewrite across its text deltas.
The Responses handler spreads an envelope-less rewrite over the buffered
output_text events, still failing open when a scanned event cannot be placed.

Tool-call rewrites on n > 1 chat streams keep failing open.
2026-09-18 22:59:52 -07:00
Mateo Wang
4eb13a0b2a
Merge pull request #41843 from BerriAI/litellm_lit8064_unpin_derived_pricing
fix(proxy): unpin cost-map pricing copied into model_info and report pricing overrides
2026-09-18 22:58:04 -07:00
mateo-berri
5f6ffdc333 test: drop the docstring that restated the payload test's name 2026-09-18 22:48:42 -07:00
mateo-berri
ddac683ec6 fix(exceptions): keep internal_server_error as the public type of an upstream 500
PR #40243 started carrying the upstream error body on InternalServerError so the Responses response.failed event can report the provider's code and message, and openai's APIError.__init__ took the body's type along with it. The proxy then answered an OpenAI-compatible upstream 500 with type server_error while a 502 and a 503 kept internal_server_error, and the integration contract in test_observed_routing.py went red. Pin the type the way RateLimitError pins throttling_error, keeping the body.
2026-09-18 22:28:58 -07:00
yuneng-jiang
12ddb35aad
Merge pull request #41924 from BerriAI/litellm_role_permissions_normalization
fix(proxy): parse role_permissions where it is read
2026-09-18 22:15:20 -07:00
Mateo Wang
078a60478f
Merge pull request #41485 from BerriAI/litellm_jwt_token_exchange_grant
feat(proxy): add RFC 8693 token exchange for IdP JWTs on the gateway token endpoint
2026-09-18 21:27:20 -07:00
Mateo Wang
b46612cfeb
Merge pull request #41893 from BerriAI/litellm_fix_responses_ws_encrypted_content_affinity
fix(responses): restore encrypted_content and apply affinity on the native WebSocket relay
2026-09-18 21:09:17 -07:00
Yuneng Jiang
800b09ba41
Merge remote-tracking branch 'origin/main' into litellm_role_permissions_normalization 2026-09-18 21:00:23 -07:00
Yuneng Jiang
ef34e44d8b
fix(proxy): parse role_permissions where it is read
load_config used to return a local general_settings dict that it had
normalized in place, turning the configured role_permissions entries into
RoleBasedPermissions objects. It now returns the SettingsStore, which never
saw that write, so JWT auth received raw dicts and every request failed with
"'dict' object has no attribute 'role'" whenever role_permissions was set.

Convert the entries in the consumer instead, with a TypeAdapter, so the value
is parsed wherever it comes from. load_config keeps validating at boot, so a
malformed entry still fails startup rather than the first request.
2026-09-18 21:00:18 -07:00
Mateo Wang
c1de8665ff
Merge pull request #34267 from BerriAI/litellm_claude_code_gateway_protocol
feat(proxy): serve the Claude Code gateway protocol under /claude_code_gateway
2026-09-18 20:49:48 -07:00
kerry-berri
a1f3124e18
Merge pull request #41891 from BerriAI/litellm_overhead_window_from_proxy_receive
fix(timing): anchor response duration and overhead at proxy receive time
2026-09-18 20:01:31 -07:00
mateo-berri
9662b2a35c refactor(responses): type the websocket test parameters and suppress the error-frame send explicitly 2026-09-18 18:35:48 -07:00
ryan-crabbe-berri
4b4042c5d1
Merge pull request #41916 from BerriAI/litellm_team_admin_projects_permission
feat(proxy): let team admins manage projects via team_admin_editable_team_fields
2026-09-18 18:26:25 -07:00
mateo-berri
06a5594bb6 fix(claude_code_gateway): mint the bearer before consuming the device code so a signing failure never spends the login 2026-09-18 18:25:55 -07:00
mateo-berri
fcc7efa4db fix(responses): forward the routed input and report routing rejections on the websocket 2026-09-18 18:10:26 -07:00
mateo-berri
ca8062e506 fix(claude_code_gateway): keep the device secret out of the browser URL and validate the login before claiming it 2026-09-18 18:07:21 -07:00
kerry
a1560936f7 fix(timing): use epoch math for detailed pre-processing and drop client-supplied timing windows
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-19 01:06:53 +00:00
Yassin Kortam
15f63c33bf
Merge pull request #41911 from BerriAI/litellm_rate_limit_reset_time_utc
fix(rate_limiter): render the 429 reset time in UTC as labelled
2026-09-18 18:05:45 -07:00
ryan
f3bbeed82f feat(proxy): let team admins manage projects via team_admin_editable_team_fields
Adds a projects entry to the team_admin_editable_team_fields setting. When set, team admins (legacy admins list or members_with_roles role admin) can call /project/new and /project/update for the teams they administer. The two routes join self_managed_routes so the endpoint check runs instead of the route gate's blanket 401. /project/delete stays proxy admin only

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-19 01:02:50 +00:00
Yassin Kortam
6d8a960e1d
Merge pull request #41667 from BerriAI/litellm_mcp_client_allowlist
feat(mcp): allowlist MCP client applications at the gateway
2026-09-18 17:48:36 -07:00
yassin
aa0fb915d0 fix(rate_limiter): render the 429 reset time in UTC as labelled
The proxy rate limiters formatted the reset epoch with a naive datetime.fromtimestamp, which reads the process timezone, and then appended a literal UTC suffix. A proxy running outside UTC returned a local wall-clock time labelled as UTC in the 429 body and reset_at header. Convert with tz=timezone.utc in both the request limiter and the batch limiter so the label is true

Co-authored-by: Priyansh Nandwana <nandwana.priyansh103@gmail.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-19 00:40:51 +00:00
mateo-berri
50629ff5ca Merge branch 'main' of https://github.com/BerriAI/litellm into litellm_jwt_token_exchange_grant
# Conflicts:
#	tests/test_litellm/proxy/auth/test_auth_checks.py
2026-09-18 17:30:38 -07:00
Mateo Wang
cda022ca68
Merge pull request #40243 from zoroyihan7/fix-responses-stream-error-events
fix(responses): emit typed streaming failure events
2026-09-18 17:29:57 -07:00
Mateo Wang
f6d4766ebe
Merge pull request #41878 from BerriAI/litellm_requeue_daily_spend_without_redis_buffer
fix(proxy): requeue daily spend rows when the commit fails without the Redis buffer
2026-09-18 17:27:36 -07:00
mateo-berri
59f7a00cf6 fix(claude_code_gateway): scope the protobuf body skip to the OTLP routes and match the metrics middleware on the route path 2026-09-18 17:23:59 -07:00
mateo-berri
5030214671 Merge origin/main into litellm_fix_responses_ws_encrypted_content_affinity
Resolves the conflicts with the WebSocket request defaults from main (PR #41881):
the relay keeps both custom_llm_provider and request_defaults, and a masked
response.create frame is re-serialized when the defaults changed it.

Keeps the first-frame routing hints (input, previous_response_id) out of the
deployment request defaults so they never get injected into later frames on the
same connection, with a regression test.
2026-09-18 17:23:59 -07:00
Mateo Wang
9b342cdd40
Merge pull request #41868 from BerriAI/litellm_config_update_rejects_config_owned_keys
fix(proxy): refuse config-owned keys on POST /config/update
2026-09-18 17:23:23 -07:00
ryan-crabbe-berri
1073b9eff7
Merge pull request #41354 from BerriAI/litellm_lit_3269_project_spend_tracking
fix(proxy): track project spend and enforce project budgets additively
2026-09-18 17:17:28 -07:00
mateo-berri
febe9aec65 fix(responses): book a rejected WebSocket connection as a failed request 2026-09-18 17:10:01 -07:00
yucheng-berri
500e880a40
Merge pull request #41895 from BerriAI/litellm_openai_moderations_model_default
Co-authored-by: yucheng <yucheng@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 17:06:41 -07:00
ryan-crabbe-berri
4bb1ae115b
Merge pull request #41347 from BerriAI/litellm_team_member_budget_link_default
fix(team): apply team_member_budget updates to members still on the team default
2026-09-18 17:06:25 -07:00
yucheng
c7028761aa fix(proxy): keep queued moderation running past a V1 pre_call guardrail
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
A V1 CustomGuardrail with moderation_check pre_call returned out of
during_call_hook before asyncio.gather, abandoning already-queued
CustomLogger moderation coroutines and skipping every later callback.
Skip only that guardrail instead.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 23:33:29 +00:00
mateo-berri
c6c8aed3f8 fix(proxy): drop only the daily spend batch whose failure cannot be re-sent, requeue the unsent ones 2026-09-18 16:22:04 -07:00
yucheng
e5d02fecf7 chore: merge litellm_openai_moderations_model_default (#41895) into litellm_prompt_injection_llm_api_check_dispatch 2026-09-18 23:19:21 +00:00
mateo-berri
01d8d3c218 fix(claude_code_gateway): wrap managed settings in the uuid, checksum, settings envelope the client requires
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
Terraform Provider / gofmt, vet, build, test (push) Has been cancelled
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Has been cancelled
2026-09-18 16:18:15 -07:00
mateo-berri
f143a46cdf chore: merge main into litellm_lit8064_unpin_derived_pricing 2026-09-18 16:11:37 -07:00
yucheng-berri
8e93031c19
Merge pull request #41786 from BerriAI/litellm_passthrough_xpass_trace
Pass-through requests inject the proxy span into upstream headers since #40669, which
replaced an explicit x-pass-traceparent with an unrelated trace and dropped its
x-pass-tracestate. Keep the caller's context when the carrier already names a
different trace, and keep the proxy child span for same-trace or missing headers.

Co-authored-by: yucheng <yucheng@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 16:07:28 -07:00
yucheng
1704aeebb4 fix(enterprise): resolve openai_moderations model at call time and default to omni-moderation-latest
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 23:06:47 +00:00
mateo-berri
5db2a0c885 test(proxy): type the sqlstate test parameters 2026-09-18 16:05:42 -07:00
mateo-berri
87ac68709c fix(claude_code_gateway): single-use device codes across replicas, protobuf telemetry, CLI user route access 2026-09-18 16:05:16 -07:00
ryan
b4c5f6fa44 Merge remote-tracking branch 'origin/main' into litellm_team_member_budget_link_default
Some checks failed
LiteLLM Rust / rust-lint (push) Has been cancelled
LiteLLM Rust / rust-test (push) Has been cancelled
LiteLLM Rust / rust-wheel (push) Has been cancelled
Terraform Modules / fmt, validate, test (aws) (push) Has been cancelled
Terraform Modules / fmt, validate, test (gcp) (push) Has been cancelled
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	litellm/proxy/management_helpers/utils.py
#	tests/test_litellm/proxy/management_helpers/test_management_helpers_utils.py
2026-09-18 23:05:03 +00:00
yucheng
458943a7ac chore: merge main into litellm_prompt_injection_llm_api_check_dispatch
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 23:02:31 +00:00
yucheng-berri
711a1924d4
Merge pull request #41583 from BerriAI/litellm_applied_guardrails_blocker
* fix(proxy): name the blocking guardrail in x-litellm-applied-guardrails

When a guardrail hook raises, the common ProxyLogging dispatch (sequential and parallel pre_call, pipeline block, during_call and post_call metrics wrapper, streaming iterator wrapper) now records that guardrail in applied_guardrails before re-raising, and pre_call_hook folds request-declared guardrails in on its raising path. Buffered streams rebuild their response headers after the first chunk so a post_call block reached while buffering carries the blocker too

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

* fix(proxy): attribute only the raising layer in stream and pipeline blocks

The streaming wrapper caught every exception crossing its boundary and named its own
callback, so a block by an inner guardrail or a provider stream failure also named every
outer guardrail. The wrapper now runs the hook over an upstream boundary that remembers
the exception it raised, and skips attribution when the same exception passes through

Pipeline blocks converted from SensitiveDataRouteException or ModifyResponseException into
a generic guardrail_pipeline_error now still record the blocking step's guardrail

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

* refactor(proxy): drop explanatory docstrings from the stream attribution helpers

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

---------

Co-authored-by: yucheng <yucheng@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-18 16:00:27 -07:00