GPT-5.1-Codex-Max: Compaction, Long Runs and Its Retirement
Models

GPT-5.1-Codex-Max: Compaction, Long Runs and Its Retirement

OpenAI trained Codex-Max to work across several context windows in one task. What compaction changed, what the benchmarks showed, and how to move off it now.

Most coding models fail long tasks the same way: the context window fills, the harness truncates or summarises crudely, and the agent forgets why it started. GPT-5.1-Codex-Max was OpenAI's first model trained to deal with that itself, by compacting its own history and carrying on in a fresh window.

It is worth understanding even now, because the idea outlived the model. OpenAI has retired Codex-Max from its own API, and the successors kept the compaction behaviour it introduced. If you still have a workflow tuned around it, this is what it was and what to replace it with.

What Codex-Max was built to do

OpenAI announced Codex-Max on 19 November 2025 inside its Codex products, where it replaced GPT-5.1-Codex as the default model. It reached the Responses API on 4 December 2025. OpenAI's model page describes it as a version of GPT-5.1-Codex optimised for long-running tasks.

The spec sheet is the same shape as the rest of the GPT-5.1 line: a 400,000-token context window, up to 128,000 output tokens, text and image input, text output, and a knowledge cutoff of 30 September 2024. It was served through the Responses API only. Chat Completions and the Batch endpoint were not supported, which mattered for any tool that still spoke the older protocol.

OpenAI also said it was the first model it had trained specifically to work well in Windows environments, which is a narrower claim than it sounds: it is about command-line behaviour on Windows shells, not general capability.

Compaction: working past one context window

The headline feature was compaction. When the window approached its limit, the model compressed the session history, keeping the task and the important steps and dropping detail that no longer mattered, then continued. OpenAI described it as the first model natively trained to operate across multiple context windows, and reported internal runs where it stayed on a single task for more than 24 hours.

Two things are worth separating. A harness can always summarise history for a model; that is an old technique, covered in context compaction strategies. What was new was training the model to do it, so the summary reflects what the model itself needs to continue rather than what a generic summariser guessed. The 24-hour figure, meanwhile, came from OpenAI's own internal workloads, which it did not describe in detail. Treat it as a statement of intent, not a guarantee.

The benchmark jump over GPT-5.1-Codex

OpenAI compared Codex-Max at its highest effort setting against GPT-5.1-Codex at high effort:

  • SWE-bench Verified (500 tasks): 77.9% against 73.7%
  • SWE-Lancer IC SWE: 79.9% against 66.3%
  • Terminal-Bench 2.0: 58.1% against 52.8%

These are vendor-run numbers, and the comparison is not like for like on effort: Max ran at its new extra-high setting. The more useful claim for cost planning was efficiency. OpenAI said Codex-Max used about 30% fewer thinking tokens than its predecessor at the same quality, and ran 27 to 42% faster on real-world tasks. On a reasoning model, hidden thinking tokens are billed as output, so a 30% cut there is a real saving rather than a cosmetic one.

Reasoning effort and the token bill

Codex-Max introduced an extra-high effort level, xhigh, intended for work where latency does not matter. It is tempting to set the highest level and forget it. On a long agent run that is usually the expensive mistake: each step spends more output tokens, and the steps compound.

OpenAI's model page listed the API price at $1.25 per million input tokens, $0.125 for cached input and $10 per million output, the same as GPT-5.1-Codex. The catalogue we sync from OpenRouter showed the same input and output rates at the time of writing. In practice, on long sessions the cached-input rate does most of the work, because the same repository context is re-sent turn after turn.

Retired on OpenAI's API: what that means now

On 22 April 2026 OpenAI announced the deprecation of gpt-5.1-codex-max, with a shutdown date of 23 July 2026 and gpt-5.6-sol named as the replacement. That date has passed. Third-party catalogues can lag behind an upstream retirement, so a listing is not proof a model still answers; send a test request before you plan around one.

If you need a cheaper sibling for the same era, GPT-5.1-Codex-Mini was the low-cost tier, but it was retired on the same date. The direct successor in the Codex line was GPT-5.2-Codex, which kept native compaction and improved on Terminal-Bench, and which has also since been retired.

Moving a Codex-Max workflow to a successor

A model swap in a long-running agent is riskier than in a chat tool, because small behavioural differences multiply across hundreds of steps. A sensible migration looks like this:

  1. Collect five to ten past tasks that ran long enough to trigger compaction, with the final diff that was accepted.
  2. Run them through the replacement at medium effort first, then at the highest level, and record turns to completion and total output tokens, not only pass or fail.
  3. Check what happens after compaction specifically. Does the agent still know which files it has already changed, and which tests it was trying to fix?
  4. Compare cost per accepted task rather than per token. A model with a higher rate that finishes in fewer turns can be cheaper.

Regression testing a model upgrade covers how to turn that into a repeatable check. The lesson Codex-Max leaves behind is simple: on long tasks, judge a model by how it behaves after the window fills, because that is where the earlier generation of coding models gave up.

Common questions

Is GPT-5.1-Codex-Max still available?

Not on OpenAI's own API. OpenAI announced its deprecation on 22 April 2026 with a shutdown date of 23 July 2026 and named gpt-5.6-sol as the replacement. Some third-party listings lag behind, so test a request before relying on one.

What is compaction in GPT-5.1-Codex-Max?

When the context window approached its limit, the model compressed its own session history, keeping the task and key steps, and continued in a fresh window. OpenAI trained this behaviour into the model rather than leaving it to the harness.

Could I call GPT-5.1-Codex-Max through Chat Completions?

No. OpenAI served it through the Responses API only, and the Batch endpoint was not supported either. Tools that only spoke Chat Completions needed an adapter or a different model.

Similar articles

GPT-5.1-Codex: What It Was and Why Listings Still Show It
Models
Models·7 min read

GPT-5.1-Codex: What It Was and Why Listings Still Show It

GPT-5.1-Codex was OpenAI's agentic coding model for the Responses API until its July 2026 retirement. What it did, what it cost, and how to move an agent off it.

Read
GPT-3.5 Turbo Guide: The 23 October Shutdown and How to Move
Models
Models·8 min read

GPT-3.5 Turbo Guide: The 23 October Shutdown and How to Move

OpenAI retires gpt-3.5-turbo on 23 October 2026. What the model was, which snapshots and aliases go with it, and a migration plan that fits in a week.

Read
GPT-4.1 Guide: What It Did Well, and Its January 2027 Exit
Models
Models·9 min read

GPT-4.1 Guide: What It Did Well, and Its January 2027 Exit

GPT-4.1 brought a 1M-token window and stronger instruction following to OpenAI's API in 2025. Its shutdown is now set for 14 January 2027. What to know and do.

Read