Back to Models
GPT-5.1-Codex-Max
openaiopenai/gpt-5.1-codex-max
API guide
Chat completion
GPT-5.1-Codex-Max is accessed via the standard chat completions endpoint. For agentic coding workflows, route through Codex or Codex-compatible harnesses to leverage apply_patch and shell tools.
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-max","messages":[{"role":"user","content":"Write a Python script that monitors CPU usage and logs to a file"}],"reasoning_effort":"medium"}'Reasoning effort
GPT-5.1-Codex-Max supports adaptive reasoning with five levels. Use 'xhigh' for non-latency-sensitive tasks requiring maximum accuracy, and 'medium' as the recommended daily driver for most coding tasks.
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-max","messages":[{"role":"user","content":"Refactor this entire codebase to use async/await"}],"reasoning_effort":"xhigh"}'Function calling / tool use
GPT-5.1-Codex-Max supports tool/function calling for structured agentic workflows. Standard tool definitions work via TheRouter API. For Codex-native tools (apply_patch, shell), route through Codex-compatible harnesses.
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-max","messages":[{"role":"user","content":"Find all files larger than 10MB in the repo and list them"}],"tools":[{"type":"function","function":{"name":"list_large_files","description":"List files over a certain size","parameters":{"type":"object","properties":{"size_mb":{"type":"number","description":"Minimum size in MB"}},"required":["size_mb"]}}}],"tool_choice":"auto"}'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 type | openai.com β | 2026-05-28 | verified |
| Compaction | openai.com β | 2026-05-28 | verified |
| Windows environment support | openai.com β | 2026-05-28 | verified |
| Cybersecurity capability (Preparedness Framework) | openai.com β | 2026-05-28 | verified |
| License | β | β | verified |
| SWE-bench Verified | openai.com β | 2026-05-28 | verified |
| SWE-Lancer IC SWE | openai.com β | 2026-05-28 | verified |
| Terminal-Bench 2.0 | openai.com β | 2026-05-28 | verified |
| OpenAI announces GPT-5.1-Codex-Max with compaction and xhigh reasoning | openai.com β | 2026-05-28 | verified |
| How is GPT-5.1-Codex-Max different from GPT-5.1-Codex? | openai.com β | 2026-05-28 | to verify |
| Is GPT-5.1-Codex-Max available via the OpenAI API, or only in Codex? | openai.com β | 2026-05-28 | to verify |
| Can GPT-5.1-Codex-Max be used for general reasoning tasks? | openai.com β | 2026-05-28 | to verify |