OpenAI retired Codex model
GPT-5 Codex
OpenAI’s first GPT-5 variant purpose-built for agentic software engineering: repository work, iterative implementation, testing, debugging, large refactors, code review, and long-running coding tasks. The API model was retired in July 2026.
- 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 Codex Was
GPT-5 Codex was OpenAI’s coding-specialized version of GPT-5, trained specifically for agentic software engineering rather than general-purpose reasoning across every domain.
The First GPT-5 Model Purpose-Built for Codex
OpenAI introduced GPT-5 Codex on September 15, 2025 and expanded API-key access on September 23, 2025.
The model was designed for work where coding is an iterative process rather than a single prompt-to-code response.
OpenAI trained GPT-5 Codex on complex real-world engineering tasks including:
- building complete projects from scratch;
- adding features;
- writing tests;
- debugging;
- large-scale refactoring;
- code review;
- repeated test-and-fix loops.
Its role was deliberately narrower than ordinary GPT-5.
OpenAI recommended GPT-5 Codex specifically for agentic coding in Codex or Codex-like environments, while general GPT-5 remained the broader model for non-coding tasks.
The model exposed:
- a 400,000-token context window;
- up to 128,000 output tokens;
- text input and output;
- image input;
- reasoning tokens;
- streaming;
- function calling;
- structured outputs;
- Responses API access.
GPT-5 Codex is no longer available through the API. OpenAI shut it down on July 23, 2026.
- Provider
- OpenAI
- Family
- GPT-5 Codex
- Model ID
- gpt-5-codex
- Released
- Sep 15, 2025
- API access
- Retired
- Knowledge cutoff
- Sep 30, 2024
- Input
- Text, Image
- Output
- Text
02 / Agentic coding
GPT-5 Codex Was Designed to Work Inside a Repository
The defining difference between GPT-5 Codex and a normal code-generation model was the workflow: inspect the environment, edit files, run commands, observe failures, revise the implementation, and continue until the software task is actually complete.
Coding as an Execution Loop
A one-shot coding benchmark can hide the hardest part of production software work.
The model needs to understand:
- repository structure;
- project conventions;
- dependencies;
- tests;
- build commands;
- local instructions;
- existing implementation patterns;
- tool output;
- failure states.
GPT-5 Codex was optimized for that execution loop.
OpenAI described it as stronger at:
- implementing complete features;
- building projects;
- fixing bugs;
- writing and repairing tests;
- large refactors;
- code reviews;
- interactive pairing;
- independent cloud execution.
That makes the most useful evaluation unit a completed engineering task, not a single completion.
Measure:
- accepted patch rate;
- tests passed;
- files touched;
- unnecessary changes;
- commands executed;
- repair iterations;
- regressions;
- human corrections;
- time to accepted result.
- 01
Inspect
Read repository instructions, locate relevant files, understand dependencies, and identify the actual implementation surface.
- 02
Implement
Edit code and tests using the conventions already present in the project.
- 03
Run and observe
Execute tests, builds, linters, or other validation tools and inspect the real result.
- 04
Repair
Use failures as new evidence and continue iterating until the implementation satisfies the task.
03 / Long-running tasks
From Fast Pairing to Seven-Hour Autonomous Tasks
GPT-5 Codex dynamically changed how much work it performed based on task complexity, allowing the same model to respond quickly to a small edit or spend hours on a difficult repository-level task.
The Model Did Not Treat Every Turn the Same
OpenAI reported a large difference in model-generated token usage between easy and difficult work.
For the bottom 10% of internal user turns by generated tokens, GPT-5 Codex used 93.7% fewer tokens than GPT-5.
For the top 10%, GPT-5 Codex spent roughly twice as long reasoning, editing, testing, and iterating.
OpenAI also reported seeing the model work independently for more than seven hours on large, complex tasks during testing.
That behavior is central to the GPT-5 Codex identity.
The model was not simply configured to “reason more.”
It was trained to scale the entire engineering trajectory:
- inspect;
- plan;
- edit;
- test;
- diagnose;
- repair;
- repeat.
For migration, preserve both ends of the workload.
A replacement should be evaluated on:
- quick interactive edits;
- medium implementation tasks;
- long-running refactors;
- tasks with multiple test failures;
- tasks requiring recovery after a wrong approach.
- 01
Small task
Respond quickly to a focused question, tiny fix, or interactive coding request.
- 02
Medium task
Inspect several files, implement a feature, add tests, and validate the result.
- 03
Large task
Continue through long refactors, repeated failures, broad code changes, and multiple validation cycles.
- 04
Measure completion
Compare how much total model work is required to reach an accepted implementation, not only time to first response.
04 / Code review
Code Review Was a First-Class GPT-5 Codex Workload
OpenAI trained GPT-5 Codex specifically to review code, navigate dependencies, run tests, and identify important defects rather than producing a large number of low-value comments.
Review Quality Is About Signal, Not Comment Count
A useful automated code reviewer should not merely restate the diff.
It should determine:
- what changed;
- what depends on the changed code;
- whether behavior is correct;
- whether tests cover the risk;
- whether the patch introduces regressions;
- which findings deserve developer attention.
OpenAI evaluated GPT-5 Codex review comments on recent commits from popular open-source repositories using experienced software engineers.
The intended behavior was to reduce incorrect or unimportant comments and reserve reviewer attention for critical issues.
This is a useful legacy evaluation category because code review exercises a different skill profile from code generation.
When migrating, replay:
- bug-introducing diffs;
- large pull requests;
- changes with hidden dependency effects;
- tests with incomplete coverage;
- security-sensitive changes;
- refactors that preserve behavior.
Track:
- valid findings;
- severity;
- false positives;
- duplicate findings;
- missed critical issues;
- useful suggested fixes.
- 01
Understand the change
Inspect the diff and surrounding repository context rather than reviewing isolated lines.
- 02
Trace dependencies
Follow how the changed code affects callers, state, tests, and adjacent functionality.
- 03
Validate
Run code or tests when available instead of relying only on static inspection.
- 04
Prioritize findings
Prefer important correctness issues over large volumes of speculative or cosmetic review comments.
05 / Pricing
GPT-5 Codex Pricing
GPT-5 Codex used the same token pricing as the original GPT-5: $1.25 per million input tokens, $0.125 per million cached input tokens, and $10 per million output tokens.
Agent Cost Is Larger Than One Request
Historical API rates were:
- input: $1.25 per 1M tokens;
- cached input: $0.125 per 1M tokens;
- output: $10.00 per 1M tokens.
Reasoning tokens are part of the generated-token economics.
For an agentic coding task, a single headline rate is not enough to estimate cost.
A coding trajectory can include:
- repository context;
- repeated tool results;
- hidden reasoning;
- visible progress;
- generated patches;
- test output;
- repair attempts;
- multiple responses.
That is why historical migration should compare cost per accepted patch or cost per completed task.
A replacement that costs less per token may still cost more if it needs more failed attempts.
A replacement that costs more per token may be cheaper if it completes the task in fewer iterations.
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 Codex provided a 400,000-token context window and up to 128,000 output tokens, giving the original GPT-5 coding agent enough capacity for substantial repository context, instructions, tool results, and long implementation work.
Context Is Shared by the Entire Engineering State
A repository agent’s context can include:
- system and developer instructions;
AGENTS.mdcontent;- user requirements;
- source files;
- test files;
- tool definitions;
- command output;
- error logs;
- prior changes;
- reasoning state;
- previous response items.
Large context helps, but repository-scale tasks can still exceed 400K if the agent reads indiscriminately.
The quality of context selection therefore remains part of the agent.
A strong coding workflow should:
- read the minimum useful file set;
- search before opening broad directories;
- avoid repeatedly rereading unchanged files;
- summarize long command output when possible;
- preserve high-value state across turns.
The model’s 128K maximum output also leaves significant headroom for reasoning plus visible generated content, but a larger output limit does not mean a coding task should return a giant patch without intermediate validation.
Context window
400,000
Max output
128,000
The 400K context is shared by instructions, repository content, prior responses, tool results, and other request state.
07 / Dynamic reasoning
GPT-5 Codex Adapted Its Reasoning to Task Complexity
OpenAI designed GPT-5 Codex to spend less model work on easy requests and substantially more time on difficult software-engineering tasks instead of treating every coding turn as the same-size reasoning problem.
Reasoning Was Part of the Agent Loop
Reasoning tokens let a model plan, inspect alternatives, decide when to use tools, diagnose failures, and determine what to do next.
For coding agents, that reasoning is intertwined with execution.
The model may:
- inspect the repository;
- form a hypothesis;
- edit code;
- run tests;
- observe a failure;
- revise its understanding;
- edit again;
- verify completion.
OpenAI’s launch data showed that GPT-5 Codex could dramatically reduce generated tokens on simpler turns while expanding work on difficult ones.
This is a more useful historical distinction than merely labeling the model “high reasoning.”
The agent was optimized for adaptive software-engineering effort.
When evaluating a replacement, preserve the original task difficulty distribution.
Do not benchmark only the hardest repository tasks or only easy edits.
Measure:
- reasoning tokens;
- total generated tokens;
- tool calls;
- elapsed task time;
- repair iterations;
- accepted-result quality.
- 01
Easy request
Use less hidden reasoning and return a focused implementation or explanation quickly.
- 02
Ambiguous request
Inspect additional context and reason about the project before committing to a change.
- 03
Failed implementation
Use test output and tool results as new evidence instead of repeating the same solution.
- 04
Hard repository task
Spend substantially more time reasoning, editing, testing, and iterating when completion requires it.
08 / AGENTS.md
GPT-5 Codex Was Trained to Follow AGENTS.md Closely
OpenAI highlighted stronger steerability and better adherence to AGENTS.md, making repository-local instructions a first-class part of the GPT-5 Codex workflow.
Project Instructions Belong in the Agent Environment
Codex uses AGENTS.md files to provide durable instructions about the repository.
These files can describe:
- project structure;
- coding standards;
- test commands;
- architectural boundaries;
- naming conventions;
- validation steps;
- folders that should not be modified;
- repository-specific workflows.
OpenAI’s Codex tooling discovers and injects these instructions into the working conversation.
Global instructions are combined with repository and deeper-directory instructions, allowing more specific guidance to override broader rules.
This matters for model evaluation.
A coding model that ignores repository instructions may produce superficially correct code that still violates the project.
Useful tests include:
- obeying a required test command;
- respecting directory-specific conventions;
- preserving forbidden files;
- following requested frameworks;
- avoiding prohibited dependencies;
- using repository-specific formatting or architecture.
When migrating from GPT-5 Codex, keep the same AGENTS.md hierarchy so changes in model behavior are not confused with changes in instructions.
- 01
Global guidance
Apply broad developer preferences and Codex instructions.
- 02
Repository guidance
Load the project’s AGENTS.md rules for architecture, commands, and coding conventions.
- 03
Directory guidance
Apply more specific instructions as the agent moves into deeper parts of the repository.
- 04
Evaluate adherence
Treat ignored repository instructions as a model failure even when the generated code appears functional.
09 / Responses API
GPT-5 Codex Was a Responses-API-Only Model
OpenAI exposed GPT-5 Codex through the Responses API rather than Chat Completions, aligning the model with persistent agent state, tools, reasoning items, and iterative workflows.
The API Choice Reflected the Model’s Purpose
The official model page lists GPT-5 Codex as available in the Responses API only.
The model supported:
- streaming;
- function calling;
- structured outputs;
- reasoning tokens;
- text input and output;
- image input.
It did not support:
- audio input or output;
- video input;
- fine-tuning;
- predicted outputs.
The Responses API is better suited to an agent loop because the response can include structured items rather than only a chat message.
Applications can maintain:
- model responses;
- tool calls;
- tool outputs;
- reasoning-related state;
- structured results.
For migration, preserve the Responses API architecture where possible.
OpenAI’s current guidance continues to favor Responses for reasoning models and tool-based agentic workflows.
- Supported
Responses API
GPT-5 Codex was exposed through Responses for agentic coding and tool-driven workflows.
- Supported
Streaming
Receive output incrementally while the coding task progresses.
- Supported
Function calling
Call application-defined tools as part of an iterative agent trajectory.
- Supported
Structured outputs
Return machine-readable results when the surrounding workflow requires a schema.
- Supported
Image input
Use screenshots and other visual context as input for front-end and debugging tasks.
- Not listed
Fine-tuning
The official model page lists fine-tuning as unsupported.
10 / Retirement
GPT-5 Codex Is Retired From the OpenAI API
OpenAI deprecated GPT-5 Codex as part of its cleanup of older GPT and Codex variants and shut down API access on July 23, 2026.
Deprecated and Shut Down Are Different States
OpenAI uses deprecation to give developers advance notice.
A deprecated model may still work until its shutdown date.
After shutdown, the model is no longer accessible through the API.
For gpt-5-codex:
- launch: September 15, 2025;
- API-key availability announced: September 23, 2025;
- deprecation group announced: April 22, 2026;
- API shutdown: July 23, 2026;
- recommended substitute:
gpt-5.6-sol.
The current model documentation still marks GPT-5 Codex as deprecated, but the deprecation table confirms that the shutdown date has already passed.
Operationally, this means retired API model.
Do not start a new API integration with gpt-5-codex.
Preserve the model page because old code, documentation, benchmark results, pricing calculations, and Codex traces can still reference it.
- 01
Released · Sep 15, 2025
OpenAI introduced GPT-5 Codex as a GPT-5 model optimized specifically for agentic software engineering.
- 02
API-key access · Sep 23, 2025
OpenAI expanded access to developers using Codex through an API key and exposed the model through Responses.
- 03
Deprecated · Apr 22, 2026
OpenAI announced removal of GPT-5 Codex and several other older GPT and Codex variants.
- 04
Shut down · Jul 23, 2026
API access ended. OpenAI’s deprecation table names GPT-5.6 Sol as the substitute.
11 / Migration
Migrating From GPT-5 Codex to GPT-5.6 Sol
OpenAI names GPT-5.6 Sol as the official substitute for GPT-5 Codex, but the safest migration path is to replay the original engineering workload rather than assuming model behavior is equivalent.
Preserve the Workflow, Then Change the Model
The original GPT-5 Codex integration was optimized around:
- repository navigation;
- AGENTS.md instructions;
- iterative tool use;
- long-running reasoning;
- code review;
- tests and validation;
- Responses API state.
Keep those parts stable during the first migration evaluation.
Then compare replacement behavior.
Use representative tasks from production:
- small bug fix;
- feature implementation;
- multi-file refactor;
- test repair;
- front-end change using screenshots;
- code review;
- long-running task with repeated failures.
Measure:
- accepted patch rate;
- tests passed;
- reasoning and output tokens;
- commands and tool calls;
- latency;
- number of repair cycles;
- unnecessary edits;
- human corrections;
- total task cost.
Newer model generations also expose different reasoning controls.
Do not copy an old reasoning setting blindly.
Run an effort sweep using the currently supported values for the replacement model and find the cheapest setting that preserves task completion.
- 01
Preserve regression tasks
Keep real issue prompts, repositories, expected tests, review findings, and old accepted patches.
- 02
Keep the agent environment
Preserve AGENTS.md, tool access, sandbox constraints, validation commands, and repository state.
- 03
Recalibrate reasoning
Evaluate current reasoning controls on the replacement instead of assuming historical Codex behavior maps one-to-one.
- 04
Compare completed-task economics
Measure quality, retries, tool usage, latency, reasoning tokens, and cost through the final accepted patch.
12 / Evaluation
GPT-5 Codex Strengths and Limitations
GPT-5 Codex is historically important because it established the GPT-5 coding-agent pattern: dynamically scale work, follow repository instructions, use tools, iterate against tests, and review code as an engineering task rather than a text-generation exercise.
Historical strengths
Purpose-built agentic coding
Trained for full engineering workflows including implementation, debugging, testing, large refactors, and code review.
Adaptive task duration
OpenAI reported much lower model work on easy turns and substantially longer autonomous execution on difficult repository tasks.
Strong repository instruction following
GPT-5 Codex was trained for better steerability and close adherence to AGENTS.md project instructions.
Code-review specialization
The model was explicitly trained to find important defects while reducing incorrect or low-value review comments.
What to consider
API access has ended
OpenAI shut down gpt-5-codex on July 23, 2026, so new API traffic must use another model.
Coding-only specialization
OpenAI recommended GPT-5 Codex specifically for agentic coding rather than general-purpose non-coding workloads.
Responses API only
The model was not a drop-in Chat Completions model; legacy integrations need to preserve or migrate their Responses-based agent architecture.
Historical economics
$1.25/$10 pricing is useful for regression analysis, but current migration decisions should use the pricing and behavior of supported replacement models.
Preserve the coding-agent baseline
Replay GPT-5 Codex tasks with a supported model
Use your historical repositories, issue prompts, test suites, refactors, review cases, and tool traces to measure whether a supported replacement preserves coding quality, agent discipline, latency, and cost per accepted patch.
Start FreeGPT-5 Codex is retired from the OpenAI API. OpenAI’s deprecation table recommends GPT-5.6 Sol as the substitute.
Common Questions
What is GPT-5 Codex?
GPT-5 Codex is a retired OpenAI model that specialized GPT-5 for agentic software engineering in Codex and Codex-like environments.
What is the GPT-5 Codex model ID?
The API model ID was gpt-5-codex.
When was GPT-5 Codex released?
OpenAI introduced GPT-5 Codex on September 15, 2025. API-key access for developers using Codex was announced on September 23, 2025.
Is GPT-5 Codex deprecated?
Yes, and its shutdown date has already passed. OpenAI deprecated GPT-5 Codex in April 2026 and shut down API access on July 23, 2026.
Can I still call GPT-5 Codex through the OpenAI API?
No. OpenAI’s deprecation table lists July 23, 2026 as the shutdown date for gpt-5-codex.
What model replaces GPT-5 Codex?
OpenAI’s API deprecation documentation names gpt-5.6-sol as the recommended substitute for gpt-5-codex.
What was GPT-5 Codex optimized for?
It was optimized for agentic coding tasks such as building projects, adding features and tests, debugging, large-scale refactoring, iterative repair, and code review.
What is the GPT-5 Codex context window?
GPT-5 Codex has a 400,000-token context window.
What is the GPT-5 Codex maximum output?
The official model page lists a maximum output of 128,000 tokens.
What input types does GPT-5 Codex support?
The model supports text input and image input and generates text output. Audio and video are not supported.
What is the GPT-5 Codex knowledge cutoff?
OpenAI’s model page lists September 30, 2024 as the knowledge cutoff.
How much did GPT-5 Codex cost?
Historical pricing was $1.25 per 1M input tokens, $0.125 per 1M cached input tokens, and $10 per 1M output tokens.
Was GPT-5 Codex available in Chat Completions?
No. OpenAI documented GPT-5 Codex as a Responses-API-only model.
Does GPT-5 Codex support function calling?
Yes. The official model page lists function calling as supported.
Does GPT-5 Codex support structured outputs?
Yes. Structured outputs are listed as supported.
Does GPT-5 Codex support fine-tuning?
No. OpenAI’s model page lists fine-tuning as unsupported.
Why was GPT-5 Codex different from ordinary GPT-5?
GPT-5 Codex was trained specifically for real-world software engineering, long-running agentic execution, iterative testing and repair, stronger AGENTS.md adherence, large refactors, and code review. OpenAI recommended ordinary GPT-5 for broader non-coding use.
Could GPT-5 Codex work autonomously for long periods?
Yes. OpenAI reported that during testing GPT-5 Codex worked independently for more than seven hours on some large, complex engineering tasks while iterating, fixing test failures, and continuing toward completion.
How did GPT-5 Codex behave on simple versus difficult tasks?
OpenAI reported substantially lower generated-token use on the easiest internal turns and much longer reasoning, editing, testing, and iteration on the hardest turns.
Was GPT-5 Codex good for code review?
Yes. OpenAI trained it specifically for code review and evaluated its ability to navigate repositories, reason through dependencies, run tests, and prioritize important findings.
Did GPT-5 Codex use AGENTS.md?
Yes. OpenAI highlighted improved adherence to AGENTS.md instructions, and Codex tooling injects repository instruction files into the model’s working conversation.
Was GPT-5 Codex useful for front-end work?
Yes. OpenAI highlighted improved front-end performance and noted that Codex could use supplied images or screenshots to inspect visual progress in coding workflows.
Model information
Last updated
Release positioning, lifecycle, pricing, context limits, supported modalities, API surface, reasoning behavior, long-running coding behavior, code-review positioning, AGENTS.md adherence, and migration guidance on this page are based on OpenAI’s official GPT-5 Codex model page, Codex launch announcement, Codex prompting guidance, GPT-5 Codex system-card addendum, and API deprecations documentation.