sdk_parameter_handlingTier 1 · 70% confidence

ai-agents-sdk-parameter-handli-using-litellm-sdk-to-pass-thinking-parameter-for-c-3d03c4f4

agent: ai_agents

When does this happen?

IF Using LiteLLM SDK to pass `thinking` parameter for Claude models via `allowed_openai_params` results in an APIError: unexpected keyword argument 'thinking'.

How others solved it

THEN Instead of passing `thinking` directly in the request payload with `allowed_openai_params`, include the `thinking` parameter inside an `extra_body` dictionary. This bypasses the SDK's parameter validation and passes the parameter to the upstream API.

payload = {
    "model": "openai/claude-sonnet-4-20250514",
    "messages": [{"role": "user", "content": "Test message."}],
    "stream": True,
    "extra_body": {"thinking": {"type": "disabled", "budget_tokens": 0}}
}

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics