Codex · Series · Part 4 of 8
Codex models, the API and official links
Parts 1 to 3 were about using Codex well. This part is the reference shelf at the end of the beginner level (Parts 5 to 8 go further): how Codex relates to the OpenAI API and the two ways to sign in, a first API call, the models you can pick in Codex as the docs list them on 18 October 2026 (including the ones that have just been retired), how to choose a model and a reasoning effort, how plans and pricing fit together, and the official pages I rely on, all in one place. Models and plans change often, so every table here is a dated snapshot and the linked docs are the source of truth.
- Codex and the OpenAI API are different products. You can sign in to Codex with your ChatGPT account (subscription access) or with an API key (usage-based access).
- The API needs an API key. Keep it in an environment variable, never inside an app you ship.
- The docs now recommend GPT-6.1 Sol (
gpt-6.1-sol) for complex coding and GPT-6 Luna (gpt-6-luna) for focused, repeatable tasks. GPT-6 Astra is the most capable model. GPT-5.5 left Codex with ChatGPT sign-in on 14 October 2026. - Switch model in the CLI with
/model,--modelor amodelline inconfig.toml. More reasoning effort is better for hard work, slower, and uses more tokens. - The official links are grouped at the end, so you can bookmark one section.
Contents of Part 4
1. Codex or the OpenAI API?
The same models can be reached through different doors. Which one you want depends on what you are trying to do. The docs describe Codex as working in the ChatGPT desktop app, the Codex CLI and the IDE extension, plus Codex cloud for tasks that run on the web. The OpenAI API is a separate door for building your own software.
| Door | Use it to | You sign in with |
|---|---|---|
| Codex in the ChatGPT desktop app, CLI and IDE extension | Work inside your own project: read the code, edit files, run commands. | ChatGPT (subscription access) or an API key (usage-based access) |
| Codex cloud | Run tasks in the cloud, with features such as GitHub code review and Slack. | ChatGPT only. The docs say Codex cloud requires signing in with ChatGPT. |
| OpenAI API | Build the models into your own app, website or backend. You send a request and get the reply back as data. | An API key, billed through your OpenAI Platform account |
| Custom model provider or gateway | Point Codex at a compatible endpoint your organisation runs. | Depends on the setup. The docs say a compatible Responses API endpoint is needed; Chat Completions-only endpoints are not supported. |
Sign in with ChatGPT or with an API key
The authentication docs say Codex supports two ways to sign in when using OpenAI models, and that the ChatGPT desktop app, the Codex CLI and the IDE extension support both for local work:
| Sign in with ChatGPT | Sign in with an API key | |
|---|---|---|
| What it is | Subscription access through your ChatGPT plan. | Usage-based access through your OpenAI Platform account. |
| How you pay | Your plan, plus ChatGPT credits if you add them (see section 6). | Standard API rates instead of included plan credits. |
| Rules and data handling | Follows your ChatGPT workspace permissions and retention settings. | Follows your API organisation’s retention and data-sharing settings. |
| Features | All of them, depending on plan. Needed for Codex cloud. | Local workflows work. Some features that rely on ChatGPT workspace or cloud services are limited or unavailable. |
| Models | Depends on your plan, client and workspace. | Follows the API models available to your key. |
In the CLI, the commands from the docs are:
# ChatGPT sign-in: opens a browser window
codex login
# API key sign-in: pipe the key in from an environment variable
printenv OPENAI_API_KEY | codex login --with-api-key
# Show the active sign-in method (exits 0 when you are logged in)
codex login statusIf you work on a remote or headless machine where the browser flow does not work, the docs describe a device-code option (codex login --device-auth, marked beta). The docs also recommend API keys for programmatic CLI workflows such as CI jobs, and warn you not to expose Codex execution in untrusted or public environments. Part 7 comes back to automation.
Treat ~/.codex/auth.json like a password. The docs say it holds access tokens, so do not commit it, paste it into tickets or share it in chat.
2. A first API call
This is the same idea as the context window from Part 3: the API does not remember anything between calls, so your code sends what the model needs every time. The docs call the main endpoint the Responses API. I checked the steps below against the live developer quickstart on 18 October 2026.
- Create an API key in the OpenAI dashboard (the quickstart has a button for it) and store it somewhere safe. Treat it like a password.
- Put the key in an environment variable so it never appears in your code. On macOS or Linux:
On Windows the quickstart usesexport OPENAI_API_KEY="your_api_key_here"setx OPENAI_API_KEY "your_api_key_here". Each official SDK reads this variable by itself. - Install the SDK:
pip install openaifor Python (ornpm install openaifor JavaScript). - Make a call. Create
example.pywith the code from the quickstart, then runpython example.py:
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="gpt-6-astra",
input="Write a one-sentence bedtime story about a unicorn.",
)
print(response.output_text)The JavaScript version in the same quickstart does the same with client.responses.create(…) and prints response.output_text. The quickstart also shows examples for .NET, Java, Go and Ruby, and plain HTTP examples that send a request to https://api.openai.com/v1/responses with an Authorization: Bearer header. For the exact request and response shapes, use the Responses API reference rather than my summary.
Anyone can pull a key out of an app package or a web page. Keep it on a server you control, use environment variables for local work, and do not commit it to git. (More in the Android post on online models.)
You do not need any of this to use Codex. Codex asks for a sign-in, not for code. The API is for when you want to build your own product on the models, or when you choose API-key sign-in for Codex itself.
3. Models in Codex (as of 18 October 2026)
This is how the Codex docs list the models on 18 October 2026. OpenAI changes the lineup often, so treat it as a snapshot and check the Models page, the API model catalog and the dated What’s new page for the live status. The docs also stress that availability depends on the rollout, your sign-in method, your client, your plan and your workspace settings.
Models to pick from
| Model | ID to use | The docs describe it as |
|---|---|---|
| GPT-6 Astra | gpt-6-astra | The most capable model, for complex work across code, apps and research. Choose it when a task needs the strongest capability across steps and tools. It is also the model in the API quickstart. |
| GPT-6.1 Sol | gpt-6.1-sol | Near-Astra performance for complex work at a lower cost than Astra. Recommended for complex coding and agentic workflows, and for repeated, long-running work. |
| GPT-6 Sol | gpt-6-sol | Built to power complex coding and agentic workflows. It appears in the docs as the previous Sol model. |
| GPT-6 Luna | gpt-6-luna | The most efficient model, for focused, high-volume tasks such as summarising, extraction and focused coding. Recommended for clear, repeatable tasks. |
The docs also say GPT-5.6 Sol, GPT-5.6 Terra and GPT-5.6 Luna remain available during the rollout. In ChatGPT, GPT-6.1 Sol, GPT-6 Sol and GPT-6 Luna are available in Work and Codex, not in Chat. The GPT-6.1 Sol launch rollout covers Plus, Pro, Business, Enterprise and Edu in Codex in the desktop app and CLI; for Enterprise and Edu it is off by default until an administrator enables it, and Free and Go were not included at launch. Selecting a new model does not change workspace permissions or give you access to it.
Retired and deprecated in Codex
The “What’s new” and Models pages carry dated retirement notices. If an old script or config still names one of these, update it.
| Model | Status in the docs |
|---|---|
gpt-5.5 | Retired from Codex for users signed in with ChatGPT on 14 October 2026 (noon PDT, 19:00 UTC). Replacement: gpt-6.1-sol on Plus, Pro, Business, Enterprise and Edu; gpt-6-luna in the desktop app on Free and Go. The OpenAI API and Codex sessions authenticated with an API key are not affected. |
gpt-5.3-codex-spark | Retired on 14 September 2026. No longer available in the desktop app, CLI or IDE extension. |
gpt-5.4 and gpt-5.4-mini | Retired from Codex with ChatGPT sign-in on 31 August 2026. The Models page says to replace them with gpt-6-sol and gpt-6-luna when available to your plan and client. API-key sessions are not affected. |
gpt-5.2 and gpt-5.3-codex | Already deprecated in Codex when you sign in with ChatGPT. Update scripts, config files and codex exec --model commands that still use them. |
The pattern in the docs is the same each time: retirement applies to the ChatGPT sign-in path, and you should replace the model name in workspace defaults, saved model settings, managed configurations, custom agents, scheduled tasks and scripts. With an API key, model availability follows your API organisation and project instead, and the docs note that GPT-5.5 remains available through the API.
4. Switching models and reasoning effort
If you do not choose, Codex uses a recommended model. The docs describe these ways to choose one yourself:
| Where | How |
|---|---|
| Inside a CLI session | Type /model to switch models or adjust reasoning effort. To see Max or Ultra for a model, choose it, then select More reasoning…. |
| When you launch the CLI | codex --model gpt-6.1-sol, or the alias -m. |
| Non-interactive runs | codex exec -m gpt-6.1-sol "Review the current changes" |
| One-off override of any key | codex --config model='"gpt-6.1-sol"'. The value is parsed as TOML, so the inner quotes matter. |
| Default for every session | Add a model line to your config.toml (see below). |
| Desktop app, web and IDE extension | Use the model and reasoning control under the message box. In the desktop app you start with a Power setting (Smarter or Faster) and open Advanced to pick a model, reasoning effort or speed. |
model = "gpt-6.1-sol"
model_reasoning_effort = "medium"The desktop app, the CLI and the IDE extension share the same config.toml. The docs list the model_reasoning_effort values low, medium, high, xhigh, max and ultra, and add that the levels available depend on the model and client. Command-line flags and --config overrides beat the file for a single run. If you do not have access to the model in an example, use one you can see in your picker.
Rename-proof tip: search your config.toml, saved profiles, custom agent files and scripts for the old IDs listed in section 3 whenever a retirement notice appears.
5. Choosing a model and an effort
The docs give a clear starting point: Luna is the most cost-efficient model, Astra the most powerful. If you do not need to think about usage or time, you can default to Astra. Otherwise, choose by the job:
| If you need… | Start with | Why (from the docs) |
|---|---|---|
| The hardest end-to-end work | GPT-6 Astra | Sustained reasoning and judgment across code, apps and research. Give it sources, constraints and checks. |
| Complex coding, repeated or long-running work, with cost in mind | GPT-6.1 Sol | Near-Astra performance at a lower cost. The docs suggest comparing it with Astra on the same task to see the quality and cost trade-off. |
| Clear, repeatable, high-volume tasks | GPT-6 Luna | Extraction, classification, transformation, structured summaries, focused coding. |
| A script or agent that must keep working after a retirement | A current ID from section 3 | Old IDs stop working with ChatGPT sign-in. |
Reasoning effort
Reasoning effort is how much thinking the model does before answering. Higher effort can improve results on complex tasks, but it takes longer and uses more tokens (Part 3). The docs say to start with the default and raise it when the task needs deeper planning or analysis.
| Level | Use it for |
|---|---|
Light (app, web, IDE) or Low (CLI, low in config) | Quick, well-scoped tasks. The docs suggest starting here for Astra. |
| Medium | A balance of speed and depth, for tasks that need more planning. |
High and Extra High (xhigh) | Difficult work with several steps, sources or trade-offs. The docs suggest starting at High for Luna. |
| Max | More time on a single hard task, when depth matters more than speed or usage. Luna supports up to Max. |
| Ultra | Uses subagents to handle separate parts of a complex task in parallel. Pick it when you can split the work. Not supported by Luna, and most tasks do not need it. |
Two honest caveats from the docs. Reasoning efforts do not map exactly between model generations, so try a familiar task at a lower setting and adjust. And the guidance is a starting point: experiment with the same input, compare, and keep the lightest setting that meets your quality bar. Ask yourself how often the task runs, how fast you need it, how the output will be used and how much quality matters. The docs also describe Standard, Fast and Ultrafast speed modes where supported, which use your allowance at different rates (see the Speed page).
6. Plans and pricing, at a high level
Prices and limits change more often than anything else in this post, so I only describe the shape here. The Codex pricing page is the source of truth. It says ChatGPT Work and Codex share usage, and that API token prices are separate from subscription usage, so you should not use API prices to estimate how much a plan includes.
| Plan or option | What the pricing page says |
|---|---|
| Free and Go | Light use. The docs list GPT-6 Luna at Standard speed in the desktop app, subject to rollout. Listed at $0 and $8 per month on 18 October 2026. |
| Plus | A few focused coding sessions each week. Codex on the web, in the CLI, in the IDE extension and on iOS, plus cloud features such as automatic code review and Slack. GPT-6.1 Sol and GPT-6 Luna. You can extend usage with ChatGPT credits. Listed at $20 per month. |
| Pro | Everything in Plus, with several tiers (the page lists $100, $200 and $500 per month) and more usage. Ultrafast mode is on the $500 tier. |
| Business, Enterprise and Edu | Workspaces with admin controls, SSO and more. Enterprise and Edu add things like audit logs and data retention and residency controls. Business and Enterprise pricing is per user; see the page. |
| API key | Good for automation in shared environments such as CI. You pay by API pricing, model availability follows your key, and cloud features such as GitHub code review and Slack are not included. |
Usage depends on the model, the size of the task, the context, tool use and caching, so the same-looking tasks can cost different amounts. Smaller, cheaper models such as Luna go further on a plan than Astra. The pricing page also has a usage estimate table, credit rates and answers to questions like “where can I see my current usage limits”. Check it, and your own usage dashboard, rather than trusting any number copied into a blog post (including mine).
7. Official links
Codex changes quickly. This series was checked against the official documentation on 18 October 2026; always confirm details on the official pages. Every link below returned HTTP 200 when I checked it. If a link breaks, the docs are indexed at learn.chatgpt.com/docs and the API docs at developers.openai.com.
Codex: getting started and sign-in
| Page | What it covers |
|---|---|
| Codex docs home | The entry point to all the documentation. |
| Quickstart | First steps with Codex (Part 1). |
| Codex CLI | Installing and using the command-line client. |
| Authentication | Sign in with ChatGPT or an API key, device code, credential storage. |
| Config basics | config.toml, precedence and common settings. |
Models, pricing and what changed
| Page | What it covers |
|---|---|
| Models | Recommended models, availability, retirements, switching. |
| Pricing | Plans, credits, usage estimates, feature availability. |
| Speed | Standard, Fast and Ultrafast modes. |
| What’s new | Dated summaries of recent updates and retirement notices. |
| ChatGPT and Codex changelog | Every versioned update, bug fix and minor improvement. |
OpenAI API
| Page | What it covers |
|---|---|
| Developer quickstart | Create a key, install an SDK, make your first call. |
| Responses API reference | The request and response details. |
| API model catalog | All models available through the API. |
| Model selection guide | Choosing between models for the API. |
| API pricing | Token prices for API usage. |
| API deprecations | Status of deprecated API models. |
| API changelog | What changed in the API. |
| Client libraries | Official SDKs, such as openai-python and openai-node. |
Open source, community and support
| Page | What it covers |
|---|---|
| Open source | Which parts of Codex are open source (the CLI is; the IDE extension and Codex cloud are not). |
| openai/codex | The open-source Codex CLI repository, per the docs the primary home for Codex open-source development. |
| Issues and Discussions | Bug reports, feature requests and the discussion forum. The repo takes issues but not external pull requests. |
| OpenAI developer community | Programs, meetups and support, including Codex Ambassadors. |
| Codex for Students | The students programme page. Check it for current eligibility and terms. |
| Codex for Open Source | For maintainers of widely used open-source projects. The docs say it offers API credits, ChatGPT Pro with Codex and selective access to Codex Security. |
| Resources | Videos, community programs and other OpenAI resources. |
8. Beginner-level wrap-up and glossary
- Part 1: set up Codex safely, learn the modes and sign in.
- Part 2: give Codex lasting context with AGENTS.md.
- Part 3: spend fewer tokens, hand work off between sessions and onboard faster.
- Part 4: know your sign-in options, the model list and the official links.
- Next (advanced): Part 5 covers working with Codex day to day.
Models are retired, plans move and the docs change often. Writing things down, and checking the official pages when something looks off, are the two habits that carry through all four parts.
| Term | In plain words |
|---|---|
| API | A way for one program to talk to another. The OpenAI API lets your code send requests to a model and read the replies. |
| API key | A secret string that identifies your account when you call the API. Treat it like a password. |
| Sign in with ChatGPT | Subscription access to Codex through your ChatGPT plan. |
| Responses API | The OpenAI API endpoint used in the quickstart: you send a model name and an input and get a response back. |
| SDK | An official library that makes API calls easier in a given language. |
| Model ID | The exact name to request or configure, such as gpt-6.1-sol. |
| Reasoning effort | How much thinking a model does before it answers. Higher is slower and uses more tokens. |
| Subagent | A helper agent that takes one part of a bigger task. Ultra mode uses them. |
| Credits | Extra usage you can add to some plans once the included allowance runs out. |
| Retired model | A model that can no longer be selected in a given product. Replace its name in your configs and scripts. |