Skip to content

fix(bedrock): send Converse extra_body fields instead of a literal extra_body object - #50964

Closed
norkelbyte wants to merge 5 commits into
BerriAI:mainfrom
norkelbyte:litellm_bedrock_converse_flatten_extra_body
Closed

norkelbyte wants to merge 5 commits into
BerriAI:mainfrom
norkelbyte:litellm_bedrock_converse_flatten_extra_body

Conversation

@norkelbyte

@norkelbyte norkelbyte commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Sending extra_body to an OpenAI model on Bedrock Converse failed every time with Bedrock's Unknown parameter: 'extra_body' 400, with or without drop_params. LiteLLM put the whole extra_body object into the Bedrock request as one field instead of sending the fields inside it

Now the fields inside extra_body are added to the Bedrock request, so instructions and previous_response_id reach the model from a request, a stream, a deployment config or /v1/messages. An extra_body that isn't a JSON object is dropped under drop_params and answers a 400 without it

Original

TLDR

Problem this solves:

  • Bedrock Converse answers 400 for any extra_body
  • drop_params does not help, the 400 comes from Bedrock

How it solves it:

  • Fields inside extra_body are added to the Bedrock request
  • A non-object extra_body drops under drop_params, else 400
Decisions and alternatives
  1. Send the fields instead of dropping them. Dropping extra_body under drop_params was the other option, but Bedrock accepts these fields once they are sent on their own (a direct Converse call with instructions answers 200 in French), so dropping them would throw away what the caller asked for
  2. An extra_body field wins over a top-level field with the same name. This matches the OpenAI SDK and how LiteLLM already treats extra_body for providers that use its shared HTTP handler
  3. Fields Bedrock does not know still go to Bedrock, which answers its own 400. Filtering them against a list was the alternative, but that list would go stale every time Bedrock adds a model field
  4. An extra_body that is not a JSON object follows the drop_params convention. It is dropped when drop_params is on and answers a 400 that names the problem when it is off
  5. The extra_body fields are merged in once, in the Converse transform after LiteLLM has read its own keys and before the message checks run, so a tools or guardrailConfig inside it counts the same as a top-level one. A tool follow-up keeps its tool blocks, and the latest user message is marked as the guarded text and keeps its cache points under the same rule a top-level guardrailConfig gets. Strict tools inside extra_body get the same retry without strict, a tool call the model writes as text is matched against the extra_body tools, and a native output retry sends the same filtered extra_body again. An output_config inside it replaces the one reasoning_effort set and gets the same effort cap. The merge builds a new dict, so the caller's params never keep the fields or the internal marker
  6. The converse_like route is unchanged. It already merges extra_body at the top level through the shared HTTP handler
  7. extra_body fields join the params after LiteLLM maps the OpenAI ones, so they skip that mapping and drop_params. An extra_body tool_choice: "required" goes to Bedrock as written and gets Bedrock's own 400, while a top-level one becomes {"any": {}}. Running extra_body through the OpenAI mapping was the other option, but the shared HTTP handler adds extra_body after the transform for every other provider, and the OpenAI SDK sends it as raw body fields, so OpenAI params belong at the top level
  8. model and the keys a deployment lists in additional_drop_params are removed from extra_body, the same way the OpenAI-compatible path removes them. Sending them on was the other option, but additional_drop_params is how an admin blocks a field, and Bedrock rejects a model field in the request
  9. extra_body cannot change how LiteLLM itself handles the call. Keys LiteLLM reads before the transform, such as stream, come only from the top level, so the same keys inside extra_body go to Bedrock as request fields, and Bedrock answers its own 400 when one conflicts with a field LiteLLM set, as stream does. Letting extra_body set them was the other option, but then a body field could switch a call to streaming or change where and how LiteLLM sends it
  10. A tools field or a config block such as guardrailConfig or performanceConfig of the wrong type answers a 400 that names the field, even under drop_params, the same as at the top level. Dropping it as decision 4 does was the other option, but the call would then run and bill without the tools or guardrail it asked for
  11. extra_body.tools keeps the JSON tool LiteLLM adds for response_format, as a top-level tools does. Replacing it was the other option, but then Llama answers with a tool call instead of JSON

