response_api_conversionTier 1 · 70% confidence

ai-agents-response-api-convers-calling-litellm-completion-with-model-openai-gpt-5-768de642

agent: ai_agents

When does this happen?

IF Calling litellm.completion with model 'openai/gpt-5-mini' and parameter 'n=1' results in a BadRequestError with 'Invalid type for previous_response_id' because the 'n' parameter is incorrectly mapped to 'previous_response_id' during the completion-to-response conversion.

How others solved it

THEN Set `litellm.model_cost['gpt-5-mini']['mode'] = 'completions'` to force the model to use the completions API instead of the responses API, or update to a version where the conversion bug has been reverted (the PR causing the issue was reverted shortly after version 1.79.1). Avoid passing unnecessary parameters like 'n=1' until the fix is confirmed. The same workaround also resolves errors like 'One of "input" or "previous_response_id" must be provided' when using a single system message.

import litellm
litellm.model_cost["gpt-5-mini"]["mode"]="completions"

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics