ChatGPT Codex Guide: Model Routing for Coding and Agent Tasks

Answer in brief

For ChatGPT coding and agent work, route complex or open-ended tasks to gpt-5.6-sol, balanced everyday work to gpt-5.6-terra, and clear, repeatable, or high-volume work to gpt-5.6-luna; Codex cloud supports Sol, while Terra and Luna are available only in Codex desktop, web, CLI, and IDE surfaces. Verified against the official model documentation on 2026-08-22; confirm model IDs, surface availability, outputs, authorization boundaries, tool calls, streams, and errors before release.

Key facts at a glance

Product / model Current ID or version Use case Evidence
OpenAI GPT-5.6 Sol gpt-5.6-sol Complex or open-ended tasks; Codex cloud, desktop, web, CLI, and IDE Official source
OpenAI GPT-5.6 Terra gpt-5.6-terra Balanced everyday work; Codex desktop, web, CLI, and IDE only Official source
OpenAI GPT-5.6 Luna gpt-5.6-luna Clear, repeatable, or high-volume work; Codex desktop, web, CLI, and IDE only Official source

Failure modes and verification

Failure mode Verification action
Stale model or version reference Compare the model name and ID with the official source before release.
Model selected on an unsupported surface Select only Sol for Codex cloud; select Terra or Luna only on Codex desktop, web, CLI, or IDE surfaces.
Unstructured or incomplete output Validate the response against the documented contract and a deterministic fixture.
Unverified factual claim Keep the claim qualified or remove the claim when the official source does not support it.

FAQ

Which model should ChatGPT use for coding or agent work?

Use gpt-5.6-sol for complex or open-ended tasks, gpt-5.6-terra for balanced everyday work, and gpt-5.6-luna for clear, repeatable, or high-volume work. Confirm the current IDs in the OpenAI models documentation and Codex routing details in the Codex models documentation.

Which Codex surfaces support these routes?

Codex cloud supports gpt-5.6-sol. gpt-5.6-terra and gpt-5.6-luna are available only in Codex desktop, web, CLI, and IDE surfaces, so do not select them for a cloud run.

How should an application verify machine-readable output?

Use Structured Outputs to define JSON Schema, then check semantic requirements and refusals. Schema conformance is not a substitute for application acceptance checks.

How should function calls be verified?

Follow the Function calling guide. Check the tool name, arguments, call_id, authorization boundary, returned output, and state transition before accepting a final response.

When is streaming useful and how should errors be handled?

Use streaming responses when partial display helps, and verify the final event and accumulated content. For failures, inspect error.code and Retry-After as applicable using the Error codes guide; billing, spend, credit, and quota errors should not be retried blindly.

Sources and freshness

Extended guide

ChatGPT Codex Guide: Model Routing for Coding and Agent Tasks

Direct answer

For ChatGPT coding and agent workflows, classify the request and execution surface before choosing a model: use gpt-5.6-sol for complex or open-ended tasks, gpt-5.6-terra for balanced everyday work, and gpt-5.6-luna for clear, repeatable, or high-volume work. Codex cloud supports Sol; Terra and Luna are limited to Codex desktop, web, CLI, and IDE surfaces. Keep the model ID explicit, define an output contract, and verify the final result, authorization boundaries, tool calls, streamed output, and errors. This is a neutral routing policy, not a claim that one model is always faster, cheaper, or more accurate.

Scope and current reference

Product: ChatGPT and Codex. Verification date: 2026-08-22; recheck model IDs in the OpenAI models documentation and routes and surface availability in the Codex models documentation.

Provider Name ID Route and availability Source
OpenAI GPT-5.6 Sol gpt-5.6-sol Complex or open-ended; Codex cloud, desktop, web, CLI, and IDE https://developers.openai.com/codex/models
OpenAI GPT-5.6 Terra gpt-5.6-terra Balanced everyday; Codex desktop, web, CLI, and IDE only https://developers.openai.com/codex/models
OpenAI GPT-5.6 Luna gpt-5.6-luna Clear, repeatable, or high-volume; Codex desktop, web, CLI, and IDE only https://developers.openai.com/codex/models

The reference does not provide a universal routing threshold, latency target, quality score, or retry budget. For those values, the official source does not specify a value in the supplied reference. Do not turn a role label into an unverified service-level promise.

Task classification and routing

  1. Identify the dominant work. Choose Sol for multi-step design, difficult debugging, cross-file changes, or other complex and open-ended decisions. Choose Terra for balanced everyday coding and agent work. Choose Luna for clear, repeatable transformations or high-volume queues. These are practical classifications, not automatic OpenAI routing rules.
  2. Check the execution surface. Codex cloud supports Sol, but not Terra or Luna. Codex desktop, web, CLI, and IDE surfaces support all three routes. Reject a Terra or Luna selection before creating a cloud run.
  3. Record the decision. Store the task class, execution surface, selected model ID, input contract, expected output, and acceptance checks with the request. Use the exact IDs gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna.
  4. Separate cost from latency. A high-volume route can be evaluated for repeated work, while an open-ended route may be evaluated for reducing rework on difficult tasks. Route labels do not supply guaranteed cost or latency numbers. Measure time to first visible output, total completion time, output length, and correction rate on representative, non-sensitive samples.
  5. Preserve the contract. For machine-consumed results, use Structured Outputs to define a JSON Schema. The guide states that Structured Outputs keeps responses aligned with the supplied schema and makes refusals detectable; still check semantic correctness, required business fields, and allowed values.
  6. Verify agent transitions. If an application exposes tools, follow the Function calling guide. The documented flow is to send tools, receive a tool call, execute application-side code, return tool output, and request the final response. Validate the tool name, arguments, call_id, authorization boundary, and returned data before accepting the next step.

Latency, streaming, and verification

Use streaming responses when partial output is useful to the interface. The guide documents stream=true and typed semantic events, so a client can process output while generation continues. Streaming can improve perceived responsiveness; it does not prove lower total completion time. Accumulate the final content, handle refusal or failure events, and verify the completed result rather than validating only the first chunk.

For failures, inspect the HTTP status and error.code using the Error codes guide. A rate-limit response may include Retry-After; billing, spend, credit, and quota errors require the relevant account or limit change rather than blind retries. Keep logs free of credentials and private input.

Verification checklist

  • The task class and reason for routing are recorded.
  • The selected model is available on the requested Codex surface.
  • The exact model ID matches the approved reference entry.
  • Cost and latency are measured on representative samples, not assumed from the role label.
  • JSON Schema or other output requirements are validated.
  • Tool arguments, call_id, authorization boundaries, tool output, and state transitions are checked.
  • Streaming is validated through completion, refusal, and failure handling.
  • error.code, status, and retry decision are recorded without secrets.
  • A human or automated acceptance check confirms the result before release.

Evidence and freshness

Last verified:

Primary sources

Verified model records

Explore More Tools