Back to Models

GPT-5.1-Codex-Max is OpenAI’s frontier agentic coding model, purpose-built for long-running software engineering tasks that span hours or even days. Announced on November 18–19, 2025, it is the first OpenAI model natively trained to operate across multiple context windows through a process called compaction — coherently working over millions of tokens in a single task by automatically pruning history while preserving the most important context. It replaces GPT-5.1-Codex as the default model in Codex surfaces (CLI, IDE extension, cloud sandbox, and code review).

Built on an update to OpenAI’s foundational reasoning model, GPT-5.1-Codex-Max was trained on real-world software engineering tasks: PR creation, code review, frontend coding, Q&A, and — for the first time — Windows environment operation. The model introduces xhigh (‘Extra High’) reasoning effort, which allocates even more thinking time for non-latency-sensitive tasks. Compaction enables autonomous sessions of 24+ hours, automatically compacting as the context window fills and repeating until the task completes.

From a TheRouter operator’s perspective, GPT-5.1-Codex-Max is listed as active and available through the standard /v1/chat/completions endpoint with full OpenAI-compatible parameters (temperature, max_tokens, tools, tool_choice, response_format, reasoning, stop). It shares GPT-5.1’s 400K context window and 128K max output, with pricing at $1.25/M input tokens, $10/M output tokens, and $0.125/M cached reads. The model is best used for agentic coding workflows routed through Codex or Codex-like harnesses — for general reasoning tasks, route to openai/gpt-5.1 instead.

Best for
  • • Long-running autonomous coding sessions (24+ hours) — compaction allows GPT-5.1-Codex-Max to iterate on implementations, fix test failures, and deliver results without human intervention across millions of tokens
  • • Project-scale refactors — the model can sustain coherent work across multi-window context through compaction, handling complex refactors that would previously fail due to context-window limits
  • • Token-efficient agentic coding — with ‘medium’ reasoning effort, achieves better SWE-bench score than GPT-5.1-Codex while using 30% fewer thinking tokens; cost savings translate to real-world developer savings
  • • SWE-bench, SWE-Lancer, and Terminal-Bench workloads — top scores among the GPT-5.1 Codex family at 77.9%, 79.9%, and 58.1% respectively with xhigh reasoning effort
Reach for something else if
  • • General reasoning and non-coding chat — GPT-5.1 (openai/gpt-5.1) is better suited for these workloads at the same price; route via TheRouter for those use cases
  • • Sub-second interactive coding — GPT-5.1-Codex-Mini (openai/gpt-5.1-codex-mini) at $0.25/M in, $2/M out offers faster response for quick edits and code completions
  • • Highest absolute SWE-bench scores — Claude Opus 4.7 (anthropic/claude-opus-4.7) and GPT-5.2-Codex (openai/gpt-5.2-codex) achieve higher SWE-bench performance; consider those for benchmark-chasing workloads
  • • Simple chat completions with no agentic tool use — the compaction and xhigh reasoning overhead is wasted; route to cheaper models like GPT-5 Mini or GPT-5 Nano
Context Length
400K
Max Output
128K
Input Priceper 1M tokens
$1.35/ 1M tokens
Output Priceper 1M tokens
$10.80/ 1M tokens

Modalities

textimage→text

Capabilities

Vision

Pricing Breakdown

TypeRate
Input$1.35 / 1M tokens
Output$10.80 / 1M tokens

Supported Parameters

temperaturemax_tokenstop_ptoolstool_choiceresponse_formatreasoningstop

Specifications

Release date2025-11-18openai.com ↗verified
OpenAI API model idgpt-5.1-codex-maxopenai.com ↗verified
Model typeFrontier agentic coding model with native compaction — first OpenAI model trained for multi-window context operationopenai.com ↗verified
Reasoning typeAdaptive — supports ‘none’, ‘low’, ‘medium’, ‘high’, and ‘xhigh’ (Extra High) reasoning effort; xhigh allocates maximum thinking time for non-latency-sensitive tasksopenai.com ↗verified
CompactionNative multi-window compaction — automatically prunes session history while preserving critical context, enabling coherent work over millions of tokens across 24+ hour sessionsopenai.com ↗verified
Windows environment supportFirst Codex model trained to operate in Windows environmentsopenai.com ↗verified
Cybersecurity capability (Preparedness Framework)Most capable cybersecurity model deployed by OpenAI to date — does not reach High threshold but rapidly evolving; treated as High for biology; dedicated cyber monitoring activeopenai.com ↗verified
LicenseProprietary (OpenAI API terms of service / ChatGPT subscription)verified

Benchmarks

BenchmarkDistributionScoreSource
SWE-bench Verified
xhigh reasoning effort, n=500 — vs GPT-5.1-Codex (high) at 73.7%. 30% fewer thinking tokens than GPT-5.1-Codex at same ‘medium’ effort.
77.9%%openai.com ↗
SWE-Lancer IC SWE
xhigh reasoning effort — vs GPT-5.1-Codex (high) at 66.3%.
79.9%%openai.com ↗
Terminal-Bench 2.0
xhigh reasoning effort — vs GPT-5.1-Codex (high) at 52.8%.
58.1%%openai.com ↗

API Usage Examples

Use the global api.therouter.ai endpoint shown below for new integrations; the legacy China accelerated endpoint is retired.

cURL
curl https://api.therouter.ai/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer $THE_ROUTER_API_KEY"   -d '{
    "model": "openai/gpt-5.1-codex-max",
    "messages": [
      {"role": "user", "content": "Summarize the key points from this input."}
    ]
  }'

Chat completion

GPT-5.1-Codex-Max is accessed via the standard chat completions endpoint. For agentic coding workflows, route through Codex or Codex-compatible harnesses to leverage apply_patch and shell tools.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-5.1-codex-max","messages":[{"role":"user","content":"Write a Python script that monitors CPU usage and logs to a file"}],"reasoning_effort":"medium"}'

More from openai

Similar models

Cross-provider sibling models

News & changes

2025-11-18

OpenAI announces GPT-5.1-Codex-Max with compaction and xhigh reasoning

GPT-5.1-Codex-Max becomes the default Codex model, introducing native context compaction for multi-window sessions of 24+ hours, xhigh reasoning effort delivering 77.9% on SWE-bench Verified, and 30% fewer thinking tokens at medium effort vs the predecessor. First Codex model with Windows environment support.

re-authored by TheRouteropenai.com ↗

Frequently asked

How is GPT-5.1-Codex-Max different from GPT-5.1-Codex?

GPT-5.1-Codex-Max is the upgraded default Codex model with three key differentiators: (1) native context compaction for 24+ hour autonomous coding sessions, (2) xhigh reasoning effort for non-latency-sensitive tasks, and (3) significantly higher benchmark scores (SWE-bench Verified 77.9% vs 73.7%). It also uses 30% fewer thinking tokens at the same medium reasoning effort. The model is available via TheRouter API at the same pricing as GPT-5.1-Codex ($1.25/M in, $10/M out).

Is GPT-5.1-Codex-Max available via the OpenAI API, or only in Codex?

OpenAI announced GPT-5.1-Codex-Max for Codex surfaces first (CLI, IDE extension, cloud, code review) with API access coming soon. TheRouter lists openai/gpt-5.1-codex-max as an active, available model accessible through the standard /v1/chat/completions endpoint. This means you can route through TheRouter today for API-based workflows, even while Codex-native features (compaction, apply_patch, shell) require Codex-compatible harnesses.

Can GPT-5.1-Codex-Max be used for general reasoning tasks?

OpenAI explicitly recommends against using Codex-family models for general reasoning or non-coding chat. GPT-5.1 (openai/gpt-5.1) is the general-purpose variant better suited for these workloads at the same price. Use Codex-Max exclusively for agentic coding workflows through Codex or Codex-like harnesses.

Fact ledger — every claim on this page traces here
sourceURLretrieved
Release dateopenai.com ↗2026-05-28verified
OpenAI API model idopenai.com ↗2026-05-28verified
Model typeopenai.com ↗2026-05-28verified
Reasoning typeopenai.com ↗2026-05-28verified
Compactionopenai.com ↗2026-05-28verified
Windows environment supportopenai.com ↗2026-05-28verified
Cybersecurity capability (Preparedness Framework)openai.com ↗2026-05-28verified
License——verified
SWE-bench Verifiedopenai.com ↗2026-05-28verified
SWE-Lancer IC SWEopenai.com ↗2026-05-28verified
Terminal-Bench 2.0openai.com ↗2026-05-28verified
OpenAI announces GPT-5.1-Codex-Max with compaction and xhigh reasoningopenai.com ↗2026-05-28verified
How is GPT-5.1-Codex-Max different from GPT-5.1-Codex?openai.com ↗2026-05-28to verify
Is GPT-5.1-Codex-Max available via the OpenAI API, or only in Codex?openai.com ↗2026-05-28to verify
Can GPT-5.1-Codex-Max be used for general reasoning tasks?openai.com ↗2026-05-28to verify
Help & contact