OpenAI
gpt-5.1-codex-max
Released 
November 2025

OpenAI
gpt-5.1-codex-max

OpenAI's frontier agentic coding model built for long-running, project-scale software engineering across multiple context windows.

Modality:
Text
Image
Video
model ID
openai/gpt-5.1-codex-max

Output Speed *

0.00
tok/s

Intelligence Index *

0
/ 100

Context Window *

400000
tokens

Input price

7.5
Anytoken

Output price

60
Anytoken
GPT-5.1-Codex-Max: Agentic Coding That Sustains Multi-Hour Engineering Tasks GPT-5.1-Codex-Max is OpenAI's frontier agentic coding model, built on an update to its reasoning stack and trained on real software engineering tasks like PR creation, code review, and frontend work. It sits above GPT-5.1-Codex as OpenAI's most capable Codex variant. Its defining feature is compaction: it is the first OpenAI model natively trained to operate across multiple context windows, coherently working over millions of tokens in a single task. This suits project-scale refactors, deep debugging, and long-running agent loops where earlier models failed on context limits. Start building with GPT-5.1-Codex-Max via the AnyAPI.ai API.

Performance

Long-Horizon Coding With Compaction and Tunable Reasoning Depth

GPT-5.1-Codex-Max is optimized for sustained agentic engineering rather than one-shot completions. OpenAI reports 77.9% on SWE-bench Verified at extra-high (xhigh) reasoning effort and 79.9% on SWE-Lancer IC SWE, up sharply from GPT-5.1-Codex's 66.3%. More significantly, at medium effort it matches its predecessor while using roughly 30% fewer thinking tokens. This token efficiency matters in production: long-running agent loops and project-scale refactors that previously failed on context limits can now run coherently, with OpenAI observing internal sessions exceeding 24 hours. The result is a model tuned for autonomous, multi-step engineering over raw response latency.

Benchmarks

How GPT-5.1-Codex-Max Scores on Agentic Coding Benchmarks

Independent reporting corroborates OpenAI's benchmark claims. On SWE-bench Verified, GPT-5.1-Codex-Max reached 77.9% at xhigh reasoning effort, narrowly ahead of Gemini 3 Pro's reported 76.2% and Claude Sonnet 4.5's 77.2% on the same benchmark. On Terminal-Bench 2.0, which tests terminal and tool-use skills, it scored 58.1% versus 54.2% for Gemini 3 Pro, and matched Gemini's 2,439 on LiveCodeBench Pro. All OpenAI evaluations were run with compaction and xhigh reasoning enabled, so real-world results at the recommended medium setting will differ. Treat these as coding-specific benchmarks, not general-intelligence measures.

Output Speed

*
0.00
tok/s

Intelligence Index

*
0
/ 100

MMLU *

Broad world knowledge and problem-solving
0
%

GPQA *

PhD-level scientific reasoning across physics, biology, chemistry.
0
%

HLE *

Adherence to multi-step structured instructions.
0
%

LiveCodeBench *

Tool-calling reliability in long agentic loops.
0
%

Technical Specifications

What the model supports

GPT-5.1-Codex-Max accepts text and image input and returns text only. It provides a 400,000-token context window and up to 128,000 output tokens, but its defining trait is compaction: native training to operate across multiple context windows, extending coherent work beyond a single window. It is available exclusively through the Responses API, not Chat Completions, so integrations must target that endpoint. Reasoning effort is tunable including a new xhigh level, though OpenAI recommends medium as the default. It is a specialist coding model, explicitly not recommended for general non-coding tasks.
Verified Specifications — 
gpt-5.1-codex-max
*
Input modalities
Text
Image
Video
output modalities
Text
Context window
400000
 tokens
Maximum output tokens
128000
Reasoning
Yes
Knowledge cutoff
November 2025
Pricing (standard)
7.5
 AnyTokens in
 / 
60
 AnyTokens out

Limitations & Trade-offs

Where gpt-5.1-codex-max falls short

1
Coding specialist, not general-purpose. OpenAI explicitly recommends GPT-5.1-Codex-Max only for agentic coding in Codex or Codex-like environments, not for general non-coding tasks. If your workload mixes reasoning, writing, and conversation, a general GPT-5.1 model is the better default. Deploying Codex-Max as an all-purpose assistant means paying for a specialist stack on tasks it wasn't tuned for.
2
Responses API only. GPT-5.1-Codex-Max is available exclusively through the OpenAI Responses API, not Chat Completions. Teams with existing Chat Completions integrations must adapt their request structure to adopt it. This limits drop-in replacement for stacks built around the older endpoint and adds migration work before the model's coding advantages can be realized in production.
3
xhigh reasoning trades latency and cost for quality. The extra-high reasoning effort that produces top benchmark scores thinks for a much longer period and consumes substantially more internal tokens, raising both latency and output cost. OpenAI recommends medium as the daily driver. Reserve xhigh for genuinely hard, non-latency-sensitive problems; using it as a default makes interactive workflows slow and long outputs comparatively expensive.
4
Text-only output and no verified public knowledge cutoff. The model accepts text and images but returns text only, so it cannot generate images, audio, or diagrams directly. It also has no image or audio output path for multimodal deliverables. For workloads needing generated visual or audio artifacts, pair it with a dedicated generation model rather than expecting Codex-Max to produce them.

Best-Fit Workloads

Where this model earns its place

01
Project-scale refactors Compaction lets GPT-5.1-Codex-Max prune history while preserving key context across multiple windows, so large refactors that span an entire module or microservice can run in a single coherent session. Its 400,000-token context and 79.9% SWE-Lancer IC SWE result support cross-file dependency work. This suits large-repository migrations where losing context mid-task previously caused failures. Use xhigh for the hardest passes and medium for iterative edits.
02
Long-running autonomous agent loops The model is OpenAI's first natively trained to operate across context windows for multi-hour work, with internally observed sessions exceeding 24 hours of continuous iteration. This fits overnight or unattended agents that fix failing tests, implement features, and re-run tools without human intervention. Its Terminal-Bench 2.0 score of 58.1% reflects terminal and tool-use competence. Build in compaction-aware prompting so state is summarized cleanly at each window boundary.
03
PR authoring and code review GPT-5.1-Codex-Max was trained directly on PR creation, code review, and Q&A-style debugging, making it well-suited to automated review pipelines and pull-request generation. Its SWE-bench Verified score of 77.9% at xhigh indicates strong real-world bug-fixing capability. This benefits CI-integrated review bots and PR drafting tools. Note it can be stylistically conservative, so teams wanting more exploratory changes may need explicit prompting.
04
Frontend implementation from designs The model was trained on frontend coding and has a strong visual reasoning backbone, with reported success converting UI screenshots into frontend code via its image-input support. This suits tools that turn mockups into component code. Because output is text only, generated interfaces must be rendered downstream. Independent reports describe conservative styling, so design-fidelity-critical work may need iteration or a design-specialist model alongside it.
Pricing in anytokens via AnyAPI
Input
7.5
Output
60
Cache write
Cache read

Integration

Access gpt-5.1-codex-max via AnyAPI.ai

Access gpt-5.1-codex-max through AnyAPI.ai using a unified API built for multi-model AI applications. Integrate gpt-5.1-codex-max without maintaining a separate provider-specific connection, and keep the flexibility to test, switch, or combine models as your application requirements evolve.

01

One API integration

Access gpt-5.1-codex-max and other AI models through the same API workflow instead of maintaining separate integrations for every provider.

02

Easy model switching

Test gpt-5.1-codex-max against alternative models or switch models as your performance, capability, or cost requirements change without rebuilding your application around another provider API.

03

Flexible for production

Use gpt-5.1-codex-max from experimentation through production while keeping your AI stack flexible as workloads, traffic, and model requirements evolve.

04

Multi-model applications

Use gpt-5.1-codex-max for the workloads where it performs best and combine it with other models for tasks that require different capabilities, performance, or efficiency.

Frequently Asked Questions

Answers to common questions about integrating and using this AI model via AnyAPI.ai

GPT-5.1-Codex-Max is OpenAI's frontier agentic coding model, purpose-built for long-running, project-scale software engineering. It handles refactors, deep debugging, PR authoring, code review, and multi-hour autonomous agent loops. OpenAI recommends it only for coding tasks in Codex or Codex-like environments, not general-purpose use.

GPT-5.1-Codex-Max has a 400,000-token context window and supports up to 128,000 output tokens. It is also the first OpenAI model natively trained for compaction, letting it work coherently across multiple context windows and effectively operate over millions of tokens in a single long-running task.

OpenAI reports 77.9% on SWE-bench Verified at extra-high reasoning effort, 79.9% on SWE-Lancer IC SWE, and 58.1% on Terminal-Bench 2.0. These beat its predecessor GPT-5.1-Codex and edge out reported scores for Gemini 3 Pro. All results were run with compaction and xhigh reasoning enabled.

GPT-5.1-Codex-Max is the more capable successor. It adds native compaction for working across multiple context windows, a new xhigh reasoning level, and higher benchmark scores, while using roughly 30% fewer thinking tokens at equivalent effort. Both are Responses-API-only Codex variants with the same 400,000-token context window.

GPT-5.1-Codex-Max is available exclusively through OpenAI's Responses API, not Chat Completions. It supports function calling and structured outputs via JSON schema. Through AnyAPI.ai you can integrate it alongside other models using a single interface, routing coding-agent workloads to Codex-Max.

* Benchmark data source: Artificial Analysis artificialanalysis.ai