User Flow

Before: a developer calls an OpenAI model on Bedrock with tools, reasoning and extra_body, and every call fails

  1. They send POST http://localhost:4000/v1/chat/completions for a Bedrock OpenAI model with tools, "reasoning_effort": "low" and "extra_body": {"instructions": "Answer in French."}
  2. The proxy answers 400 Unknown parameter: 'extra_body' with or without drop_params, and so do streaming, a config extra_body, /v1/messages and a string extra_body

After: the same request answers 200 and the model follows the instructions

  1. They send the same request
  2. The proxy answers 200 in French, which shows instructions reached the model, and so do streaming, the config extra_body and /v1/messages
  3. A string extra_body answers 200 with drop_params and a 400 extra_body must be a JSON object, got str without it

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Each leg runs two proxies with --num_workers 2 sharing one Redis and Postgres, and cases alternate between them. Before is main at the merge base 757041a, after is this branch at d9c550c. Every call hits real us-east-1 Bedrock, and tools plus reasoning_effort keep gpt-6.2-sol on Converse

config.yaml
model_list:
  - model_name: bedrock-gpt-6.2-sol
    litellm_params:
      model: bedrock/global.openai.gpt-6.2-sol
      aws_region_name: us-east-1
      drop_params: true
  - model_name: bedrock-gpt-6.2-sol-strict
    litellm_params:
      model: bedrock/global.openai.gpt-6.2-sol
      aws_region_name: us-east-1
  - model_name: bedrock-gpt-6.2-sol-config-extra-body
    litellm_params:
      model: bedrock/global.openai.gpt-6.2-sol
      aws_region_name: us-east-1
      extra_body:
        instructions: "Answer in French."
  - model_name: bedrock-claude-opus-5-5
    litellm_params:
      model: bedrock/converse/us.anthropic.claude-opus-5-5
      aws_region_name: us-east-1
  - model_name: bedrock-gpt-6.2-sol-drop-store
    litellm_params:
      model: bedrock/global.openai.gpt-6.2-sol
      aws_region_name: us-east-1
      drop_params: true
      additional_drop_params: ["store"]
  - model_name: bedrock-qwen3-32b
    litellm_params:
      model: bedrock/converse/qwen.qwen3-32b-v1:0
      aws_region_name: us-east-1
  - model_name: bedrock-mistral-large-3
    litellm_params:
      model: bedrock/converse/mistral.mistral-large-3-675b-instruct
      aws_region_name: us-east-1
      drop_params: true
  - model_name: bedrock-llama4-maverick
    litellm_params:
      model: bedrock/converse/us.meta.llama4-maverick-17b-instruct-v1:0
      aws_region_name: us-east-1
litellm_settings:
  cache: true
  cache_params:
    type: redis
    mode: default_off
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
  database_url: os.environ/DATABASE_URL
jq filters
F_CHAT='if .error then {code: .error.code, error: .error.message} else {finish_reason: .choices[0].finish_reason, content: .choices[0].message.content, tool_calls: [.choices[0].message.tool_calls[]?.function | "\(.name) \(.arguments)"]} end'
F_MSG='if .error then {code: .error.code, error: .error.message} else {stop_reason, text: [.content[] | select(.type == "text") | .text], tool_use: [.content[] | select(.type == "tool_use") | .name]} end'
F_RESP='if .error then {code: .error.code, error: .error.message} else {status, text: [.output[] | select(.type == "message") | .content[].text], function_calls: [.output[] | select(.type == "function_call") | .name]} end'
F_STREAM='if .error then "error \(.error.code): \(.error.message)" else (.choices[0].delta.content // empty) end'
F_SPEND='(if type == "array" then .[0] else . end) | {model, spend, prompt_tokens, completion_tokens, standard_rate: (.prompt_tokens * 5e-07 + .completion_tokens * 1.5e-06), priority_rate: (.prompt_tokens * 8.8e-07 + .completion_tokens * 2.63e-06)}'
F_CHUNK='{finish_reason: .choices[0].finish_reason, content: .choices[0].delta.content, usage: (.usage != null), service_tier}'
Case Before (757041a) After (d9c550c)
extra_body instructions, with drop_params 400 unknown extra_body 200, in French
Same, without drop_params 400 unknown extra_body 200, in French
Top-level instructions (control) 200, in French 200, in French
extra_body previous_response_id 400 unknown extra_body Bedrock's own not found
extra_body store: null 400 unknown extra_body 200
Streaming, extra_body instructions 400 unknown extra_body 200, streamed in French
Deployment config extra_body 400 unknown extra_body 200, in French
/v1/messages, extra_body instructions 400 unknown extra_body 200, in French
/v1/responses (control) 200, in French 200, in French
String extra_body, with drop_params 400 unknown extra_body 200, dropped
String extra_body, without drop_params 400 unknown extra_body 400 must be a JSON object
Opus 5.5 tool follow-up, tools only in extra_body 400 extra inputs 200, uses the tool result
Opus 5.5, reasoning_effort plus extra_body effort 400 extra inputs 200
store: true in additional_drop_params 400 unknown extra_body 200, in French
extra_body with a model field 400 unknown extra_body 200, in French
Qwen3, extra_body stream: true, not streaming 200, not streamed 400 from Bedrock, stream conflicts
Qwen3, streaming, extra_body stream: false 200, streamed 400 from Bedrock, stream conflicts
Qwen3, string extra_body 200, extra_body ignored 400 must be a JSON object
Mistral, extra_body tools: {}, with drop_params 200, extra_body ignored 400 tools must be a list
Mistral, string extra_body performanceConfig 200, extra_body ignored 400 must be a JSON object
Llama 4, extra_body tools 400 from Bedrock, extra_body key 200, JSON
Llama 4, top-level tools (control) 200, JSON 200, JSON
Cache on, extra_body French, first 400 unknown extra_body 200, in French
Cache on, same request again 400 unknown extra_body 200, cache hit, same id, $0
Cache on, same request without extra_body 200, English 200, English, new id
Mistral, streaming, extra_body serviceTier priority, billed 1.25e-05, standard rate 2.195e-05, priority rate
Mistral, streaming priority, chunks the client gets 3 chunks, finish last 3 chunks, finish last
Same, with include_usage usage chunk, no tier usage chunk names priority

After (d9c550c)

extra_body instructions, with drop_params

  1. Send the request
$ curl -s http://127.0.0.1:31522/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"bedrock-gpt-6.2-sol","reasoning_effort":"low","extra_body":{"instructions":"Answer in French."},"tools":[{"type":"function","function":{"name":"get_weather","description":"Get the weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"messages":[{"role":"user","content":"Say hello in one short sentence."}]}' | jq -c "$F_CHAT"
{"finish_reason":"stop","content":"Bonjour à toi !","tool_calls":[]}

Mistral, streaming, extra_body serviceTier priority, billed

Stream, then read the spend row
  1. Stream the request
$ curl -sN http://127.0.0.1:31522/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"bedrock-mistral-large-3","max_tokens":64,"stream":true,"stream_options":{"include_usage":true},"extra_body":{"serviceTier":{"type":"priority"}},"messages":[{"role":"user","content":"Say hello in one short sentence."}]}' > stream.txt; sed -n 's/^data: //p' stream.txt | grep -v '^\[DONE\]' | jq -rj "$F_STREAM"; echo
"Hey there!"
  1. Read its spend row
$ ID=$(sed -n 's/^data: //p' stream.txt | head -1 | jq -r .id); for i in $(seq 1 24); do ROW=$(curl -s "http://127.0.0.1:31522/spend/logs?request_id=$ID" -H "Authorization: Bearer $LITELLM_MASTER_KEY"); [ "$(echo "$ROW" | jq 'if type == "array" then length else 0 end')" -gt 0 ] && break; sleep 5; done; echo "$ROW" | jq -c "$F_SPEND"
{"model":"bedrock/converse/mistral.mistral-large-3-675b-instruct","spend":0.00002195,"prompt_tokens":10,"completion_tokens":5,"standard_rate":1.2499999999999999e-05,"priority_rate":2.1949999999999998e-05}

Before, the same stream billed 0.0000125, the standard rate, because Mistral ignored extra_body at base

Same, with include_usage

Every chunk the client gets
  1. Send the request
$ curl -sN http://127.0.0.1:31522/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"bedrock-mistral-large-3","max_tokens":64,"stream":true,"stream_options":{"include_usage":true},"extra_body":{"serviceTier":{"type":"priority"}},"messages":[{"role":"user","content":"Say hello in one short sentence."}]}' | sed -n 's/^data: //p' | grep -v '^\[DONE\]' | jq -c "$F_CHUNK"
{"finish_reason":null,"content":"","usage":false,"service_tier":null}
{"finish_reason":null,"content":"Hi there! 😊","usage":false,"service_tier":null}
{"finish_reason":"stop","content":null,"usage":false,"service_tier":null}
{"finish_reason":null,"content":null,"usage":true,"service_tier":"priority"}

Before, the same four chunks came back and the usage chunk had no service_tier

Before (757041a)

extra_body instructions, with drop_params

Send the request
  1. Send the request
$ curl -s http://127.0.0.1:29422/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' -d '{"model":"bedrock-gpt-6.2-sol","reasoning_effort":"low","extra_body":{"instructions":"Answer in French."},"tools":[{"type":"function","function":{"name":"get_weather","description":"Get the weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}],"messages":[{"role":"user","content":"Say hello in one short sentence."}]}' | jq -c "$F_CHAT"
{"code":"400","error":"litellm.BadRequestError: BedrockException - {\"message\":\"The model returned the following errors: Unknown parameter: 'extra_body'.\"}\n\nLiteLLM: model group 'bedrock-gpt-6.2-sol' failed with the error above. No fallback was attempted."}

Every other case is in the gist, before and after

/live-pr-risk (d6a0835)

Base and head ran 127 cases on real Bedrock across six model families. Four paths that worked at base broke at d6a0835, and all four are fixed. At 0af8eaf, 7 streamed cases on five providers billed at the base rate, except the extra_body serviceTier one, which now bills at priority. Main has since shipped its own cache and tier fixes, which this branch takes, and those cases pass at d9c550c

Breaking, backward incompatible, regression risk, dependency graph, not verified

Breaking

  1. With the response cache on, a plain request can get an answer that another request's extra_body shaped. After one call with extra_body instructions "Answer in French.", head served that French reply from cache to the same request without extra_body, where base answered it in English. The cache key leaves out extra_body, which did no harm while Converse ignored it or failed. Fixed on main by fix(caching): key the response cache on extra_body by default #53898, which this branch now takes
  2. A streamed request with extra_body.serviceTier priority goes to Bedrock at priority but is billed at the standard rate (Mistral 5.9e-05 where priority is about 1.03e-04). ConverseStream reports the served tier only in its last metadata event, which LiteLLM dropped. Without streaming it bills correctly. Fixed on main by fix(bedrock): bill ConverseStream at the served tier #52565, which this branch now takes
  3. A non-list extra_body.tools such as {} or false goes out with no tools, so Bedrock answers 200 and bills. Then the response parsing added in d6a0835 rejects it, and the client gets a 500 with spend 0 recorded. Mistral and Qwen3 answered 200 at base. A string answers 400 with a Python traceback in the message. Fixed in 7323aea
  4. A string extra_body.performanceConfig or guardrailConfig answers 500 before any Bedrock call, where Mistral answered 200 at base. The same string at the top level already answers 500 on both trees. Fixed in 7323aea

Backward incompatible

  1. Without drop_params, a non-object extra_body answers 400 before any Bedrock call. Mistral ignored it at base and answered 200. This is decision 4
  2. Models that ignored extra_body at base now get Bedrock's 400 for a field it rejects, such as stream on Qwen3. This is decisions 3 and 9
  3. Unknown extra_body fields reach Bedrock under drop_params and get its 400, the same as an unknown top-level field. This is decision 3
  4. On Mistral, extra_body fields used to be thrown away and now take effect. They win over top-level ones (temperature 0.1 over 0.9), and a deployment extra_body is now sent. This is decision 2
  5. extra_body fields skip the OpenAI param mapping, so top_p goes to additionalModelRequestFields, and a temperature on Sonnet 5.5 with reasoning gets Bedrock's 400, as it did at base. This is decision 7
  6. extra_body.guardrailConfig: null removes the deployment guardrail while the message still goes out as guarded content, so Bedrock answers 400 on Claude and Mistral, which answered 200 at base. A top-level null keeps the deployment value. It fails closed. This is decisions 2 and 3
  7. test_internal_params_never_reach_provider_body in tests/integration/providers/test_internal_params_wire.py fails its 4 Converse cases on head and passes on base, because it still reads the custom key under additionalModelRequestFields.extra_body. This is decision 1, and the test needs the flat path in this PR before CircleCI on main runs it. Fixed in 7323aea

Regression risk

The buffered stream fallback was not triggered, since it needs a principal that is denied streaming. It cleans extra_body the same way as the native output and strict tools fallbacks, which replayed correctly live. With response_format plus extra_body.tools, the JSON tool is replaced, so Llama returns a tool call instead of JSON and Nova gets a 400. Neither worked at base, and since 7323aea extra_body.tools keeps the JSON tool as a top-level tools does

Dependency graph

Dependent Status
Chat completions, Converse verified live
Streaming verified live
/v1/messages, /v1/responses verified live
Deployment extra_body verified live
additional_drop_params verified live
Router fallback verified live
Native and strict fallbacks verified live
Buffered stream fallback traced only
Response tool parsing fixed in 7323aea
Config blocks fixed in 7323aea
Response cache key fixed on main, #53898
Service tier cost fixed on main, #52565
Stream tier, other providers verified live
Guardrail config verified live
Spend and failure rows verified live
Sync SDK call verified live
Nova invoke unchanged, live
converse_like, pass-through unchanged, traced
Batch, count_tokens not reached, traced
Merge into main matches head

The Bedrock unit tests and 62 other unit files that name Bedrock passed on the tip. Every integration group passed except the stale Converse test in Backward incompatible 7 and 4 load flakes, which passed on rerun on both trees

Since d6a0835

Both trees ran on 2 proxies with 2 workers each, sharing Redis and Postgres. Commands and output are in risk_before_adaa460566.md and risk_after_0af8eaf258.md

Streamed case Base spend Head spend
gpt-6.1-sol, service_tier priority 2.92e-04 2.92e-04
Same, no usage chunk 2.92e-04 1.52e-04
Gemini 3.8 Flash, priority 4.158e-04 4.158e-04
Claude Haiku 5.5 8.4e-06 8.4e-06
Nova 2 Lite invoke, priority 5.467e-05 5.467e-05
Mistral, top-level priority 2.195e-05 2.195e-05
Mistral, extra_body priority 1.25e-05 1.669e-05

Two head streams wrote fewer output tokens. Every rate matches base except the last row

Not verified

The buffered stream fallback, the converse_like route, Bedrock pass-through, batch files and count_tokens. Nested additional_drop_params paths and the router replacing a deployment extra_body with the request's were traced only

Type

🐛 Bug Fix

Caveats (if any)

Low

  • extra_body maxTokens overrides max_tokens, as extra_body does for OpenAI at base
  • Unknown extra_body fields still get Bedrock's own 400 under drop_params (decision 3)
  • Open refactor(bedrock): send Converse chat requests through the shared HTTP client #50495 would undo this fix, and it has a heads-up comment
  • Qwen3 and Mistral now send extra_body fields to Bedrock (decisions 3, 4 and 9)
  • No live run covers the buffered stream fallback, converse_like, batch or count_tokens

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
  • d6a0835 passes /live-pr-risk, and the fixes since pass QA at d9c550c

…tra_body object

Bedrock Converse got the whole extra_body object as one additionalModelRequestFields entry and answered
400 "Unknown parameter: 'extra_body'", with or without drop_params. The fields inside extra_body are now
merged into the request params the same way top-level fields are, with extra_body winning a name clash.
A non-object extra_body is dropped under drop_params and answers 400 without it.
@veria-ai

veria-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

The PR changes Bedrock Converse request transformation to send extra_body fields directly rather than nesting them inside a literal extra_body object.

One issue remains open: an extra_body output-token override can raise the limit sent to Bedrock above the value used for proxy and router admission checks. This allows concurrent requests to exceed configured token-per-minute limits before usage reconciliation, weakening quota enforcement and potentially increasing consumption.

Open issues (1)

Fixed/addressed: 0 · PR risk: 5/10

Reviews

@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@greptile-apps

greptile-apps Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with all previous findings addressed and no new actionable issues found.

Summary

The PR sends fields inside extra_body through the Bedrock Converse request builder instead of forwarding a literal extra_body field.

  • Bedrock Converse sends fields inside extra_body as request fields.
  • Converse responses use streaming mode only for a true flag.

All three previous findings are addressed. No new actionable issues were found.

Reviews (2) · Last reviewed commit: "Merge origin/main into litellm_bedrock_c..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 2 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 43 untouched benchmarks


Comparing norkelbyte:litellm_bedrock_converse_flatten_extra_body (1b526e2) with main (9ba551b)

Open in CodSpeed

@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

… checks

Tools or guardrailConfig sent only inside extra_body are now seen by the
orphaned tool block and guarded text checks, and an extra_body
output_config gets the same effort cap as a top-level one. The merge
builds a new dict, so the caller's params keep neither the fields nor the
internal marker
Main now passes the guarded text call a keeps_cache_marks flag computed from the params. The cache mark checks read the params after the extra_body merge, so a guardrailConfig or tools inside extra_body count the same as top level ones there too
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

…drop routing keys

The extra_body merge stays in the Converse transform, after the handler has read stream,
the AWS keys, endpoint and region from the top level, so extra_body can no longer change
how LiteLLM sends the call. The Converse branch in completion() removes the deployment's
additional_drop_params keys from extra_body before every attempt, the native output
retry included, and the transform also removes model. Strict tools inside extra_body get
the retry without strict, and tool calls written as text are parsed against the
extra_body tools. Adds regression tests for each.
@norkelbyte norkelbyte closed this Nov 11, 2026
…tier, and reject malformed tools and config blocks
@norkelbyte norkelbyte reopened this Nov 11, 2026
**_with_the_response_format_tool(without_extra_body, sent_fields.get("tools")),
}
if "output_config" not in fields:
return {**without_extra_body, **fields}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: Output-token overrides bypass admission limits

A request with max_tokens=32, extra_body={"maxTokens":8192} is accounted for as 32 output tokens by the proxy's _get_explicit_output_cap and router's _otpm_reservation, but this merge replaces the mapped cap and sends inferenceConfig.maxTokens=8192, allowing concurrent calls to overshoot configured TPM/OTPM limits before usage reconciliation. Resolve the effective Converse output limit before admission checks, and clamp or reject overrides of caps injected by the limiter.

@norkelbyte norkelbyte closed this Nov 11, 2026
@norkelbyte

Copy link
Copy Markdown
Contributor Author

Closed to free an open-PR slot. Branch kept. Reopen with gh pr reopen 50964 when ready for final CI and bot reviews

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants