GPT 5.1 Codex Max
GPT 5.1 Codex Max applies maximum compute to the GPT-5.1 codex architecture, delivering the deepest reasoning and most thorough code analysis available in OpenAI's coding agent lineup for the most demanding software engineering tasks.
import { streamText } from 'ai'
const result = streamText({ model: 'openai/gpt-5.1-codex-max', prompt: 'Why is the sky blue?'})Playground
Try out GPT 5.1 Codex Max by OpenAI. Usage is billed to your team at API rates. Free users (those who haven't made a payment) get $5 of credits every 30 days.
Providers
Route requests across multiple providers. Copy a provider slug to set your preference. Visit the docs for more info. Using a provider means you agree to their terms, listed under Legal.
| Provider |
|---|
P50 throughput on live AI Gateway traffic, in tokens per second (TPS). Visit the docs for more info.
P50 time to first token (TTFT) on live AI Gateway traffic, in milliseconds. View the docs for more info.
Direct request success rate on AI Gateway and per-provider. Visit the docs for more info.
More models by OpenAI
| Model |
|---|
About GPT 5.1 Codex Max
GPT 5.1 Codex Max became available on November 19, 2025 on AI Gateway as the premium tier of the GPT-5.1 codex family. It applies the maximum available compute to each request, enabling deeper reasoning and more thorough code analysis than the standard GPT-5.1 codex tier.
The additional compute translates to meaningful quality improvements on the hardest coding tasks: complex architectural decisions, cross-cutting refactors, subtle bug diagnosis, and security analysis where thoroughness is critical. On simpler tasks, the difference from standard codex may be minimal, making selective deployment the most practical pattern.
The model supports the full context window of 400K tokens and operates in the same sandboxed agentic coding environment as other codex variants, reading repositories, writing code, executing tests, and iterating. The difference is in how deeply it reasons about each step.
What To Consider When Choosing a Provider
- Configuration: GPT 5.1 Codex Max is designed for tasks where standard codex models fall short. It applies additional computation to produce more thorough analysis and higher-quality code on genuinely difficult problems.
- Configuration: Most teams use codex max for their hardest tasks (security audits, architectural redesigns, complex migrations) while routing routine work to standard codex or codex mini.
- Zero Data Retention: AI Gateway supports Zero Data Retention for this model via direct gateway requests (BYOK is not included). To configure this, check the documentation.
- Authentication: AI Gateway authenticates requests using an API key or OIDC token. You do not need to manage provider credentials directly.
When to Use GPT 5.1 Codex Max
Best For
- Critical security audits: Thorough analysis of codebases for vulnerabilities with maximum reasoning depth
- Large-scale architectural redesigns: Changes that require understanding and restructuring entire systems
- Complex migration projects: Converting between frameworks or architectures with many interdependencies
- Hard debugging: Tracing subtle, cross-cutting bugs that require extensive codebase analysis
- Quality-critical code review: Final review of changes where missed issues have high consequences
Consider Alternatives When
- Standard coding tasks: GPT-5.1 codex handles most tasks well at lower cost
- Simple bug fixes: Codex mini is faster and more affordable for routine fixes
- Non-coding analysis: GPT-5.1 thinking for general reasoning tasks
- Speed-sensitive workflows: Any smaller codex variant when response time matters more than depth
Conclusion
GPT 5.1 Codex Max applies maximum compute within the GPT-5.1 codex family to the hardest software engineering challenges. For security audits, architectural redesigns, and other tasks where code quality is paramount, it is the premium tier of the GPT-5.1 codex lineup.
Frequently Asked Questions
How does GPT 5.1 Codex Max differ from standard GPT-5.1 codex?
It applies more compute per request, enabling deeper reasoning and more thorough analysis. The improvement is most significant on hard problems; simple tasks may not benefit noticeably.
When is the additional cost of codex max justified?
For security audits, large architectural changes, complex migrations, and any task where the consequences of missed issues are high. For routine coding, standard codex is more cost-effective.
What context window does GPT 5.1 Codex Max support?
400K tokens, matching the GPT-5.1 codex family.
How does AI Gateway handle authentication for GPT 5.1 Codex Max?
AI Gateway accepts a single API key or OIDC token for all requests. You don't embed OpenAI credentials in your application; AI Gateway routes and authenticates on your behalf.
Can GPT 5.1 Codex Max verify its own code?
Yes. Like other codex variants, it operates in sandboxed environments where it runs tests and validates output before returning results.
What are typical latency characteristics?
This page shows live throughput and time-to-first-token metrics measured across real AI Gateway traffic. Codex max may take longer due to additional compute applied per request.