Codex GPT-5.4 Retirement Migration Guide (2026): Move to GPT-5.6 Terra or Luna Before August 31

As of August 2, 2026, OpenAI's Codex rate card carries a warning developers should not ignore: GPT-5.4 and GPT-5.4 mini will retire in Codex on August 31, 2026 for users signed in with ChatGPT. OpenAI's recommended replacements are direct: use GPT-5.6 Terra instead of GPT-5.4, and use GPT-5.6 Luna instead of GPT-5.4 mini.

This is not a panic migration. API access to GPT-5.4 is not affected by the Codex retirement notice, and Codex with your own API key is also not affected. But if your team runs Codex through ChatGPT Plus, Pro, Business, Enterprise, Edu, Gov, Health, or Teachers accounts, you have less than a month to update defaults, budgets, docs, and internal agent recipes.

TL;DR / Key Takeaways

  • OpenAI's Codex rate card states that GPT-5.4 and GPT-5.4 mini will retire in Codex for ChatGPT-signed-in users on August 31, 2026.
  • OpenAI recommends GPT-5.6 Terra as the Codex replacement for GPT-5.4 and GPT-5.6 Luna as the Codex replacement for GPT-5.4 mini.
  • GPT-5.6 Terra costs $2 per million input tokens and $12 per million output tokens, with a 1,050,000-token context window.
  • GPT-5.6 Luna costs $0.20 per million input tokens and $1.20 per million output tokens, with a 1,050,000-token context window.
  • OpenAI API access and Codex usage with a developer's own API key are not affected by the August 31, 2026 Codex retirement notice.

What Is Actually Retiring?

The wording matters. OpenAI did not say every GPT-5.4 endpoint vanishes. The Codex notice says GPT-5.4 and GPT-5.4 mini retire in Codex for users signed in with ChatGPT. If your developers launch Codex from a subscription account and pick GPT-5.4 today, that model choice needs to move before August 31.

If you call the OpenAI API directly, your immediate migration pressure is lower. Still, I would not ignore the signal. Product defaults tend to move before platform defaults. When a model leaves Codex, tooling docs, examples, internal onboarding guides, and saved automations often lag behind. That is how teams end up debugging a "random" model error on Monday morning.

Pricing Table: Current Models Involved in the Migration

ModelInput priceCached input priceOutput priceContext window
GPT-5.6 Terra$2 per 1M tokens$0.20 per 1M tokens$12 per 1M tokens1,050,000 tokens
GPT-5.6 Luna$0.20 per 1M tokens$0.02 per 1M tokens$1.20 per 1M tokens1,050,000 tokens
GPT-5.4$2.50 per 1M tokens$0.25 per 1M tokens$15 per 1M tokens1,050,000 tokens
GPT-5.4 mini$0.75 per 1M tokens$0.075 per 1M tokens$4.50 per 1M tokens400,000 tokens

The interesting bit is that Terra is cheaper than GPT-5.4, while Luna is much cheaper than GPT-5.4 mini and also has a larger context window. That does not mean Luna should replace every mini workflow blindly. It means your old assumptions deserve a fresh eval.

Model Comparison: Terra vs Luna vs the Retiring Codex Defaults

OptionBest forPricingContext windowKey limitation
GPT-5.6 TerraBalanced Codex tasks, code review planning, multi-file edits, everyday agent work$2 input / $12 output per 1M tokens1,050,000 tokensCosts 10x more than GPT-5.6 Luna for input tokens
GPT-5.6 LunaHigh-volume implementation tasks, test writing, lint fixes, simple refactors$0.20 input / $1.20 output per 1M tokens1,050,000 tokensLower intelligence tier than GPT-5.6 Terra for ambiguous tasks
GPT-5.4Existing Codex workflows that need continuity until August 31, 2026$2.50 input / $15 output per 1M tokens1,050,000 tokensRetires in Codex for ChatGPT-signed-in users on August 31, 2026
GPT-5.4 miniExisting low-cost Codex workflows that need continuity until August 31, 2026$0.75 input / $4.50 output per 1M tokens400,000 tokensRetires in Codex for ChatGPT-signed-in users on August 31, 2026

A Practical Migration Plan

Start by splitting your Codex usage into three buckets. Do not make one global replacement and call it done.

  1. Complex planning and risky edits: move from GPT-5.4 to GPT-5.6 Terra.
  2. Routine implementation: test GPT-5.6 Luna first, then escalate failures to Terra.
  3. Large-context repo work: compare Terra and Luna because both now support a 1,050,000-token context window.

The best setup is usually a two-model route. Terra decides when the task is underspecified or dangerous. Luna handles well-scoped work where the acceptance criteria are clear. This is boring engineering, but it saves money without making your agent dumb.

API Example: Route Codex-Style Tasks by Risk

Here is a small OpenAI-compatible pattern you can adapt for your own task runner. It defaults to Luna for routine work and bumps to Terra when the task looks risky.

curl https://api.openai.com/v1/responses \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-terra",
    "input": "Plan a safe migration from GPT-5.4 Codex defaults to GPT-5.6 Terra and Luna. Return test steps and rollback criteria."
  }'

If you use KissAPI as a unified endpoint, keep the same routing idea and swap only the base URL and key used by your gateway. That gives you one place to test model behavior, track costs, and keep a fallback path if your primary provider quota gets tight.

Python Router Example

from openai import OpenAI

client = OpenAI(api_key="YOUR_API_KEY")

RISK_WORDS = ("auth", "payment", "database", "migration", "delete", "security")

def choose_model(task: str) -> str:
    lowered = task.lower()
    if any(word in lowered for word in RISK_WORDS):
        return "gpt-5.6-terra"
    return "gpt-5.6-luna"

def run_codex_task(task: str):
    model = choose_model(task)
    return client.responses.create(
        model=model,
        input=f"You are a careful coding agent. Task:\n{task}"
    )

print(run_codex_task("write unit tests for the invoice formatter"))

Node.js Router Example

import OpenAI from "openai";

const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

function chooseModel(task) {
  const risky = /auth|payment|database|migration|delete|security/i.test(task);
  return risky ? "gpt-5.6-terra" : "gpt-5.6-luna";
}

export async function runTask(task) {
  const model = chooseModel(task);
  return await client.responses.create({
    model,
    input: `You are a careful coding agent. Task:\n${task}`
  });
}

Migration Checklist Before August 31

One small warning: if you move from GPT-5.4 mini to Luna, do not judge the migration only by per-token price. Measure task completion rate, retry count, and review burden. A cheap model that needs three attempts is not cheap. A routing setup through KissAPI or your own gateway can help keep that data visible across models.

Need a Cleaner Way to Test GPT-5.6 Routes?

Use KissAPI to compare model behavior, keep OpenAI-compatible calls simple, and add fallback routing before your Codex defaults change.

Start Free

FAQ

Does GPT-5.4 disappear from the OpenAI API on August 31, 2026?

No. OpenAI's Codex notice says OpenAI API access and Codex use with your own API key are not affected by the August 31, 2026 Codex retirement notice.

Should GPT-5.6 Terra replace GPT-5.4 in Codex?

Yes, for most GPT-5.4 Codex workflows. OpenAI explicitly recommends GPT-5.6 Terra instead of GPT-5.4 for Codex users signed in with ChatGPT.

Should GPT-5.6 Luna replace GPT-5.4 mini in Codex?

Usually, but test it first. OpenAI recommends GPT-5.6 Luna instead of GPT-5.4 mini, and Luna costs $0.20 input and $1.20 output per 1M tokens with a 1,050,000-token context window.