Fix 400 errors caused by sending unsupported parameters such as temperature, top_p, or response_format to reasoning models.
Symptom
Your AI coding tool or backend integration fails immediately after switching models or upgrading the SDK. The request reaches the API, but the response is a 400 Bad Request.
BadRequestError: 400 Unsupported parameter: 'temperature' is not supported with this model.
Likely Cause
Reasoning-focused models expose a smaller or different parameter surface than older chat models. Agent frameworks often reuse a default configuration that includes sampling parameters, response format options, or tool settings the selected model does not accept.
Fast Fix
- Remove unsupported sampling options from the request for the affected model.
- Keep model-specific request builders instead of sharing one global config across all models.
- Upgrade the SDK and check the model capability table before enabling structured output or tool options.
- Log the final payload sent by the agent, not only the high-level prompt.
Verification
Run a minimal request with only the model and input. Add parameters back one by one until the failing option is identified. Keep this minimal request as a regression test for future model upgrades.
Prevention
Create a small compatibility map in your app: model name, supported controls, structured output mode, tool mode, and retry behavior. AI agents fail less mysteriously when the request layer validates options before sending them.