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 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 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 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
| source | URL | retrieved | |
|---|---|---|---|
| Release date | openai.com β | 2026-05-28 | verified |
| OpenAI API model id | openai.com β | 2026-05-28 | verified |
| Model type | openai.com β | 2026-05-28 | verified |
| Reasoning effort levels | openai.com β | 2026-05-28 | verified |
| Input modalities | openai.com β | 2026-05-28 | verified |
| License | β | β | verified |
| SWE-bench Verified | openai.com β | 2026-05-28 | unknown |
| OpenAI releases GPT-5.1, GPT-5.1-Codex, and GPT-5.1-Codex-Mini for developers | openai.com β | 2026-05-28 | verified |
| GPT-5.1-Codex-Mini available in GitHub Copilot public preview | github.blog β | 2026-05-28 | verified |
| GPT-5.1 models retired from ChatGPT (API unaffected) | help.openai.com β | 2026-05-28 | verified |
| How is GPT-5.1-Codex-Mini different from GPT-5.1-Codex? | openai.com β | 2026-05-28 | to verify |
| Does GPT-5.1-Codex-Mini support compaction or multi-window context? | openai.com β | 2026-05-28 | to verify |
| Can I use GPT-5.1-Codex-Mini for non-coding tasks? | openai.com β | 2026-05-28 | to verify |
| What reasoning effort should I use for GPT-5.1-Codex-Mini? | openai.com β | 2026-05-28 | to verify |