OpenAI retired Codex model
GPT-5.1 Codex
OpenAI’s GPT-5.1 coding-specialized model for longer-running repository work, iterative implementation, debugging, testing, refactoring, and other agentic software-engineering tasks in Codex or Codex-like environments.
- Context window
- 400K
- tokens
- 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 Was
GPT-5.1 Codex was the coding-specialized GPT-5.1 model for agentic software-engineering work in Codex and Codex-like environments.
The GPT-5.1 Generation’s First Dedicated Codex Model
OpenAI released gpt-5.1-codex through the Responses API on November 13, 2025.
The general GPT-5.1 release targeted a broad mix of coding, tool use, reasoning, and agentic work.
GPT-5.1 Codex narrowed that focus.
OpenAI described the Codex variants as optimized for longer-running, agentic coding tasks in environments where the model can inspect a repository, call tools, change files, observe command output, and continue working.
That made GPT-5.1 Codex a successor to GPT-5 Codex but not a general replacement for GPT-5.1.
Its intended job was software engineering.
The official model specification included:
- 400,000-token context window;
- 128,000 maximum output tokens;
- September 30, 2024 knowledge cutoff;
- text input and output;
- image input;
- reasoning-token support;
- streaming;
- function calling;
- structured outputs;
- Responses API access only;
- no fine-tuning;
- no predicted outputs.
The model is now retired from the API.
OpenAI shut down access on July 23, 2026.
- Provider
- OpenAI
- Family
- GPT-5.1 Codex
- Model ID
- gpt-5.1-codex
- API release
- Nov 13, 2025
- Status
- Retired
- Knowledge cutoff
- Sep 30, 2024
- Input
- Text, Image
- Output
- Text
02 / Long-running coding
GPT-5.1 Codex Focused on Longer-Running Coding Tasks
The defining product distinction of GPT-5.1 Codex was not generic code generation—it was the ability to participate in longer software-engineering trajectories inside an agent harness.
A Coding Task Can Be Dozens of Decisions, Not One Completion
OpenAI launched GPT-5.1 Codex and GPT-5.1 Codex Mini specifically for longer-running agentic coding work.
A realistic repository task may require the model to:
- search for the relevant files;
- inspect existing architecture;
- understand project instructions;
- form an implementation plan;
- edit several files;
- run tests;
- inspect failures;
- repair the implementation;
- run validation again;
- stop only when the task is complete.
This means model quality cannot be measured from the first generated patch alone.
A strong result is a complete trajectory.
Useful evaluation metrics include:
- accepted patch rate;
- tests passed;
- number of files changed;
- unnecessary edits;
- repeated file reads;
- tool-call count;
- failed approaches;
- repair iterations;
- human intervention;
- total time and cost to completion.
GPT-5.1 Codex is therefore best understood as a repository agent model, not as a code-completion endpoint.
- 01
Explore
Search the repository and identify the smallest relevant implementation surface.
- 02
Implement
Make code and test changes that follow the project’s existing patterns.
- 03
Validate
Run tests, builds, linters, or other tools and treat their output as part of the task.
- 04
Persist
Repair failures and continue until the implementation meets the acceptance criteria.
03 / Repository workflows
Built for Repository-Scale Software Work
GPT-5.1 Codex was intended for software tasks where project context, tools, and iterative verification matter as much as raw code-generation quality.
The Harness Is Part of Model Performance
An agentic coding model does not work in isolation.
Its result depends on what the surrounding environment exposes:
- file search;
- file reading;
- patch application;
- shell commands;
- tests;
- build systems;
- repository instructions;
- screenshots;
- version-control state.
OpenAI’s GPT-5.1 developer release also introduced improved coding-oriented tool patterns such as Apply Patch and shell workflows for the broader GPT-5.1 generation.
In a Codex-like harness, these tools create a plan-execute-observe loop.
Representative GPT-5.1 Codex workloads include:
- targeted bug fixes;
- feature implementation;
- test creation;
- test repair;
- multi-file refactoring;
- repository Q&A;
- frontend implementation;
- debugging from logs;
- dependency-aware code changes.
For migration, preserve the original harness.
If both the model and tool environment change simultaneously, it becomes difficult to know which change caused a quality regression or improvement.
- 01
Feature work
Translate an issue or requirement into changes across the relevant production and test files.
- 02
Debugging
Use logs, test failures, and code inspection to find the root cause instead of guessing from the initial symptom.
- 03
Refactoring
Coordinate multi-file changes while preserving behavior and repository conventions.
- 04
Validation
Treat tests and tool output as evidence that determines whether the task is actually finished.
04 / Reasoning
Reasoning Tokens Supported Agentic Coding Decisions
GPT-5.1 Codex supported reasoning tokens so the model could spend internal work on codebase understanding, tool selection, debugging, and implementation decisions across a repository task.
Reasoning Cost Should Be Measured Against Completed Work
For a coding agent, reasoning is not separate from execution.
The model may need to decide:
- which files to inspect;
- whether the issue is local or architectural;
- which tool to call;
- how much code to modify;
- whether a test failure invalidates the approach;
- when to stop.
OpenAI later used GPT-5.1 Codex as the baseline when introducing GPT-5.1 Codex Max.
That comparison is useful because it reveals the efficiency profile of the older model.
On SWE-bench Verified, OpenAI reported that Codex Max at medium reasoning effort achieved better performance than GPT-5.1 Codex at the same effort while using about 30% fewer thinking tokens.
The implication is important.
Reasoning-token count by itself is not a quality metric.
A migration should measure:
- reasoning tokens;
- accepted-result quality;
- tool calls;
- retries;
- elapsed time;
- final test status;
- total cost.
The least expensive model is the one that reaches the required engineering outcome efficiently—not necessarily the one that reasons least.
- 01
Understand
Spend model work on architecture, dependencies, requirements, and repository state before editing.
- 02
Decide
Choose tools, files, tests, and the scope of the implementation based on the current evidence.
- 03
Diagnose
Use failures to revise the model’s hypothesis instead of repeating the same patch.
- 04
Measure efficiency
Compare reasoning-token usage with successful completion, not in isolation.
05 / Pricing
GPT-5.1 Codex Pricing
GPT-5.1 Codex used the same headline token pricing as GPT-5 and GPT-5 Codex: $1.25 input, $0.125 cached input, and $10 output per million tokens.
Historical rates were:
- input: $1.25 per 1M tokens;
- cached input: $0.125 per 1M tokens;
- output: $10.00 per 1M tokens.
The model’s value proposition therefore did not come from a cheaper token rate.
It came from model behavior optimized for longer software-engineering tasks.
For coding agents, the relevant unit is cost per accepted task.
A repository change can consume tokens through:
- source-code context;
- repeated prompts;
- reasoning;
- tool definitions;
- command output;
- patch generation;
- failed attempts;
- repair loops.
Cached input could make repeated prefixes much cheaper.
But caching only helps when the same prefix is actually reused.
When reconstructing historical economics, measure the complete trajectory from issue prompt to accepted patch.
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
06 / Context
400K Context and 128K Maximum Output
GPT-5.1 Codex provided a 400,000-token context window and up to 128,000 output tokens for repository state, instructions, source code, tool definitions, command results, reasoning, and generated changes.
Large Enough for Serious Repository Work, but Still a Single Window
The 400K context limit matched the original GPT-5 Codex specification.
A coding session could use that space for:
- system and developer instructions;
- repository guidance;
- source files;
- test files;
- screenshots;
- conversation history;
- tool schemas;
- shell output;
- previous response items.
The important historical limitation is that GPT-5.1 Codex remained a single-context-window baseline.
Six days after its API release, OpenAI introduced GPT-5.1 Codex Max as the first Codex model natively trained to operate across multiple context windows using compaction.
That difference defines the two models.
GPT-5.1 Codex could work on long tasks inside a 400K window.
Codex Max was designed to continue beyond one window by compacting accumulated state and opening fresh context.
For migration benchmarks, include tasks that:
- fit comfortably inside 400K;
- approach the context ceiling;
- produce large test logs;
- require many iterative tool turns.
This reveals whether a newer model’s context management improves completion rather than merely providing a larger technical limit.
Context window
400,000
Max output
128,000
GPT-5.1 Codex used a single 400K context window. GPT-5.1 Codex Max later introduced native multi-context execution through compaction.
07 / Prompt caching
GPT-5.1 Codex Supported Extended Prompt Caching
The GPT-5.1 generation supported extended prompt-cache retention of up to 24 hours, which was particularly useful for coding sessions that repeatedly reused stable instructions, tool definitions, and project context.
A Repository Session Often Reuses the Same Prefix
Stable coding-agent context can include:
- system instructions;
- tool schemas;
- repository rules;
- coding standards;
- architecture notes;
- long reference files.
Without caching, the application can pay the full input rate every time that stable prefix is sent.
Historical cached-input pricing for GPT-5.1 Codex was $0.125 per million tokens—one tenth of the standard $1.25 input price.
OpenAI’s prompt-caching documentation lists GPT-5.1 Codex among the older models that supported up to 24-hour extended retention.
That made caching relevant to:
- long coding sessions;
- repeated issue work in the same repository;
- tool-heavy agents;
- evaluation harnesses that replay similar prefixes.
Caching does not replace context management.
Tool results, changing files, new user instructions, and generated state still grow dynamically.
Measure actual cache-hit behavior rather than assuming every repeated-looking request receives the discount.
- 01
Keep stable instructions first
Place reusable system instructions, repository guidance, and tool definitions in stable prompt prefixes.
- 02
Reuse project context
Long coding sessions can benefit when unchanged source or reference material remains cache-compatible.
- 03
Use extended retention
GPT-5.1 Codex supported the older 24-hour prompt-cache retention mechanism.
- 04
Measure real hits
Calculate savings from observed cached tokens rather than from theoretical prefix reuse.
08 / Responses API
GPT-5.1 Codex Was Responses-API Only
OpenAI exposed GPT-5.1 Codex through the Responses API, matching its role as a tool-driven coding agent rather than a conventional chat-completion model.
Agent State Was Part of the API Design
The official model page lists:
- Responses API: supported;
- streaming: supported;
- function calling: supported;
- structured outputs: supported;
- reasoning tokens: supported;
- image input: supported.
It lists Chat Completions and other non-Responses endpoints as unsupported for this model.
Fine-tuning and predicted outputs were also unsupported.
This API choice matters in migration.
A Codex-style integration can contain structured response items for:
- model messages;
- function calls;
- tool outputs;
- reasoning-related state;
- structured results.
Replacing GPT-5.1 Codex should ideally preserve this agent architecture first.
If the model, endpoint, tools, and state-management strategy all change at once, it becomes harder to isolate regressions.
- Supported
Responses API
The supported API surface for GPT-5.1 Codex and its agentic workflow.
- Supported
Streaming
Receive model output incrementally during interactive coding work.
- Supported
Function calling
Connect model decisions to application-defined repository and engineering tools.
- Supported
Structured outputs
Return schema-constrained data when the coding harness requires machine-readable output.
- Supported
Image input
Use screenshots and visual references for frontend, debugging, and UI implementation tasks.
- Not listed
Fine-tuning
The official model page lists fine-tuning as unsupported.
09 / Codex Max comparison
GPT-5.1 Codex vs GPT-5.1 Codex Max
GPT-5.1 Codex Max arrived only six days after GPT-5.1 Codex and became the default Codex model, making the original 5.1 Codex a short-lived but useful pre-compaction baseline.
Max Changed the Long-Horizon Architecture
OpenAI introduced GPT-5.1 Codex Max on November 19, 2025.
Starting that day, Max replaced GPT-5.1 Codex as the default model across Codex surfaces.
The most important difference was compaction.
GPT-5.1 Codex:
- 400K native context window;
- designed for longer-running agentic coding;
- reasoning-token support;
- strong repository task baseline;
- no native multi-context compaction positioning.
GPT-5.1 Codex Max:
- same 400K per-window model specification;
- natively trained to work across multiple context windows;
- automatically compacts state in Codex as a window fills;
- designed for project-scale refactors and multi-hour agent loops;
- added
xhighas a deeper reasoning option for difficult tasks.
OpenAI reported that Max at medium effort achieved better SWE-bench Verified performance than GPT-5.1 Codex at medium while using about 30% fewer thinking tokens.
Published evaluation results also show the transition:
- SWE-bench Verified: GPT-5.1 Codex
high— 73.7%; - SWE-Lancer IC SWE: GPT-5.1 Codex
high— 66.3%; - Terminal-Bench 2.0: GPT-5.1 Codex
high— 52.8%.
Max improved on each of those reported baselines.
That makes GPT-5.1 Codex especially valuable today as the before-compaction benchmark for long-horizon Codex evolution.
- 01
5.1 Codex · one-window baseline
Long-running agentic coding inside the model’s 400K working context.
- 02
Codex Max · compaction
Native multi-context operation lets the agent compress earlier state and continue through additional windows.
- 03
Higher efficiency
OpenAI reported better medium-effort performance for Max with roughly 30% fewer thinking tokens than 5.1 Codex.
- 04
Use historical tasks
Replay the same repository work to measure how compaction and later Codex training changed completion behavior.
10 / GPT-5 Codex comparison
GPT-5.1 Codex vs GPT-5 Codex
GPT-5.1 Codex preserved the same headline context limits and token rates as GPT-5 Codex, so its identity came from newer GPT-5.1 training and a stronger emphasis on longer-running agentic coding—not a larger context window or cheaper price.
Same Envelope, Newer Coding Generation
Both models used:
- 400K context;
- 128K maximum output;
- $1.25 input;
- $0.125 cached input;
- $10 output;
- text and image input;
- Responses API;
- reasoning tokens;
- function calling;
- structured outputs.
GPT-5 Codex established the GPT-5 coding-agent pattern.
GPT-5.1 Codex carried that pattern into the GPT-5.1 generation and was explicitly released for longer-running agentic coding tasks.
Because the technical envelope was so similar, a migration benchmark should emphasize behavior:
- persistence;
- tool discipline;
- repository navigation;
- repair quality;
- code completeness;
- test success;
- token efficiency.
This distinction also makes the pages SEO-separable.
GPT-5 Codex is the original specialized GPT-5 coding model.
GPT-5.1 Codex is the longer-running GPT-5.1 Codex baseline immediately before compaction changed the architecture with Codex Max.
- 01
GPT-5 Codex
Established the specialized GPT-5 agentic-coding model for iterative repository work.
- 02
GPT-5.1 Codex
Moved Codex into the GPT-5.1 generation with explicit positioning around longer-running agentic coding.
- 03
Same headline limits
Both used a 400K context, 128K output, and the same $1.25/$10 token rates.
- 04
Compare behavior, not specs
Persistence, patch quality, test recovery, and task completion expose the meaningful generation difference.
11 / Retirement
GPT-5.1 Codex Is Retired From the OpenAI API
OpenAI deprecated GPT-5.1 Codex in April 2026 and shut down API access on July 23, 2026.
The Model Is Beyond the Migration Window
For gpt-5.1-codex, the lifecycle was:
- API release: November 13, 2025;
- replaced as default Codex model by GPT-5.1 Codex Max: November 19, 2025;
- deprecation announcement: April 22, 2026;
- API shutdown: July 23, 2026;
- substitute:
gpt-5.6-sol.
The official model page continues to label GPT-5.1 Codex as deprecated, but OpenAI’s deprecation table confirms that its shutdown date has passed.
Operationally, it is a retired API model.
A historical model page remains useful because organizations may still have:
- old model IDs in source code;
- saved evaluations;
- archived Codex traces;
- historical token reports;
- prompt and tool configurations tuned for 5.1 Codex;
- regression tests based on its behavior.
Do not send new production traffic to gpt-5.1-codex.
Use a supported model and treat the old one as a migration reference.
- 01
Released · Nov 13, 2025
OpenAI released GPT-5.1 Codex and Codex Mini through the Responses API for longer-running agentic coding.
- 02
Default replaced · Nov 19, 2025
GPT-5.1 Codex Max became the default model across Codex surfaces.
- 03
Deprecated · Apr 22, 2026
OpenAI announced the July retirement of older GPT and Codex model variants.
- 04
Shut down · Jul 23, 2026
API access ended. OpenAI’s deprecation table names GPT-5.6 Sol as the substitute.
12 / Migration
Migrating From GPT-5.1 Codex to GPT-5.6 Sol
OpenAI’s deprecation documentation names GPT-5.6 Sol as the substitute for GPT-5.1 Codex, but a coding-agent migration should preserve the original repository workload and harness before changing model-specific controls.
Migrate the Engineering Outcome, Not Just the Model ID
Build a regression set from real historical tasks.
Include:
- small bug fixes;
- feature implementation;
- multi-file refactoring;
- failing-test repair;
- repository Q&A;
- frontend work with screenshots;
- long debugging sessions;
- tasks that approached the old 400K context limit.
Preserve:
- repository revision;
- system instructions;
- agent tools;
- patch mechanism;
- shell environment;
- tests;
- network restrictions;
- acceptance criteria.
Then change the model.
Measure:
- accepted patch rate;
- tests passed;
- reasoning tokens;
- context tokens;
- cache behavior;
- tool calls;
- failed approaches;
- elapsed time;
- total cost;
- human correction.
Newer OpenAI model families also changed reasoning and context-management behavior.
Do not assume a historical GPT-5.1 Codex effort configuration maps directly to a modern model.
Run a new reasoning-effort sweep.
Likewise, do not automatically expand the amount of repository context sent just because a newer model supports more.
Start from the old context strategy so the model difference is observable.
- 01
Freeze the baseline
Preserve repository revisions, issue prompts, tests, accepted patches, and historical task outcomes.
- 02
Keep the harness stable
Hold tool access, patch behavior, shell commands, and validation criteria constant during the first model comparison.
- 03
Recalibrate reasoning and context
Evaluate modern effort and context controls empirically rather than copying old settings.
- 04
Compare completed-task economics
Use final task success, retries, tools, reasoning, latency, and total cost as the migration decision metric.
13 / Evaluation
GPT-5.1 Codex Strengths and Limitations
GPT-5.1 Codex is historically important as the longer-running GPT-5.1 coding-agent baseline immediately before GPT-5.1 Codex Max introduced compaction and multi-context execution.
Historical strengths
Long-running agentic coding
OpenAI explicitly released GPT-5.1 Codex for longer-running coding tasks in Codex and Codex-like environments.
Repository-scale workflow
Designed for iterative software engineering where files, tools, tests, failures, and repair loops are part of model performance.
400K context and 128K output
Substantial working capacity supported repository context, instructions, tool results, reasoning, and large code changes.
24-hour prompt-cache support
Extended caching could reduce repeated-prefix cost during long coding sessions and evaluation runs.
What to consider
API access has ended
OpenAI shut down gpt-5.1-codex on July 23, 2026.
Pre-compaction architecture
GPT-5.1 Codex worked inside a single 400K context window; Codex Max later added native multi-window compaction for much longer tasks.
Responses API only
The model was built around the Responses agent interface rather than Chat Completions.
Superseded quickly
GPT-5.1 Codex Max replaced it as the default Codex model only six days after the original 5.1 Codex API release.
Preserve the pre-Max Codex baseline
Replay GPT-5.1 Codex tasks with a supported model
Use real repositories, issue prompts, test suites, refactors, debugging loops, tool traces, and accepted patches to measure whether a supported replacement preserves long-running coding quality, reasoning efficiency, latency, and cost.
Start FreeGPT-5.1 Codex is retired from the OpenAI API. OpenAI’s deprecation table names GPT-5.6 Sol as the substitute.
Common Questions
What was GPT-5.1 Codex?
GPT-5.1 Codex was OpenAI’s GPT-5.1 coding-specialized model for longer-running agentic software-engineering work in Codex and Codex-like environments.
What was the GPT-5.1 Codex model ID?
The API model ID was gpt-5.1-codex.
When was GPT-5.1 Codex released?
OpenAI released gpt-5.1-codex through the Responses API on November 13, 2025.
Is GPT-5.1 Codex still available?
No. OpenAI deprecated GPT-5.1 Codex in April 2026 and shut down API access on July 23, 2026.
What model replaces GPT-5.1 Codex?
OpenAI’s API deprecation documentation names gpt-5.6-sol as the substitute for gpt-5.1-codex.
What was GPT-5.1 Codex optimized for?
It was optimized for longer-running agentic coding tasks such as repository exploration, implementation, debugging, testing, refactoring, and iterative repair.
What was the GPT-5.1 Codex context window?
GPT-5.1 Codex had a 400,000-token context window.
What was the maximum output for GPT-5.1 Codex?
The official model specification listed a maximum output of 128,000 tokens.
What input and output modalities did GPT-5.1 Codex support?
It supported text and image input and generated text output.
What was the GPT-5.1 Codex knowledge cutoff?
OpenAI listed September 30, 2024 as the knowledge cutoff.
How much did GPT-5.1 Codex 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 support reasoning tokens?
Yes. The model supported reasoning tokens for codebase understanding, tool selection, debugging, and implementation decisions.
Did GPT-5.1 Codex support prompt caching?
Yes. The GPT-5.1 generation supported extended prompt-cache retention of up to 24 hours, and GPT-5.1 Codex was included among the supported older models.
Was GPT-5.1 Codex available through Chat Completions?
No. OpenAI exposed GPT-5.1 Codex through the Responses API rather than Chat Completions.
Did GPT-5.1 Codex support function calling and structured outputs?
Yes. The official model page listed both function calling and structured outputs as supported.
Could GPT-5.1 Codex be fine-tuned?
No. The official model page listed fine-tuning as unsupported.
What is the difference between GPT-5.1 Codex and GPT-5.1 Codex Max?
GPT-5.1 Codex used a single 400K context window, while GPT-5.1 Codex Max introduced native multi-context execution through compaction and became the default Codex model six days later.
What is the difference between GPT-5.1 Codex and GPT-5 Codex?
Both shared the same 400K context, 128K output, and headline token pricing, but GPT-5.1 Codex moved the coding-agent pattern into the GPT-5.1 generation with stronger emphasis on longer-running agentic coding.
How should teams migrate from GPT-5.1 Codex?
Preserve the original repository revisions, prompts, tools, tests, and acceptance criteria, then replay those tasks with GPT-5.6 Sol or another supported model and compare completed-task quality, reasoning, tool use, latency, and cost.
Model information
Last updated
Specifications, pricing, context limits, supported modalities, API surface, reasoning support, prompt caching, release timing, Codex positioning, GPT-5.1 Codex Max comparisons, lifecycle status, and migration guidance on this page are based on OpenAI’s official GPT-5.1 Codex model page, GPT-5.1 developer release, GPT-5.1 Codex Max announcement, API changelog, prompt-caching documentation, and deprecations documentation.