Repository navigation
Conversation
…output bucket Bedrock batch jobs write their results to s3_output_bucket_name when it differs from the input bucket, but the file-content retrieval path validated the file id only against the input bucket (s3_bucket_name). A deployment that configures a separate output bucket therefore could not retrieve its own batch outputs: the id validated against the input bucket and was rejected as a foreign bucket. Resolve the trusted output bucket alongside the input bucket from the immutable credential snapshot (or AWS_S3_OUTPUT_BUCKET_NAME), and try the file id against each configured bucket, returning the first that validates. The SSRF guard is preserved: only server-configured buckets are tried, never a request param, and an id outside both is still rejected.
…pshot The output-bucket retrieval fix only worked via the AWS_S3_OUTPUT_BUCKET_NAME env var, never via per-model s3_output_bucket_name config. The proxy builds the trusted snapshot that retrieval validates against by round-tripping a deployment's litellm_params through CredentialLiteLLMParams in get_deployment_credentials_with_provider, and that strict allowlist did not declare s3_output_bucket_name, so the field was silently dropped before retrieval saw it (same trap as azure_ad_token in BerriAI#30235). The snapshot branch of get_configured_s3_bucket_names was therefore dead in the model-routing path and output-bucket file ids were rejected as foreign. Declaring s3_output_bucket_name on CredentialLiteLLMParams lets it survive into the snapshot, so the existing multi-bucket validation works for per-model output buckets too. The PR's tests injected the field straight into the MappingProxyType, bypassing this filter, so they passed despite the live gap. _trusted now builds the snapshot through CredentialLiteLLMParams the way the proxy does, and a router-level regression test pins that get_deployment_credentials_with_provider preserves the output bucket. Both fail without this change.
Adding s3_output_bucket_name to CredentialLiteLLMParams changes the proxy OpenAPI spec, so the generated dashboard types need regenerating to match (Check UI API Types Sync).
Adding s3_output_bucket_name to CredentialLiteLLMParams adds one reportUnknownArgumentType error at each untyped **kwargs construction site of GenericLiteLLMParams repo-wide (~114 sites), which pushed the basedpyright budget just over its ceiling. Typing the key parameter of the get/__getitem__/ __setitem__/__contains__ dict-shim helpers on ModelInfo, GenericLiteLLMParams, LiteLLM_Params, and Deployment removes the unknown-argument errors at the getattr/setattr/hasattr calls in those bodies, bringing the repo total back under the cap without raising any other rule.
…hout include_usage Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…nly chunk Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…nistically Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ponses API
Clients send tool_choice as {"type": "auto"} (Cursor on chat completions,
Claude Code's Anthropic tool_choice shape). validate_chat_completion_tool_choice
recognized that shape but returned it verbatim, and the chat -> Responses API
bridge only normalized {"type": "function"}, so the wrapper reached OpenAI and
the whole call failed with:
Invalid value: 'auto'. Supported values are: 'code_interpreter', ...,
'web_search_preview', ... (param: tool_choice.type)
That broke every tool call, web search included, on responses-mode models.
Unwrap {"type": "auto"|"none"|"required"} to the bare string at both layers:
the chat completions validation boundary where the shape is first accepted,
and the Responses API bridge that owns the Responses tool_choice contract.
No OpenAI surface accepts the object form for these values, so the previous
passthrough only deferred the 400 to the provider.
…adapter
OpenAI emits a reasoning output item on every reasoning turn, but only emits
reasoning_summary_text deltas when a summary was requested and actually
produced. The Anthropic /v1/messages Responses stream adapter opened the
thinking content block eagerly on response.output_item.added, so a summary-less
reasoning item surfaced as {"type": "thinking", "thinking": ""}. Clients persist
that in their session transcript and replay it on the next turn; an Anthropic
model then rejects the request with "each thinking block must contain thinking",
which is what users hit when a resumed session falls back to the default
Anthropic model.
Open the thinking block on the first non-empty summary delta instead, and only
emit content_block_stop for items that actually have an open block.
create_websocket_passthrough_route existed but /openai and /openai_passthrough only registered HTTP methods, so WS upgrades were rejected at routing. Add catch-all websocket routes mirroring the HTTP passthrough target construction. Fixes BerriAI#36088
Forward realtime model query string, keep OPENAI_API_KEY (forward_headers=False), satisfy ruff strict gates, sync dashboard OpenAPI types, and cover the behavior in tests.
…solver --use_v2_migration_resolver had no env var, and the Helm migrations job runs prisma_migration.py, which calls run_server with a fixed argv. There was no seam to pass the flag, so a Helm install could not reach the v2 resolver at all. Reading it from the environment makes the existing flag configurable from a deployment.
…ged batch uploads
…ns endpoint Surfaces deprecation_date metadata that is already shipped in model_prices_and_context_window.json so operators get lead time to migrate before a provider sunsets a model. - New helper litellm.proxy.common_utils.model_deprecation classifies the router's configured models into deprecated / imminent / upcoming buckets. Resolution order: explicit model_info.deprecation_date > model_info.base_model > litellm_params.model. - New GET /model/deprecations (and /v1/model/deprecations) endpoint returns a ModelDeprecationResponse, gated by user_api_key_auth. - New AlertType.model_deprecation_warnings (in DEFAULT_ALERT_TYPES) plus SlackAlerting.send_model_deprecation_alert dispatches a Slack message for deprecated/imminent models. Severity is High when any model is already past its date, Medium when only imminent. - ProxyLogging.startup_event schedules a daily background task (_run_scheduled_deprecation_check) when the alert type is enabled. The interval is configurable via LITELLM_MODEL_DEPRECATION_CHECK_INTERVAL and the warn window via LITELLM_MODEL_DEPRECATION_WARN_DAYS. - Tests: 16 unit tests for the helper plus 4 for the Slack hook in tests/test_litellm/. Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
…tion The proxy documentation lives in BerriAI/litellm-docs and any new env key flagged by os.getenv() must be added there before the test_env_keys.py CI check passes. Rather than fork the docs repo for two niche tunables, hard-code the defaults: - DEFAULT_DEPRECATION_WARN_DAYS = 30 (already overridable per-request via ?warn_within_days=N on /model/deprecations). - DEFAULT_DEPRECATION_CHECK_INTERVAL_SECONDS = 24h. Both can still be raised as env-var follow-ups together with their docs update if operators ask for it. Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
Drops Any-typed router plumbing, immutable bucketing, generated dashboard API types, and adds endpoint plus resolution-fallback tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The daily loop no longer captures the startup Router or bails when the alert type is off at startup, so config reloads take effect Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…gured Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…to sonner (BerriAI#37207) * refactor(ui): move dashboard toasts from antd message/notification onto sonner Add lib/toast.ts as the single toast surface (success/info/warning/error/ fromError/dismiss) backed by sonner, with a <Toaster /> in the root layout. fromError titles a toast from the proxy error type or the HTTP status instead of matching prose phrases, and shows the extracted proxy message as the description. MessageManager and NotificationManager become thin facades over lib/toast so the ~250 existing call sites keep working; the mutable antd instance setters, setMessageInstance/setNotificationInstance, and the antd App/message/ notification providers in AntdGlobalProvider are gone. Prunes the eslint suppression baseline accordingly. * test(ui): mock the MessageManager seam in the Fallbacks tests and drop toast doc comments AddFallbacks and FallbackSelectionForm asserted on a mocked antd message spy that MessageManager no longer calls; they now mock the facade the components import. Also removes the explanatory comments Greptile flagged in lib/toast.ts and both facades. * fix(ui): keep NotificationManager's antd config-object contract on the sonner facade success/info/warning/error accept the { message, description, duration } object form again (CreateMCPServer's admin-review notice uses it) and fromBackend keeps its extra.duration seconds argument, both mapped onto lib/toast. Prunes stale suppressions picked up by the rebase. * feat(ui): read the proxy error type and code out of JSON envelopes embedded in string errors Legacy networking helpers throw new Error(responseText) and callers prefix that text, so the envelope arrives as a substring. fromError now parses the first embedded JSON object for type/code and shows the unwrapped message in its place, so those toasts get a status title (Request Error, Not Found) and a readable description instead of raw JSON.
…il_usage_units feat(guardrails): track bedrock guardrail usage units per invocation
The daily guardrail metrics and usage-unit upserts are non-idempotent increments, but the retry loop re-sent every failed row on any exception. An ambiguous post-send failure such as a read timeout after the write had already committed therefore stacked a second increment and inflated the billable unit totals served by the guardrail usage endpoints. Retry only DB_RETRY_SAFE_ERROR_TYPES (httpx.ConnectError), the same rule the spend writer and autorouter rollup use for increment upserts, and log any other failure once as terminal for that row while the rest of the batch still lands. Follows up BerriAI#37225
… missing
GET /guardrails/usage/overview and GET /guardrails/usage/detail/{id} 500ed on a
database that has not applied 20260817143646_add_daily_guardrail_usage_units yet
(pip installs on litellm-proxy-extras 0.4.86 with DISABLE_SCHEMA_UPDATE=true).
Both endpoints now return their metrics with empty units and log one warning
until the migration lands.
…nto request metadata (BerriAI#37233) * fix(proxy): strip callback credentials from the auth object stamped into request metadata * style(proxy): drop the restating half of the stamp-site comment * test(proxy): pin that the stamped auth copy carries header-derived identity
…pers Annotate _prime_oauth_metadata_discovery_for_servers and _reconcile_oauth_discovery_slots_for_servers with Sequence and snapshot registry views with tuple() at the call sites. This drops the Iterable addition to the collections.abc import, restoring that line to its base spelling so the branch merges cleanly with litellm_internal_staging, which adds Mapping on the same line
…_retry_safe_errors fix(guardrails): retry usage upserts only on connection errors
…p-oauth-startup-discovery fix(mcp): oauth discovery must not cause outages
…riAI#36850) The ChatUI playground test helper looked up the model combobox with a synchronous getByPlaceholderText. That control renders its placeholder from the model-loading flag, so the text is "Loading models..." until the mocked fetch resolves, and the element the helper wants does not exist yet. Under a loaded full-suite run the query could land inside that window and fail with "Unable to find an element with the placeholder text of: Select a Model", while the same test passed in isolation every time. Switch the helper to findByPlaceholderText so it waits for the control to come back after loading.
…hadcn (BerriAI#37262) * refactor(ui): migrate budget and skill forms to react-hook-form and shadcn Moves three dashboard forms off antd Form onto react-hook-form plus the shared shadcn field kit, and onto semantic color tokens so they render correctly in dark mode. The submitted request bodies are unchanged. Budget create and edit previously relied on antd InputNumber precision={2}, which rounds the submitted value rather than only the display. That rounding is now an explicit shared helper so the wire payload stays identical, and the helper carries unit tests covering key presence, null passthrough, negatives and non-finite input. Characterization tests for both budget modals were written against the antd implementation first and pass unchanged against the migrated components, which is what pins the payload. They are named .integration.test.tsx per the dashboard test tiers, with the pure rounding logic unit tested separately. * fix(ui): keep collapsed Optional Settings values so reopening does not lose them react-hook-form shouldUnregister deletes a field's value when its section unmounts, so typing a budget, collapsing Optional Settings and reopening it submitted the seeded default instead of what was typed. antd reported only mounted fields in onFinish but preserved their values in its store, so the two behaviours have to be reproduced separately. Drop shouldUnregister, drive the section from controlled state, and blank the section's fields at submit while it is closed. Seed the edit form from the five form fields rather than the whole budget record, which shouldUnregister had been masking.
…dcn (BerriAI#37266) Moves CreateTagModal, the tag detail editor and MemoryEditModal off antd Form onto react-hook-form with the shadcn field kit, and onto semantic colour tokens so the pages follow the dashboard theme. Submitted payloads are unchanged and pinned by tests. The collapsible budget sections keep values typed into them when collapsed and reopened, matching what antd's store did, rather than reverting to the seeded default.
The gpt-5.6 family (luna/sol/terra) is only registered under `bedrock_mantle/openai.gpt-5.6-*`. Calling these models through the regular Bedrock Converse route (`bedrock/converse/us.openai.gpt-5.6-*`, which is what SigV4 / assumed-role setups need) silently loses tool calling and reasoning. `AmazonConverseConfig.get_supported_openai_params()` appends `tools` only when the base model starts with anthropic/mistral/cohere/ meta.llama3-1+/amazon.nova, or when `supports_function_calling()` resolves True from the cost map. `get_base_model()` reduces the model to `openai.gpt-5.6-luna`, which matches no prefix and has no cost map entry, so `tools`, `tool_choice`, `thinking` and `reasoning_effort` are all dropped. With `drop_params: true` the call returns 200 and the model answers as if no tools were offered. Bedrock itself supports tool use on these models: a direct `bedrock-runtime converse` call with `--tool-config` returns `stopReason: tool_use`. Adds bare, `us.` and `global.` prefixed entries with `litellm_provider: bedrock_converse` and `mode: chat`, matching how every other Bedrock model is keyed (e.g. `us.anthropic.claude-sonnet-5` and the existing `openai.gpt-oss-*` entries). Pricing mirrors the published `bedrock_mantle/` values. The `bedrock_mantle/` entries are left untouched. Verified against 1.97.0 with the patched map: all three now report tools, tool_choice and reasoning_effort as supported. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Too many files changed for review (446 files, 100 file limit). Bypass the limit by tagging |
|
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
| timeout=timeout, | ||
| max_retries=optional_params.max_retries, | ||
| ) | ||
| elif custom_llm_provider == "bedrock": |
There was a problem hiding this comment.
Medium: Bedrock batch cancellation lacks ownership enforcement
The proxy cancellation endpoint can reach this branch with a caller-supplied raw Bedrock job ARN, and require_managed_files—the only ownership gate for batch IDs—defaults to false. An authenticated user who obtains another tenant's ARN can therefore stop that tenant's job using the proxy's AWS credentials; require an owned managed batch ID for this destructive operation or verify the stored batch owner before calling Bedrock.
| ) | ||
| await websocket.accept(subprotocol=requested_subprotocols[0] if requested_subprotocols else None) | ||
|
|
||
| await websocket_passthrough_request( |
There was a problem hiding this comment.
High: OpenAI WebSocket usage bypasses virtual-key budgets
A caller with an unrestricted but finite-budget virtual key can consume OpenAI realtime or Responses WebSocket usage without that spend being recorded. The generic helper logs the model as unknown, receives the route path rather than an OpenAI URL for provider detection, and supplies no fixed request cost, so its success path does not calculate a response_cost; route this through usage-aware OpenAI WebSocket accounting and apply the resulting cost to the caller's budget.
| -H 'Authorization: Bearer sk-1234' | ||
| ``` | ||
| """ | ||
| return collect_model_deprecations(llm_router=llm_router, warn_within_days=warn_within_days) |
There was a problem hiding this comment.
Low: Restricted keys can enumerate inaccessible deployments
Any authenticated key can call this endpoint, and collect_model_deprecations iterates the complete router model list. A model-restricted or tenant-scoped caller can therefore learn aliases, underlying model identifiers, and providers for deprecated deployments it cannot access, including other teams' BYOK deployments; filter the snapshot using the same model-access and team-scope checks used by the model-info endpoint, or restrict this endpoint to administrators.
PR overviewThis pull request adds GPT-5.6 cost-map entries for requests made through the Bedrock Converse integration. Three security issues remain open, and none have been addressed yet. The most significant allows finite-budget virtual keys to use OpenAI WebSocket APIs without usage being charged against their budgets, enabling uncontrolled provider spend. Additional concerns include cross-tenant Bedrock batch cancellation when a job ARN is known and disclosure of deployment metadata to restricted users. Open issues (3)
Fixed/addressed: 0 · PR risk: 7/10 |
Setting supports_prompt_caching (plus cache_creation / cache_read costs) made LiteLLM inject cachePoint blocks into Converse requests, and Bedrock rejects them for these models: BedrockException - "You invoked an unsupported model or your request did not allow prompt caching." That broke plain chat as well as tool calls, so the entries claimed a capability the Converse route does not have. The bedrock_mantle/ entries keep their caching fields; only the new bedrock_converse ones drop them. Tool calling, tool_choice and reasoning_effort still resolve. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
With supports_reasoning set, the Converse transformation translated reasoning_effort into Anthropic-shaped `thinking` in additionalModelRequestFields, and the OpenAI models reject it: "code":"unknown_parameter","message":"Unknown parameter: 'thinking'" Every request carrying reasoning_effort returned 400. Before these entries existed the param was silently dropped, so this was a regression. Dropping the flag restores that drop-and-continue behaviour. Reasoning still happens server-side; it is just not steerable through the Converse route until the transformation learns the OpenAI shape. Tool calling and tool_choice are unaffected: they gate on supports_function_calling. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Withdrawing this PR. The capability flags in it are wrong: supports_prompt_caching causes Bedrock to reject Converse requests for these models ("You invoked an unsupported model or your request did not allow prompt caching"), and supports_reasoning makes reasoning_effort translate to Anthropic-shaped |
…ck runtime
GPT-5.6 Sol, Terra and Luna reached the bedrock-runtime data plane on
2026-08-17, separately from the existing bedrock-mantle path. On runtime
they are served only through cross-region inference profiles, so
bedrock/us.openai.gpt-5.6-* had no cost map entry and fell through to the
Invoke route, which rewrites the token cap to max_tokens and is rejected
as unsupported_parameter on both /v1/chat/completions and /v1/responses.
Register the Geo and Global profiles as bedrock_converse so routing
reaches Converse, which AWS documents and serves for these models, and
price each profile from its own published rate table. No bare key: the
control plane reports inferenceTypesSupported INFERENCE_PROFILE with no
on-demand throughput, so a bare id is not invocable.
Declare the published cache-read and cache-write rates. Bedrock rejects
an explicit cachePoint block for these models, so supports_prompt_caching
stays off, but it caches long prefixes implicitly and reports the cache
tokens in usage either way. Without the cost fields a cache-read turn
bills only its uncached tokens: measured against live Bedrock, a
15609-token cached prefix came to $0.000176 instead of $0.00876095.
Clients that resend a long prefix every turn are the worst affected.
Reasoning stays unadvertised. Converse rejects the Anthropic-shaped
thinking block LiteLLM sends for reasoning_effort; the shape these models
accept is additionalModelRequestFields {"reasoning": {"effort": ...}},
which needs a transform change tracked by BerriAI#34105. Advertising it without
that change is what made the earlier attempt in BerriAI#37307 fail.
Problem
The gpt-5.6 family (luna / sol / terra) is registered in the cost map only as
bedrock_mantle/openai.gpt-5.6-*. Calling these models over the regular Bedrock Converse route silently loses tool calling and reasoning.That route matters because
bedrock_mantleauthenticates with a Bearer Bedrock API key, whilebedrock/converse/...goes through SigV4 and honoursaws_role_name. Anyone doing cross-account role assumption (per-tenant billing, tag routing) has to use the Converse route.Root cause
AmazonConverseConfig.get_supported_openai_params()appendstoolsonly whenbase_modelstarts withanthropic/mistral/cohere/meta.llama3-1|3-2|3-3/meta.llama4/amazon.nova, or whensupports_function_calling()resolves True from the cost map.BedrockModelInfo.get_base_model("bedrock/converse/us.openai.gpt-5.6-luna")returnsopenai.gpt-5.6-luna, which matches no prefix and has no cost map entry. Sotools,tool_choice,thinkingandreasoning_effortare all excluded, and withdrop_params: truethe request returns 200 with the model answering as if no tools were offered.Reproduced on 1.97.0:
Through a proxy,
tool_choice: "required"also gets dropped:finish_reasoncomes backstopwithtool_calls: null, whileclaude-sonnet-5with the identical schema returnsfinish_reason: tool_calls.This is not a Bedrock limitation. A direct call works:
Fix
Adds bare,
us.andglobal.prefixed entries withlitellm_provider: bedrock_converseandmode: chat. This matches how every other Bedrock model is keyed, includingus.anthropic.claude-sonnet-5and the existingopenai.gpt-oss-120b-1:0entries. Pricing mirrors the publishedbedrock_mantle/values, including the above-272k tiers and cache costs.Data-only change. No logic touched, and the existing
bedrock_mantle/entries are unchanged, so the Responses-path behaviour is unaffected.Verification
With the patched map on 1.97.0:
bedrock/converse/us.openai.gpt-5.6-lunabedrock/converse/us.openai.gpt-5.6-solbedrock/converse/us.openai.gpt-5.6-terraget_model_info()resolveslitellm_provider: bedrock_converse,mode: chat, and the correct per-token pricing. Bothmodel_prices_and_context_window.jsonand the bundled backup are kept in sync.🤖 Generated with Claude Code