July 26, 20265 min readGPT-5.6Codex CLISetupCoding

How to use GPT-5.6 in Codex CLI: Sol, Terra and Luna

GPT-5.6 is the current agentic-coding family behind the strongest Codex workflows. The family has three tiers: Sol for difficult autonomous work, Terra for everyday engineering and Luna for fast, focused subtasks. You can run all three in Codex CLI through one AnyModel endpoint and switch models without changing the API key.

This guide covers the actual setup, not just the command. It explains which model id to use, what the installer changes, how to verify the route and how to avoid spending frontier-model tokens on work that a smaller tier can handle.

Choose a GPT-5.6 tier first

The configuration is identical for every tier; only the model id changes.

Tier Model id Context Practical starting point
GPT-5.6 Sol gpt-5.6-sol 1M Complex migrations, architecture, final review
GPT-5.6 Terra gpt-5.6-terra 1M Normal feature work, debugging and CI agents
GPT-5.6 Luna gpt-5.6-luna 400K Focused fixes, extraction, tests and sub-agents

Start with GPT-5.6 Terra if you do not yet have evaluation data. Move a task to Sol when failures or missed dependencies cost more than the model upgrade. Use Luna when the task is narrow and easy to verify.

Step 1: create an AnyModel key

Create an account and copy the API key from the dashboard. AnyModel is an independent OpenAI-compatible gateway: the key is an AnyModel key, not an OpenAI account or ChatGPT subscription.

If you are working from a region with payment restrictions, check the methods shown in your checkout. Available cards, transfers, currencies and crypto rails can change by account and payment provider.

Step 2: install Codex with the selected model

The fastest setup is the one-line installer. This example pins Terra:

bash <(curl -fsSL "https://anymodel.org/i?tool=codex&model=gpt-5.6-terra") <YOUR_API_KEY>

Replace <YOUR_API_KEY> with the key from your dashboard. To install Sol or Luna instead, change only the model query parameter.

The installer writes a Codex provider configuration that uses:

  • the Responses-compatible AnyModel endpoint;
  • your AnyModel API key;
  • the selected GPT-5.6 model;
  • a provider label local to your Codex configuration.

It does not install a browser extension, create an OpenAI account or alter unrelated repositories. The installer response is marked noindex; the stable setup documentation is this page and the Codex endpoint page.

Step 3: run a bounded test

Open a repository with a clean or committed git state and give Codex a small task:

codex --model gpt-5.6-terra "Find the cause of the failing auth test. Explain the plan before editing."

Review four things after the run:

  1. Did Codex read the relevant files before proposing changes?
  2. Did it run the right tests and respond to failures?
  3. Is the patch smaller and safer than a manual fix?
  4. How many tokens and retries did the session consume?

A model that is cheaper per token can still cost more when it needs several failed attempts. Conversely, using Sol for mechanical edits wastes budget even if the patch is correct.

Switch tiers without reinstalling

The command-line flag can override the default model for one session:

codex --model gpt-5.6-sol "Review this migration for missing cross-package dependencies"
codex --model gpt-5.6-luna "Add table-driven tests for this pure function"

That makes a simple routing policy possible: Terra by default, Sol for escalation, Luna for narrow workers. Keep the endpoint and key unchanged.

For current rates and the difference between list price and AnyModel customer price, use the GPT-5.6 API pricing guide and live pricing page.

Manual configuration check

If Codex still calls the wrong provider, inspect its active configuration. The important values are:

model = "gpt-5.6-terra"
model_provider = "anymodel"

[model_providers.anymodel]
base_url = "https://anymodel.org/v1"
wire_api = "responses"
requires_openai_auth = true

Do not paste your real key into a public issue, shell history screenshot or repository. Authentication is stored separately by the installer.

Troubleshooting

401 or authentication failed. Re-copy the AnyModel key and make sure the CLI is reading the provider created by the installer. An OpenAI key and an AnyModel key are not interchangeable.

Model not found. Use the exact ids above and confirm the model is still visible in the live catalog. Codex and desktop clients can cache model lists, so restart the client after a catalog change.

The request reaches /chat/completions incorrectly. Current Codex agent features use the Responses wire format. Keep wire_api = "responses" in the provider block.

A long session becomes expensive. Reduce irrelevant context, split the task into reviewable phases or move mechanical subtasks to Luna. Context capacity is a ceiling, not a target.

Regional connectivity is inconsistent. Test from the same ISP, VPN policy and server environment that will run the agent. The Codex in Russia guide separates compatible API access from direct OpenAI subscriptions and explains the payment caveats.

A safe operating pattern

Start every agent task from a recoverable git state, state the allowed scope, provide the test command and require a summary of changed files. Use Ghost Mode if you need zero retention on the AnyModel side, while remembering that the upstream model still processes the prompt.

The setup itself takes one command. The important decision is how you route work after that: default to Terra, escalate deliberately to Sol, and reserve Luna for tasks with a tight definition of done. Create an AnyModel key and evaluate all three on the same small repository task.

Read next