Back to Models

GPT-5.1 Codex Mini

openaiopenai/gpt-5.1-codex-mini

API guide

Chat completion

GPT-5.1-Codex-Mini uses the standard chat completions endpoint. For best latency in interactive coding tasks, set reasoning_effort to 'none' (default) or 'low'. For more complex coding tasks, 'medium' provides a good balance of accuracy and speed.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-5.1-codex-mini","messages":[{"role":"user","content":"Write a function to merge two sorted arrays in TypeScript"}],"reasoning_effort":"low"}'

Reasoning effort

GPT-5.1-Codex-Mini supports adaptive reasoning. For latency-sensitive coding tasks, set reasoning_effort to 'none' (default) to get fast, direct responses. For more complex code generation or debugging, use 'low' or 'medium'. The model does not support 'xhigh' (available only on Codex-Max).

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-5.1-codex-mini","messages":[{"role":"user","content":"Debug why this React component is re-rendering infinitely:\n\nfunction Counter() { const [count, setCount] = useState(0); useEffect(() => { setCount(count + 1); }); return <p>{count}</p>; }"}],"reasoning_effort":"medium"}'

Function calling / tool use

GPT-5.1-Codex-Mini supports standard tool/function calling for lightweight agentic patterns. For simpler single-tool orchestration (code fixes, file edits), it provides fast, cost-effective results. Route complex multi-tool workflows to GPT-5.1-Codex or GPT-5.1-Codex-Max.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-5.1-codex-mini","messages":[{"role":"user","content":"Check if package.json exists in the project root"}],"tools":[{"type":"function","function":{"name":"file_exists","description":"Check if a file exists at a given path","parameters":{"type":"object","properties":{"path":{"type":"string","description":"File path to check"}},"required":["path"]}}}],"tool_choice":"auto","reasoning_effort":"none"}'
Fact ledger β€” every claim on this page traces here
sourceURLretrieved
Release dateopenai.com β†—2026-05-28verified
OpenAI API model idopenai.com β†—2026-05-28verified
Model typeopenai.com β†—2026-05-28verified
Reasoning effort levelsopenai.com β†—2026-05-28verified
Input modalitiesopenai.com β†—2026-05-28verified
Licenseβ€”β€”verified
SWE-bench Verifiedopenai.com β†—2026-05-28unknown
OpenAI releases GPT-5.1, GPT-5.1-Codex, and GPT-5.1-Codex-Mini for developersopenai.com β†—2026-05-28verified
GPT-5.1-Codex-Mini available in GitHub Copilot public previewgithub.blog β†—2026-05-28verified
GPT-5.1 models retired from ChatGPT (API unaffected)help.openai.com β†—2026-05-28verified
How is GPT-5.1-Codex-Mini different from GPT-5.1-Codex?openai.com β†—2026-05-28to verify
Does GPT-5.1-Codex-Mini support compaction or multi-window context?openai.com β†—2026-05-28to verify
Can I use GPT-5.1-Codex-Mini for non-coding tasks?openai.com β†—2026-05-28to verify
What reasoning effort should I use for GPT-5.1-Codex-Mini?openai.com β†—2026-05-28to verify
Help & contact