mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
fix(bedrock): strip client_metadata from filter_internal_params
Bedrock Converse with custom application inference profiles rejects any
field in `additionalModelRequestFields` that the underlying inference
profile does not whitelist. Some clients (OpenAI Codex CLI, Claude Code,
others adopting OpenAI`s Responses API conventions) send a top-level
`client_metadata` for run-level telemetry. LiteLLM forwards it via
`additional_request_params`, and the Converse call fails with HTTP 400:
The model returned the following errors: client_metadata: Extra inputs
are not permitted
`drop_params=true` does not cover this case because `client_metadata` is
not a known OpenAI parameter, so it survives the OpenAI-side filtering
and reaches the provider transformation untouched.
Add `client_metadata` to the central `filter_internal_params` set so the
sanitation happens once for every provider path that already calls this
helper (Bedrock Converse, fallback router, etc.), instead of patching
each provider individually.
This commit is contained in:
parent
e58a561caa
commit
0a5563d14a
1 changed files with 16 additions and 1 deletions
|
|
@ -426,11 +426,26 @@ def filter_internal_params(
|
|||
if not isinstance(data, dict):
|
||||
return data
|
||||
|
||||
# Known internal parameters that should never be sent to provider APIs
|
||||
# Known internal parameters that should never be sent to provider APIs.
|
||||
#
|
||||
# ``client_metadata`` is sent by some clients (e.g. OpenAI Codex CLI,
|
||||
# Claude Code) to attach run-level metadata. Most providers ignore
|
||||
# unknown fields, but Bedrock Converse with custom *application
|
||||
# inference profiles* rejects it because the underlying inference
|
||||
# profile validates ``additionalModelRequestFields`` strictly:
|
||||
#
|
||||
# The model returned the following errors: client_metadata: Extra
|
||||
# inputs are not permitted
|
||||
#
|
||||
# ``drop_params`` does not cover this because ``client_metadata`` is
|
||||
# not a known OpenAI parameter, so it survives as part of
|
||||
# ``additional_request_params`` and ends up in the Converse payload.
|
||||
# Filter it here so every provider path sees the same sanitization.
|
||||
internal_params = {
|
||||
"skip_mcp_handler",
|
||||
"mcp_handler_context",
|
||||
"_skip_mcp_handler",
|
||||
"client_metadata",
|
||||
}
|
||||
|
||||
# Add any additional internal params if provided
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue