OpenAI retired cost-efficient Codex model
GPT-5.1 Codex Mini
A smaller, lower-cost GPT-5.1 Codex model for agentic software-engineering workloads where throughput and cost mattered more than the full capability ceiling of the larger Codex tier.
- Context window
- 400K
- tokens
- Max output
- 128K
- tokens
- Input
- $0.25
- historical · per 1M
- Cached input
- $0.025
- historical · per 1M
- Output
- $2.00
- historical · per 1M
01 / Overview
What GPT-5.1 Codex Mini Was
GPT-5.1 Codex Mini was OpenAI’s smaller, more cost-effective, less-capable version of GPT-5.1 Codex for agentic coding workloads.
The Cost-Efficient Tier of the GPT-5.1 Codex Family
OpenAI released gpt-5.1-codex-mini through the Responses API on November 13, 2025 alongside GPT-5.1 Codex.
Both models targeted agentic software engineering, but their roles were different.
GPT-5.1 Codex targeted stronger repository-level coding capability.
GPT-5.1 Codex Mini targeted the same broad workflow category at a much lower token price.
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;
- no fine-tuning;
- no predicted outputs.
The model is now retired.
OpenAI shut down API access on July 23, 2026.
Its current value is as a historical baseline for cost-sensitive coding agents, model routing, and migration analysis.
- Provider
- OpenAI
- Family
- GPT-5.1 Codex
- Model ID
- gpt-5.1-codex-mini
- API release
- Nov 13, 2025
- Status
- Retired
- Knowledge cutoff
- Sep 30, 2024
- Input
- Text, Image
- Output
- Text
02 / Cost-efficient coding
Five Times Lower Token Rates Than GPT-5.1 Codex
GPT-5.1 Codex Mini kept the same headline context and output limits as GPT-5.1 Codex while reducing standard input and output token rates by 80%.
The Tradeoff Was Capability, Not Capacity
GPT-5.1 Codex Mini and GPT-5.1 Codex both offered:
- 400K context;
- 128K maximum output;
- image input;
- reasoning-token support;
- Responses API;
- function calling;
- structured outputs.
But the price difference was substantial.
GPT-5.1 Codex Mini:
- $0.25 input per 1M tokens;
- $0.025 cached input;
- $2 output.
GPT-5.1 Codex:
- $1.25 input;
- $0.125 cached input;
- $10 output.
Mini was therefore 5× cheaper on each headline text-token category.
OpenAI explicitly described Mini as less capable.
That means the correct economic question is not which model has the lower token rate. It is which model produces the lowest cost per accepted coding task.
If Mini succeeds on the first attempt, the savings can be large.
If it needs multiple retries, produces rejected patches, or requires escalation on every difficult task, the effective savings shrink.
- 01
Same working envelope
Mini retained the 400K context and 128K output limits of GPT-5.1 Codex.
- 02
Five times lower token rates
Input, cached input, and output rates were each one fifth of GPT-5.1 Codex.
- 03
Lower capability ceiling
OpenAI explicitly described Mini as less capable, so savings depended on choosing the right task class.
- 04
Measure accepted-task cost
Include retries, failed patches, human corrections, and escalation when evaluating the real economic advantage.
03 / Routing & escalation
GPT-5.1 Codex Mini Made Model Routing Economically Interesting
A lower-cost coding model is most valuable when an application can identify routine work that does not require the strongest model and escalate uncertain cases before they create expensive failures.
Route Easy Work, Escalate Hard Work
Good historical Mini candidates include:
- small, clearly specified edits;
- simple bug fixes;
- boilerplate updates;
- test additions with explicit acceptance criteria;
- narrow repository questions;
- mechanical refactors;
- predictable formatting or type fixes.
Escalation candidates include:
- ambiguous requirements;
- broad architectural changes;
- difficult debugging;
- security-sensitive changes;
- repository-wide refactors;
- repeated failed tests;
- tasks with unclear ownership across modules.
Useful escalation signals are observable rather than subjective:
- repeated validation failures;
- excessive patch scope;
- repeated edits to the same code;
- inability to locate the responsible code path;
- missing or inconclusive tests;
- build failures after multiple repair attempts.
- 01
Route
Send bounded, low-risk coding tasks to the lower-cost tier first.
- 02
Validate
Run tests, builds, linting, or task-specific acceptance checks after the proposed change.
- 03
Detect struggle
Use repeated failures, excessive scope, or incomplete validation as escalation signals.
- 04
Escalate
Move difficult or high-risk tasks to a stronger model while preserving the repository state and evidence already collected.
04 / Repository work
Where a Smaller Codex Model Could Still Be Useful
GPT-5.1 Codex Mini belonged to the agentic coding family, so its useful workload was repository work with tools and validation—not generic low-cost text generation.
Well-Scoped Tasks Were the Natural Fit
A smaller coding model benefits from clear boundaries.
The application should make it easy to determine which files matter, what behavior must change, what must stay unchanged, which tests prove completion, and when to stop.
Useful evaluation categories include:
Routine implementation — small features with explicit requirements and a limited implementation surface.
Bug repair — issues with a reproducible failing test or clear observed behavior.
Test work — adding or updating tests when expected outputs are known.
Mechanical refactoring — renames, type changes, API migrations, or repetitive transformations with strong validation.
Repository Q&A — locating implementation details or explaining a narrow code path.
A task can be long in tokens without being conceptually difficult. Mini retaining a 400K context window therefore mattered.
- 01
Bounded implementation
Use clear issue scope, known files, and explicit acceptance criteria.
- 02
Reproducible bug fix
Give the model a failing test or deterministic reproduction so progress can be measured.
- 03
Mechanical repository work
Evaluate repetitive or rule-based changes where correctness is easy to verify automatically.
- 04
Narrow codebase research
Use the model for focused repository questions when the answer can be checked against source files.
05 / Pricing
GPT-5.1 Codex Mini Pricing
GPT-5.1 Codex Mini cost $0.25 per million input tokens, $0.025 per million cached input tokens, and $2 per million output tokens.
Cheap Tokens Only Matter When the Patch Is Usable
Compared with GPT-5.1 Codex, every headline text-token rate was 5× lower.
For a simplified workload with 100K uncached input and 10K output:
- input cost: $0.025;
- output cost: $0.020;
- total token cost: $0.045.
The same simplified token mix at GPT-5.1 Codex’s historical rates would cost $0.225.
Coding-agent economics include more than one turn, however. Add retries, repeated context, tool output, reasoning tokens, failed patches, human correction, and escalation.
1M tokens · USD
- Input
- $0.25
- Cached input
- $0.025
- Output
- $2.00
Example: 100K input + 10K output
- Input cost
- $0.0250
- Output cost
- $0.0200
- Estimated token cost
- $0.0450
06 / Context
400K Context and 128K Maximum Output
GPT-5.1 Codex Mini kept the same 400,000-token context window and 128,000-token maximum output as GPT-5.1 Codex despite occupying the lower-cost capability tier.
Smaller Model Did Not Mean Smaller Context
The context window could hold system and developer instructions, repository guidance, source files, test files, image input, tool schemas, shell output, and previous response state.
A large context can be useful even on routine tasks because a narrow change may still live inside a large repository.
But a 400K ceiling does not justify sending everything. Excess context can increase input cost, dilute relevant instructions, reduce retrieval precision, and increase processing latency.
For cost-sensitive coding, selective context remains valuable: search first, read relevant files, reuse stable prefixes when caching applies, and keep acceptance criteria prominent.
Context window
400,000
Max output
128,000
GPT-5.1 Codex Mini and GPT-5.1 Codex shared the same headline context and output limits; the difference was capability and price rather than raw capacity.
07 / Reasoning
GPT-5.1 Codex Mini Supported Reasoning Tokens
OpenAI’s official model page lists reasoning-token support for GPT-5.1 Codex Mini, allowing internal model work to contribute to planning, code understanding, and tool decisions.
Reasoning Must Still Earn Its Cost
For a coding task, internal reasoning can help determine which files matter, how components interact, what caused a failure, whether a patch is too broad, and which validation step should run next.
The official Mini model page confirms reasoning-token support but does not document the same explicit reasoning-level list that newer OpenAI model pages expose.
Historical evaluation should therefore focus on measured usage rather than inventing a modern effort mapping.
Track reasoning tokens, visible output, tool calls, test failures, retries, and accepted patch rate.
A smaller model may need more iterations on difficult tasks even if each token is cheaper.
- 01
Plan
Use internal model work to locate the relevant code and decide on a bounded implementation strategy.
- 02
Execute
Edit files and use tools instead of relying only on a speculative text answer.
- 03
Diagnose
Treat failing tests and command output as new evidence for the next decision.
- 04
Escalate when needed
If reasoning and repair loops keep growing without convergence, move the task to a stronger model.
08 / Prompt caching
Cached Input Cost Only $0.025 per Million Tokens
Prompt caching made repeated stable context especially inexpensive on GPT-5.1 Codex Mini, with cached input priced at one tenth of its already-low standard input rate.
Repository Prefixes Can Be Reused
Stable prompt prefixes may contain system instructions, developer instructions, tool definitions, coding rules, repository guidance, and unchanged reference material.
The GPT-5.1 release also introduced extended prompt-cache retention for supported requests, allowing eligible prefixes to remain reusable for longer sessions.
For coding agents, this was useful because many turns may share the same repository instructions while only the task state or tool output changes.
Caching should be measured rather than assumed. Inspect actual cached-token usage and avoid invalidating stable prefixes unnecessarily.
- 01
Keep stable content first
Arrange reusable instructions, tool definitions, and project context so repeated prefixes can remain cache-friendly.
- 02
Reuse repository context
Avoid resending identical large prefixes at full input cost when a cache hit is available.
- 03
Measure cached tokens
Use actual usage data to determine whether the coding workflow receives the expected cache benefit.
- 04
Include cache in routing economics
A smaller model plus high cache-hit rate can materially change the cost of repeated repository tasks.
09 / Responses API
GPT-5.1 Codex Mini Was Released Through the Responses API
OpenAI launched GPT-5.1 Codex Mini through the Responses API for agentic coding workflows rather than positioning it as a general-purpose chat model.
The official model documentation lists support for streaming, function calling, structured outputs, reasoning tokens, text input and output, and image input.
Audio, video, fine-tuning, and predicted outputs are not supported.
The Responses architecture fits a coding agent because a task can contain structured model messages, tool calls, tool outputs, reasoning-related state, and schema-constrained results.
For migration, preserve the surrounding agent harness first. Changing the model and the entire orchestration layer simultaneously makes it difficult to determine why quality or cost changed.
- Supported
Responses API
OpenAI launched GPT-5.1 Codex Mini through Responses for agentic coding workflows.
- Supported
Streaming
Receive output progressively during interactive repository work.
- Supported
Function calling
Connect model decisions to repository, shell, test, and application-defined tools.
- Supported
Structured outputs
Return machine-readable results when the surrounding workflow requires a schema.
- Supported
Image input
Use screenshots and other visual references as coding context.
- Not listed
Fine-tuning
OpenAI lists fine-tuning as unsupported.
10 / Mini vs Codex
GPT-5.1 Codex Mini vs GPT-5.1 Codex
GPT-5.1 Codex Mini and GPT-5.1 Codex shared the same headline context and output limits, but OpenAI explicitly positioned Mini as smaller, cheaper, and less capable.
GPT-5.1 Codex Mini
- 400K context;
- 128K max output;
- $0.25 input;
- $0.025 cached input;
- $2 output;
- lower capability tier;
- suited to cost-sensitive agentic coding.
GPT-5.1 Codex
- 400K context;
- 128K max output;
- $1.25 input;
- $0.125 cached input;
- $10 output;
- higher capability tier;
- better fit for difficult repository work.
The difference was not context capacity. It was how much model capability you bought per request.
That makes their historical comparison ideal for routing experiments. Build easy, medium, hard, and high-risk task buckets, then measure which categories preserve quality at the lower tier.
- 01
Same 400K / 128K envelope
Mini did not sacrifice headline context or maximum output compared with GPT-5.1 Codex.
- 02
Five times cheaper
Every standard text-token rate was one fifth of the larger Codex model’s price.
- 03
Lower capability
OpenAI explicitly described Mini as less capable, so difficult tasks were more likely to need escalation.
- 04
Routing is the real comparison
The useful question is which task classes preserve quality at the lower tier and which require the stronger model.
11 / Retirement
GPT-5.1 Codex Mini Is Retired From the OpenAI API
OpenAI deprecated GPT-5.1 Codex Mini in April 2026 and shut down API access on July 23, 2026.
OpenAI Recommends GPT-5.6 Terra as the Substitute
The lifecycle was:
- API release: November 13, 2025;
- deprecation announcement: April 22, 2026;
- API shutdown: July 23, 2026;
- substitute:
gpt-5.6-terra.
This replacement differs from the larger Codex models.
For GPT-5.1 Codex and Codex Max, OpenAI names GPT-5.6 Sol.
For GPT-5.1 Codex Mini, OpenAI names GPT-5.6 Terra.
That preserves the original tier logic: Mini was the lower-cost coding tier, while Terra is the current model tier intended to balance intelligence and cost.
- 01
Released · Nov 13, 2025
OpenAI released GPT-5.1 Codex Mini alongside GPT-5.1 Codex through the Responses API.
- 02
Cost-efficient Codex tier
The model provided the same 400K context envelope at one fifth of the larger Codex model’s headline token rates.
- 03
Deprecated · Apr 22, 2026
OpenAI announced 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 Terra as the substitute.
12 / Migration
Migrating From GPT-5.1 Codex Mini to GPT-5.6 Terra
OpenAI names GPT-5.6 Terra as the substitute for GPT-5.1 Codex Mini, but the migration should preserve the original cost-sensitive task mix so the replacement can be evaluated on both quality and economics.
Rebuild the Routing Curve, Not Just the Model Call
Start with historical Mini tasks and separate them into routine edits, simple repairs, medium-complexity implementation, ambiguous work, and high-risk changes.
Preserve the repository revision, prompt, instructions, tools, shell environment, tests, and acceptance criteria.
Then replay the same tasks with Terra.
Measure:
- accepted patch rate;
- retries;
- reasoning usage;
- context usage;
- cache hits;
- tool calls;
- latency;
- cost;
- escalation frequency.
The replacement does not have the same price structure as historical Mini, so the old routing threshold may no longer be optimal.
Newer reasoning controls and a larger current context window can also change behavior. Recalibrate from real data.
- 01
Preserve the task distribution
Keep easy, medium, hard, and escalation examples instead of testing only one average coding task.
- 02
Hold the harness stable
Use the same repository, tools, tests, and acceptance criteria for the first replacement comparison.
- 03
Recalculate the routing threshold
Current token prices, reasoning behavior, and completion rates can change which jobs belong on the lower-cost tier.
- 04
Optimize cost per accepted task
Choose the model policy that minimizes total spend without increasing failed patches or human correction.
13 / Evaluation
GPT-5.1 Codex Mini Strengths and Limitations
GPT-5.1 Codex Mini is historically useful because it shows how OpenAI split agentic coding into capability tiers: the same large context envelope, but a much lower token price in exchange for a lower capability ceiling.
Historical strengths
Very low coding-model token price
$0.25 input and $2 output per million tokens made Mini one fifth the headline cost of GPT-5.1 Codex.
Full 400K context
The lower-cost tier retained the same 400K context and 128K maximum output as the larger GPT-5.1 Codex model.
Agentic coding feature set
Reasoning tokens, Responses, streaming, function calling, structured outputs, and image input supported tool-driven repository workflows.
Strong routing baseline
The model is a useful historical case for measuring which coding tasks can be handled economically by a smaller model.
What to consider
API access has ended
OpenAI shut down gpt-5.1-codex-mini on July 23, 2026.
Lower capability by design
OpenAI explicitly described Mini as less capable than GPT-5.1 Codex.
Retries can erase savings
A cheaper model can become more expensive per accepted task when difficult work requires repeated repair or escalation.
Historical price no longer applies
Migration decisions must use the pricing and measured performance of GPT-5.6 Terra or another current model.
Preserve the low-cost coding baseline
Replay GPT-5.1 Codex Mini tasks with a supported model
Use routine edits, bounded bug fixes, test repairs, repository questions, and escalation cases to compare quality, latency, retries, token usage, and cost per accepted engineering task.
Start FreeGPT-5.1 Codex Mini is retired from the OpenAI API. OpenAI’s deprecation table names GPT-5.6 Terra as the substitute.
Common Questions
What is GPT-5.1 Codex Mini?
GPT-5.1 Codex Mini is a retired OpenAI model described as a smaller, more cost-effective, less-capable version of GPT-5.1 Codex for agentic coding workloads.
What is the GPT-5.1 Codex Mini model ID?
The API model ID is gpt-5.1-codex-mini.
When was GPT-5.1 Codex Mini released?
OpenAI released gpt-5.1-codex-mini through the Responses API on November 13, 2025.
Is GPT-5.1 Codex Mini deprecated?
Yes, and its shutdown date has passed. OpenAI announced deprecation on April 22, 2026 and shut down API access on July 23, 2026.
Can I still call GPT-5.1 Codex Mini through the API?
No. OpenAI lists July 23, 2026 as the shutdown date for gpt-5.1-codex-mini.
What model replaces GPT-5.1 Codex Mini?
OpenAI’s API deprecation table names gpt-5.6-terra as the substitute.
How much did GPT-5.1 Codex Mini cost?
Historical pricing was $0.25 per 1M input tokens, $0.025 per 1M cached input tokens, and $2 per 1M output tokens.
How much cheaper was GPT-5.1 Codex Mini than GPT-5.1 Codex?
Its headline text-token rates were five times lower: $0.25 versus $1.25 input and $2 versus $10 output per million tokens.
What is the GPT-5.1 Codex Mini context window?
The official model page lists a 400,000-token context window.
What is the maximum output of GPT-5.1 Codex Mini?
The official model page lists up to 128,000 output tokens.
Did GPT-5.1 Codex Mini have a smaller context window than GPT-5.1 Codex?
No. Both models had a 400K context window and 128K maximum output. The primary tradeoff was capability versus price.
What input types did GPT-5.1 Codex Mini support?
The model supported text and image input and produced text output. Audio and video were not supported.
What is the GPT-5.1 Codex Mini knowledge cutoff?
OpenAI lists September 30, 2024 as the knowledge cutoff.
Did GPT-5.1 Codex Mini support reasoning tokens?
Yes. The official model page lists reasoning-token support.
What reasoning levels did GPT-5.1 Codex Mini support?
The official model page confirms reasoning-token support but does not document the same explicit effort-level list shown for newer models, so historical evaluations should rely on the supported API configuration used at the time.
Did GPT-5.1 Codex Mini support prompt caching?
Yes. Cached input was priced at $0.025 per million tokens, and the GPT-5.1 release introduced extended prompt-cache retention for supported workloads.
Was GPT-5.1 Codex Mini available in Chat Completions?
OpenAI launched GPT-5.1 Codex Mini through the Responses API for agentic coding. It was positioned as a Codex-oriented agent model rather than a general chat model.
Did GPT-5.1 Codex Mini support function calling?
Yes. The official model page lists function calling as supported.
Did GPT-5.1 Codex Mini support structured outputs?
Yes. Structured outputs are listed as supported.
Could GPT-5.1 Codex Mini be fine-tuned?
No. OpenAI lists fine-tuning as unsupported.
What tasks were a good fit for GPT-5.1 Codex Mini?
Its low-cost positioning made it most attractive for bounded coding tasks such as routine edits, simple bug repair, mechanical refactors, narrow repository questions, and workloads with strong automated validation.
When should a GPT-5.1 Codex Mini task be escalated?
Escalation makes sense when requirements are ambiguous, validation repeatedly fails, the patch grows beyond expected scope, the model cannot locate the relevant code path, or the change is high-risk.
How is GPT-5.1 Codex Mini different from GPT-5.1 Codex?
They shared 400K context, 128K output, image input, reasoning-token support, and agentic coding capabilities. Mini was explicitly smaller, less capable, and five times cheaper at the headline text-token rates.
Why did OpenAI recommend GPT-5.6 Terra as the replacement instead of GPT-5.6 Sol?
OpenAI’s deprecation table maps gpt-5.1-codex-mini to gpt-5.6-terra, preserving the model’s role as a tier that balances intelligence and cost rather than the highest-capability Codex replacement.
Should I use GPT-5.1 Codex Mini for a new application?
No. API access has ended. Use GPT-5.6 Terra or another supported model and retain GPT-5.1 Codex Mini only as a historical pricing, routing, regression, and migration baseline.
Model information
Last updated
Specifications, pricing, context limits, modalities, Responses API support, reasoning-token support, release timing, lifecycle status, and replacement guidance on this page are based on OpenAI’s official GPT-5.1 Codex Mini model page, GPT-5.1 API changelog, GPT-5.1 Codex documentation, prompt-caching documentation, and API deprecations page.