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
sourceURLretrieved
Release dateopenai.com β†—2026-05-28verified
OpenAI API model idopenai.com β†—2026-05-28verified
Model typeopenai.com β†—2026-05-28verified
Reasoning typeopenai.com β†—2026-05-28verified
Compactionopenai.com β†—2026-05-28verified
Windows environment supportopenai.com β†—2026-05-28verified
Cybersecurity capability (Preparedness Framework)openai.com β†—2026-05-28verified
Licenseβ€”β€”verified
SWE-bench Verifiedopenai.com β†—2026-05-28verified
SWE-Lancer IC SWEopenai.com β†—2026-05-28verified
Terminal-Bench 2.0openai.com β†—2026-05-28verified
OpenAI announces GPT-5.1-Codex-Max with compaction and xhigh reasoningopenai.com β†—2026-05-28verified
How is GPT-5.1-Codex-Max different from GPT-5.1-Codex?openai.com β†—2026-05-28to verify
Is GPT-5.1-Codex-Max available via the OpenAI API, or only in Codex?openai.com β†—2026-05-28to verify
Can GPT-5.1-Codex-Max be used for general reasoning tasks?openai.com β†—2026-05-28to verify
Help & contact