OpenAI retired frontier Codex model
GPT-5.1 Codex Max
OpenAI’s first Codex model natively trained to work across multiple context windows through compaction, built for project-scale refactors, deep debugging, frontend work, code review, and multi-hour software-engineering agent loops.
- Context window
- 400K
- per window
- Max output
- 128K
- tokens
- Input
- $1.25
- historical · per 1M
- Cached input
- $0.125
- historical · per 1M
- Output
- $10.00
- historical · per 1M
01 / Overview
What GPT-5.1 Codex Max Was
GPT-5.1 Codex Max was OpenAI’s frontier agentic coding model for long-horizon software-engineering work and the first Codex model natively trained to operate across multiple context windows.
The Model That Changed Codex From Long Context to Multi-Context Work
OpenAI introduced GPT-5.1 Codex Max on November 19, 2025.
It was built on an updated foundational reasoning model trained on agentic tasks across software engineering, mathematics, research, medicine, computer use, and related domains.
For Codex, the important innovation was not simply a better coding score.
It was compaction.
GPT-5.1 Codex Max was the first model in the line trained to:
- fill a context window;
- compact older session state;
- preserve the most important information;
- continue in a fresh context window;
- repeat the process until the task is complete.
That made it possible for one coding task to coherently process millions of tokens over time even though the model’s native per-window context limit remained 400,000 tokens.
OpenAI positioned the model for:
- project-scale refactoring;
- deep debugging;
- PR creation;
- code review;
- frontend coding;
- repository Q&A;
- multi-hour agent loops;
- long-running autonomous engineering.
It became the default model across Codex surfaces when it launched.
The API model is now retired.
OpenAI shut down gpt-5.1-codex-max on July 23, 2026.
- Provider
- OpenAI
- Family
- GPT-5.1 Codex Max
- Model ID
- gpt-5.1-codex-max
- Released
- Nov 19, 2025
- Status
- Retired
- Knowledge cutoff
- Sep 30, 2024
- Input
- Text, Image
- Output
- Text
02 / Compaction
Native Compaction Was the Defining GPT-5.1 Codex Max Feature
GPT-5.1 Codex Max was the first OpenAI coding model natively trained to continue a single task across multiple context windows through compaction.
A 400K Window Could Become a Multi-Million-Token Task
A normal context window eventually fills.
Long software-engineering sessions accumulate:
- source files;
- repository instructions;
- tool calls;
- shell output;
- test failures;
- patches;
- debugging notes;
- previous decisions;
- generated explanations.
Before compaction, a sufficiently long task could simply hit the context ceiling.
Codex Max changed that workflow.
When the session approached the limit, the Codex harness could compact prior state by pruning or summarizing older history while preserving the information needed to continue.
A new context window could then be opened.
The cycle could repeat several times.
This let a single agent trajectory coherently work through millions of tokens even though one native context window remained 400K.
Compaction enabled categories of work that previously failed because of context exhaustion:
- project-wide refactors;
- prolonged debugging;
- repeated test-and-fix cycles;
- large migrations;
- multi-hour agent execution.
The key evaluation question is not simply whether compaction saves space.
It is whether the compressed state preserves:
- requirements;
- architectural decisions;
- known failures;
- repository constraints;
- completed work;
- unresolved tasks.
- 01
Fill the active window
Repository content, instructions, edits, tool output, and reasoning accumulate during the engineering session.
- 02
Compact session state
Preserve task-critical information while reducing historical detail that no longer needs to occupy the active context.
- 03
Continue in a fresh window
Resume the same task without resetting the agent’s objective or losing the important engineering state.
- 04
Repeat until completion
Multi-window execution enables long agent loops that can coherently process millions of tokens over one task.
03 / Long-horizon coding
Designed for Project-Scale and Multi-Hour Coding Work
OpenAI built GPT-5.1 Codex Max for long-running, detailed work where a coding agent needs to maintain progress through many edits, commands, failures, and context transitions.
Long-Horizon Quality Is About Staying on Task
A multi-hour coding agent needs more than raw coding intelligence.
It must avoid:
- forgetting the original objective;
- repeating completed work;
- undoing earlier fixes;
- rereading the same files unnecessarily;
- drifting into unrelated refactors;
- ignoring new test evidence.
Representative Max workloads included:
- project-scale refactors;
- deep debugging sessions;
- multi-file migrations;
- frontend implementation;
- code review;
- large PR creation;
- difficult repository Q&A.
Evaluation should therefore cover the full trajectory.
Track:
- completion rate;
- elapsed agent time;
- context-window transitions;
- compactions;
- files touched;
- commands executed;
- failed approaches;
- repair iterations;
- tests passed;
- human intervention.
A model that eventually returns a good patch after excessive looping may be less useful than one that reaches the same result with fewer tools and less reasoning.
- 01
Maintain the objective
Preserve the original issue, constraints, and definition of done across many tool calls and context transitions.
- 02
Accumulate evidence
Treat test output, logs, repository structure, and previous failures as evidence that changes the next action.
- 03
Avoid repeated work
Keep track of inspected files, completed edits, and rejected approaches so the loop continues forward.
- 04
Finish with validation
Stop only after the requested engineering outcome is verified by the available tests or acceptance checks.
04 / Coding capabilities
PRs, Code Review, Frontend Coding, and Repository Q&A
OpenAI trained GPT-5.1 Codex Max on real software-engineering tasks rather than treating programming as isolated code generation.
Training categories highlighted by OpenAI included:
- PR creation;
- code review;
- frontend coding;
- repository Q&A;
- agentic software engineering.
This matters because each category requires a different skill profile.
PR creation requires converting a requirement into a complete, reviewable repository change.
Code review requires finding high-value defects while avoiding speculative noise.
Frontend coding requires combining functionality, layout, visual references, and iterative inspection.
Repository Q&A requires navigating code and explaining architecture without necessarily changing it.
OpenAI also reported that Max could create frontend designs with similar functionality and aesthetics to GPT-5.1 Codex while using fewer tokens.
For model migration, keep separate evaluation sets for each task type.
One average “coding score” can hide regressions in review quality, frontend fidelity, or repository understanding.
- 01
PR creation
Turn an issue into a coherent code change with validation and repository-aware scope.
- 02
Code review
Inspect changes and dependencies to identify important defects rather than generating generic comments.
- 03
Frontend coding
Build functional interfaces while iterating on visual and behavioral feedback.
- 04
Repository Q&A
Navigate a codebase and answer architecture or implementation questions using project context.
05 / Windows & CLI
The First Codex Model Trained for Windows Environments
OpenAI identified GPT-5.1 Codex Max as the first model in the Codex line explicitly trained to work in Windows environments, while also adding training aimed at better collaboration inside the Codex CLI.
Environment Diversity Matters for Coding Agents
Coding-agent quality depends on more than programming language knowledge.
The model may need to understand:
- filesystem conventions;
- shell differences;
- path separators;
- platform-specific commands;
- build tooling;
- environment variables;
- process behavior.
OpenAI’s Windows training was therefore a meaningful extension of the model’s practical engineering coverage.
At launch, Max was available across Codex surfaces including:
- CLI;
- IDE extension;
- cloud;
- code review.
The model was also trained with tasks intended to make it a better partner in Codex CLI workflows.
For evaluation, include the environments your real developers use.
A Linux-only benchmark may miss failures that appear in Windows repositories or PowerShell-oriented workflows.
- 01
Windows
Evaluate platform-specific paths, commands, tools, and repository behavior rather than assuming Unix semantics.
- 02
CLI
Measure how effectively the model navigates command-driven implementation, testing, and debugging loops.
- 03
IDE
Test interactive editing and developer-guided iteration where the model works alongside a human.
- 04
Cloud and review
Preserve autonomous task and review cases that use Codex outside the local editor.
06 / Reasoning
GPT-5.1 Codex Max Added Extra High Reasoning
GPT-5.1 Codex Max introduced an xhigh reasoning setting for difficult, latency-insensitive work while OpenAI continued to recommend medium as the everyday default.
More Reasoning Was Optional, Not the Default Recommendation
OpenAI’s launch guidance makes an important distinction.
For most coding tasks:
- use
mediumas the daily-driver setting.
For tasks where quality matters more than latency:
- use
xhighto let the model think longer.
The purpose of Max was not simply to spend more reasoning tokens.
OpenAI emphasized reasoning efficiency.
On SWE-bench Verified, Max at medium outperformed GPT-5.1 Codex at medium while using about 30% fewer thinking tokens.
That means the correct evaluation metric is not “more thinking equals better.”
Compare:
- task success;
- thinking-token usage;
- tool-call count;
- latency;
- patch quality;
- total cost.
xhigh should be reserved for tasks where the additional compute materially improves the engineering result.
Daily coding
Use medium as the starting point for most repository work and optimize only after measuring real completion quality.
Hard long-horizon task
Use xhigh for difficult, latency-insensitive refactors, debugging, or agent loops where deeper reasoning produces measurable gains.
07 / Benchmarks
GPT-5.1 Codex Max Coding Benchmarks
OpenAI’s launch appendix showed clear gains over GPT-5.1 Codex across software-engineering and terminal-agent benchmarks.
Published High-Effort Comparison
OpenAI published the following comparison:
- SWE-bench Verified: GPT-5.1 Codex high — 73.7%; Codex Max xhigh — 77.9%;
- SWE-Lancer IC SWE: GPT-5.1 Codex high — 66.3%; Codex Max xhigh — 79.9%;
- Terminal-Bench 2.0: GPT-5.1 Codex high — 52.8%; Codex Max xhigh — 58.1%.
OpenAI noted that Max evaluations used compaction and Extra High reasoning.
These benchmark numbers should not be interpreted as a direct model-only comparison because effort settings differ.
They are still useful as historical evidence that Max targeted a higher ceiling on difficult engineering tasks.
The more controlled efficiency comparison is the separate medium-effort SWE-bench result where Max performed better while using around 30% fewer thinking tokens.
For production decisions, benchmarks should be supplemented with:
- your repositories;
- your test suites;
- your tool harness;
- your coding standards;
- your definition of an accepted patch.
- 77.9%
SWE-bench Verified
GPT-5.1 Codex Max at xhigh in OpenAI’s published launch evaluation.
- 79.9%
SWE-Lancer IC SWE
Published Max xhigh result versus 66.3% for GPT-5.1 Codex high.
- 58.1%
Terminal-Bench 2.0
Published Max xhigh result versus 52.8% for GPT-5.1 Codex high.
- ≈30%
Fewer thinking tokens
OpenAI’s medium-effort SWE-bench comparison reported better Max performance with about 30% lower thinking-token use.
08 / Pricing
GPT-5.1 Codex Max Pricing
GPT-5.1 Codex Max used the same standard token rates as GPT-5.1 Codex, so the economic story depended on higher reasoning efficiency and fewer wasted agent steps rather than a lower per-token price.
Historical rates were:
- input: $1.25 per 1M tokens;
- cached input: $0.125 per 1M tokens;
- output: $10.00 per 1M tokens.
OpenAI explicitly highlighted token efficiency as a Max advantage.
A model with the same token rate can still be cheaper per completed task if it:
- reasons with fewer tokens;
- chooses better tools;
- avoids failed approaches;
- needs fewer repair loops;
- finishes more tasks successfully.
Compaction adds another dimension.
A multi-hour agent can consume many millions of tokens over successive windows.
Therefore calculate:
total accepted-task cost = input + cached input + reasoning/output + tool usage + retries
Do not estimate long-horizon agent economics from one short request.
1M tokens · USD
- Input
- $1.25
- Cached input
- $0.125
- Output
- $10.00
Example: 100K input + 10K output
- Input cost
- $0.1250
- Output cost
- $0.1000
- Estimated token cost
- $0.2250
09 / Context
400K Native Context, Millions of Tokens Across a Task
GPT-5.1 Codex Max had a 400,000-token native context window and a 128,000-token maximum output, but compaction allowed a Codex task to continue coherently across multiple windows.
Context Window and Task Horizon Became Different Numbers
This is the central architectural insight of Codex Max.
The model specification remained:
- 400K context;
- 128K max output.
But the task horizon could be much larger.
When Codex approached the active window limit:
- accumulated history was compacted;
- important state was retained;
- a fresh window was provided;
- execution continued.
OpenAI described this as coherent work over millions of tokens in a single task.
This distinction matters when comparing Max with models that advertise a very large single context window.
A larger native window reduces how often context management is needed.
Compaction instead allows the agent harness to explicitly manage long-term state.
Both approaches have tradeoffs.
Evaluate:
- information retained after compaction;
- number of compactions;
- forgotten constraints;
- duplicated work;
- total input tokens;
- completion success.
Context window
400,000
Max output
128,000
Compaction allowed the Codex harness to move into additional context windows, so one task could coherently process millions of tokens over time.
10 / Responses API
GPT-5.1 Codex Max Was a Responses-API-Only Model
The official model page exposed GPT-5.1 Codex Max through the Responses API, matching its role as a stateful, tool-driven coding agent.
The documented model capabilities included:
- Responses API;
- streaming;
- function calling;
- structured outputs;
- reasoning tokens;
- text input and output;
- image input.
The model did not support:
- direct audio;
- video;
- fine-tuning;
- predicted outputs.
The Responses API is a natural fit for long-running coding because the session can contain structured items such as:
- assistant messages;
- function calls;
- tool outputs;
- reasoning-related state;
- structured results.
However, native Codex compaction was not merely equivalent to sending a giant API request.
The full long-horizon behavior depended on the Codex agent environment and its context-management loop.
When migrating, preserve the harness assumptions separately from the underlying model choice.
- Supported
Responses API
The supported API surface for agentic GPT-5.1 Codex Max workflows.
- Supported
Streaming
Receive output progressively during interactive and long-running coding sessions.
- Supported
Function calling
Connect model decisions to repository, shell, test, and application-defined tools.
- Supported
Structured outputs
Return schema-constrained data when the surrounding coding harness needs machine-readable state.
- Supported
Image input
Use screenshots and visual references for frontend and debugging workflows.
- Not listed
Fine-tuning
OpenAI lists fine-tuning as unsupported.
11 / Max vs 5.1 Codex
GPT-5.1 Codex Max vs GPT-5.1 Codex
GPT-5.1 Codex Max did not simply increase the context number or lower token prices—it changed the long-horizon architecture through compaction and more efficient reasoning.
What Stayed the Same
Both models used:
- 400K native context;
- 128K output;
- $1.25 input;
- $0.125 cached input;
- $10 output;
- Responses API;
- text and image input;
- reasoning tokens;
- function calling;
- structured outputs.
What Changed
GPT-5.1 Codex Max added or emphasized:
- native training across multiple context windows;
- compaction;
- coherent multi-million-token task horizons;
- project-scale refactoring;
- multi-hour agent loops;
- improved reasoning-token efficiency;
xhighreasoning;- explicit Windows training;
- stronger published coding benchmarks.
That makes ordinary GPT-5.1 Codex the single-window baseline and Codex Max the multi-context baseline.
For SEO and evaluation, this is the most important separation between their pages.
- 01
Same native limits
Both models exposed 400K context, 128K output, and identical headline token rates.
- 02
Max added compaction
The model and Codex harness could cross context-window boundaries while preserving the task’s important state.
- 03
Max improved efficiency
OpenAI reported better medium-effort SWE-bench performance with about 30% fewer thinking tokens.
- 04
Max raised the ceiling
xhigh reasoning and stronger benchmark results targeted the hardest latency-insensitive engineering workloads.
12 / Retirement
GPT-5.1 Codex Max Is Retired From the OpenAI API
OpenAI deprecated GPT-5.1 Codex Max in April 2026 and shut down API access on July 23, 2026.
The Migration Window Is Over
The lifecycle was:
- launch in Codex: November 19, 2025;
- API availability followed after the initial Codex rollout;
- deprecation announcement: April 22, 2026;
- API shutdown: July 23, 2026;
- substitute:
gpt-5.6-sol.
The current model catalog labels GPT-5.1 Codex Max as deprecated.
The deprecations table confirms that API access has already been shut down.
Operationally, it is a retired API model.
Historical documentation remains useful because old systems may contain:
- model IDs;
- agent traces;
- compaction assumptions;
- prompt-cache settings;
- reasoning settings;
- benchmark results;
- pricing calculations;
- regression suites.
Do not start a new production integration with gpt-5.1-codex-max.
- 01
Released · Nov 19, 2025
OpenAI introduced GPT-5.1 Codex Max as its frontier long-horizon agentic coding model.
- 02
Default Codex model
Max replaced GPT-5.1 Codex as the default across Codex surfaces at launch.
- 03
Deprecated · Apr 22, 2026
OpenAI announced removal of older GPT and Codex model snapshots.
- 04
Shut down · Jul 23, 2026
API access ended. OpenAI’s deprecation table names GPT-5.6 Sol as the substitute.
13 / Migration
Migrating From GPT-5.1 Codex Max to GPT-5.6 Sol
OpenAI’s deprecation table names GPT-5.6 Sol as the substitute, but Max migrations need special attention to long-horizon state because compaction was central to the old Codex workflow.
Preserve the Task Horizon During Migration
A replacement model may have:
- a larger native context;
- different reasoning levels;
- different tool behavior;
- different state-management infrastructure.
That does not automatically make a Max migration equivalent.
Create a regression set containing:
- project-scale refactors;
- tasks that crossed one 400K window;
- deep debugging;
- multi-hour loops;
- large test logs;
- repeated patch-and-repair cycles;
- code reviews;
- Windows workflows.
Preserve:
- repository revision;
- tool access;
- shell environment;
- validation commands;
- original instructions;
- expected final state.
Then compare:
- completion rate;
- context consumed;
- compaction or context-management events;
- reasoning tokens;
- tool calls;
- forgotten requirements;
- repeated work;
- latency;
- accepted-task cost.
Recalibrate reasoning from scratch.
- 01
Freeze the multi-context baseline
Preserve repository revisions, issue prompts, tests, tool traces, compaction-sensitive workloads, and accepted historical outcomes.
- 02
Keep the harness stable
Hold tool access, shell behavior, validation commands, and environment assumptions constant during the first replacement comparison.
- 03
Recalibrate reasoning and context
Evaluate modern reasoning controls and context management empirically instead of copying Max medium or xhigh settings.
- 04
Compare completed-task economics
Use task success, forgotten requirements, repeated work, tool calls, latency, and total accepted-task cost as migration metrics.
14 / Evaluation
GPT-5.1 Codex Max Strengths and Limitations
GPT-5.1 Codex Max is historically important as OpenAI’s first Codex model natively trained for multi-context execution through compaction, but it is now a retired API model whose main value is as a long-horizon engineering and migration baseline.
Historical strengths
Native multi-context execution
Compaction let Codex preserve task-critical state and continue the same engineering trajectory across multiple 400K context windows.
Long-horizon software engineering
OpenAI positioned Max for project-scale refactors, deep debugging, frontend work, code review, and multi-hour agent loops.
Reasoning efficiency
OpenAI reported better medium-effort SWE-bench Verified performance than GPT-5.1 Codex while using about 30% fewer thinking tokens.
Broader development environments
Max was the first Codex model explicitly trained for Windows environments and also received training for Codex CLI collaboration.
What to consider
API access has ended
OpenAI shut down gpt-5.1-codex-max on July 23, 2026 and names gpt-5.6-sol as the substitute.
Compaction can lose detail
Multi-context execution depends on preserving the right requirements, decisions, failures, and unresolved work when older state is compacted.
Long trajectories can be expensive
A multi-hour task can consume millions of tokens across windows, so total accepted-task cost matters more than the headline per-token rate.
Harness behavior matters
The full long-horizon workflow depended on the Responses API and Codex context-management loop, not only on the underlying model.
Preserve the multi-context coding baseline
Replay GPT-5.1 Codex Max tasks with a supported model
Use project-scale refactors, deep debugging sessions, code-review cases, frontend tasks, multi-hour tool loops, and context-heavy repositories to compare completion quality, reasoning efficiency, compaction behavior, latency, and total cost.
Start FreeGPT-5.1 Codex Max is retired from the OpenAI API. OpenAI’s deprecation table names GPT-5.6 Sol as the substitute, so use historical Max workloads as a migration regression set rather than starting new traffic on this model.
Common Questions
What was GPT-5.1 Codex Max?
GPT-5.1 Codex Max was OpenAI’s frontier agentic coding model for long-horizon software engineering and the first Codex model natively trained to work across multiple context windows through compaction.
What was the GPT-5.1 Codex Max model ID?
The API model ID was gpt-5.1-codex-max.
When was GPT-5.1 Codex Max released?
OpenAI introduced GPT-5.1 Codex Max on November 19, 2025.
Is GPT-5.1 Codex Max still available?
No. OpenAI deprecated the model in April 2026 and shut down API access on July 23, 2026.
What model replaces GPT-5.1 Codex Max?
OpenAI’s API deprecation documentation names gpt-5.6-sol as the substitute.
What was the GPT-5.1 Codex Max context window?
GPT-5.1 Codex Max had a 400,000-token native context window per window.
What was the maximum output for GPT-5.1 Codex Max?
The official model specification listed a maximum output of 128,000 tokens.
What was native compaction in GPT-5.1 Codex Max?
Compaction reduced older session state while preserving task-critical information so Codex could continue the same task in a fresh context window.
Could GPT-5.1 Codex Max process more than 400K tokens in one task?
Yes. Although each native window was 400K tokens, repeated compaction allowed a single Codex task to work coherently through millions of tokens over time.
What input and output modalities did GPT-5.1 Codex Max support?
It supported text and image input and generated text output.
What was the GPT-5.1 Codex Max knowledge cutoff?
OpenAI listed September 30, 2024 as the knowledge cutoff.
How much did GPT-5.1 Codex Max cost?
Historical pricing was $1.25 per 1M input tokens, $0.125 per 1M cached input tokens, and $10 per 1M output tokens.
Did GPT-5.1 Codex Max support xhigh reasoning?
Yes. Max added an xhigh reasoning setting for difficult, latency-insensitive work, while OpenAI recommended medium for everyday coding.
How did GPT-5.1 Codex Max perform on coding benchmarks?
OpenAI reported 77.9% on SWE-bench Verified, 79.9% on SWE-Lancer IC SWE, and 58.1% on Terminal-Bench 2.0 for the published Max xhigh evaluation.
Was GPT-5.1 Codex Max trained for Windows?
Yes. OpenAI identified it as the first Codex model explicitly trained to work in Windows environments.
Which API supported GPT-5.1 Codex Max?
OpenAI exposed GPT-5.1 Codex Max through the Responses API, with streaming, function calling, structured outputs, reasoning tokens, and image input support.
What is the difference between GPT-5.1 Codex Max and GPT-5.1 Codex?
Both shared a 400K native context, 128K output, and the same headline token rates, but Max added native multi-context execution through compaction, xhigh reasoning, Windows training, and stronger long-horizon positioning.
How should teams migrate from GPT-5.1 Codex Max?
Preserve the original repository revisions, prompts, tools, tests, environment, and long-horizon workloads, then replay them with GPT-5.6 Sol or another supported model and compare completion quality, context management, reasoning, tool use, latency, and total cost.
Model information
Last updated
Specifications, pricing, context limits, modalities, Responses API support, native compaction, multi-context behavior, reasoning levels, benchmark results, Windows training, lifecycle status, and migration guidance on this page are based on OpenAI’s official GPT-5.1 Codex Max model page, launch announcement, system card, model release notes, and API deprecations documentation.