Codex · Series · Part 4 of 8

Codex models, the API and official links

Khairul Alam·October 2026·~18 min read
OpenAI APIModelsReferenceOfficial 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.

Part 4 in 60 seconds
  • 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, --model or a model line in config.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?
  2. A first API call
  3. Models in Codex (as of 18 October 2026)
  4. Switching models and reasoning effort
  5. Choosing a model and an effort
  6. Plans and pricing, at a high level
  7. Official links
  8. Series wrap-up and glossary

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.

DoorUse it toYou sign in with
Codex in the ChatGPT desktop app, CLI and IDE extensionWork inside your own project: read the code, edit files, run commands.ChatGPT (subscription access) or an API key (usage-based access)
Codex cloudRun 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 APIBuild 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 gatewayPoint 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.
OpenAI modelsAstra · Sol · Luna Codex + ChatGPTsubscription access Codex + API keyusage-based access OpenAI APIbuild your own app Custom providerResponses API endpoint
Same family of models, several doors. Pick the door for the job. Which models you see depends on the door, your plan and your client.

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 ChatGPTSign in with an API key
What it isSubscription access through your ChatGPT plan.Usage-based access through your OpenAI Platform account.
How you payYour plan, plus ChatGPT credits if you add them (see section 6).Standard API rates instead of included plan credits.
Rules and data handlingFollows your ChatGPT workspace permissions and retention settings.Follows your API organisation’s retention and data-sharing settings.
FeaturesAll 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.
ModelsDepends on your plan, client and workspace.Follows the API models available to your key.

In the CLI, the commands from the docs are:

terminal
# 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 status

If 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.

  1. 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.
  2. Put the key in an environment variable so it never appears in your code. On macOS or Linux:
    export OPENAI_API_KEY="your_api_key_here"
    On Windows the quickstart uses setx OPENAI_API_KEY "your_api_key_here". Each official SDK reads this variable by itself.
  3. Install the SDK: pip install openai for Python (or npm install openai for JavaScript).
  4. Make a call. Create example.py with the code from the quickstart, then run python example.py:
example.py (from the official quickstart)
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.

Your appholds the API keyin an environmentvariable request reply Responses API in: model, input out: response (read the text with output_text in the SDKs) auth: your API key
One request in, one response out. Everything else (tools, images, streaming) builds on this shape.
Never put your API key inside an app you ship

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

ModelID to useThe docs describe it as
GPT-6 Astragpt-6-astraThe 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 Solgpt-6.1-solNear-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 Solgpt-6-solBuilt to power complex coding and agentic workflows. It appears in the docs as the previous Sol model.
GPT-6 Lunagpt-6-lunaThe 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.

ModelStatus in the docs
gpt-5.5Retired 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-sparkRetired on 14 September 2026. No longer available in the desktop app, CLI or IDE extension.
gpt-5.4 and gpt-5.4-miniRetired 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-codexAlready 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.

Availablelisted in themodel picker Noticedated retirementnote in What’s new Replace itupdate configs,agents, scripts Retiredgone from Codexwith ChatGPT sign-in API-key sessions are tracked separately. Check the API deprecations page for those.
How a retirement shows up in the docs. Read What’s new regularly and search your config files for old model names.

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:

WhereHow
Inside a CLI sessionType /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 CLIcodex --model gpt-6.1-sol, or the alias -m.
Non-interactive runscodex exec -m gpt-6.1-sol "Review the current changes"
One-off override of any keycodex --config model='"gpt-6.1-sol"'. The value is parsed as TOML, so the inner quotes matter.
Default for every sessionAdd a model line to your config.toml (see below).
Desktop app, web and IDE extensionUse 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.
~/.codex/config.toml
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 withWhy (from the docs)
The hardest end-to-end workGPT-6 AstraSustained reasoning and judgment across code, apps and research. Give it sources, constraints and checks.
Complex coding, repeated or long-running work, with cost in mindGPT-6.1 SolNear-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 tasksGPT-6 LunaExtraction, classification, transformation, structured summaries, focused coding.
A script or agent that must keep working after a retirementA current ID from section 3Old 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.

LevelUse it for
Light (app, web, IDE) or Low (CLI, low in config)Quick, well-scoped tasks. The docs suggest starting here for Astra.
MediumA 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.
MaxMore time on a single hard task, when depth matters more than speed or usage. Luna supports up to Max.
UltraUses 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 optionWhat the pricing page says
Free and GoLight 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.
PlusA 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.
ProEverything 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 EduWorkspaces 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 keyGood 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).

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

PageWhat it covers
Codex docs homeThe entry point to all the documentation.
QuickstartFirst steps with Codex (Part 1).
Codex CLIInstalling and using the command-line client.
AuthenticationSign in with ChatGPT or an API key, device code, credential storage.
Config basicsconfig.toml, precedence and common settings.

Models, pricing and what changed

PageWhat it covers
ModelsRecommended models, availability, retirements, switching.
PricingPlans, credits, usage estimates, feature availability.
SpeedStandard, Fast and Ultrafast modes.
What’s newDated summaries of recent updates and retirement notices.
ChatGPT and Codex changelogEvery versioned update, bug fix and minor improvement.

OpenAI API

PageWhat it covers
Developer quickstartCreate a key, install an SDK, make your first call.
Responses API referenceThe request and response details.
API model catalogAll models available through the API.
Model selection guideChoosing between models for the API.
API pricingToken prices for API usage.
API deprecationsStatus of deprecated API models.
API changelogWhat changed in the API.
Client librariesOfficial SDKs, such as openai-python and openai-node.

Open source, community and support

PageWhat it covers
Open sourceWhich parts of Codex are open source (the CLI is; the IDE extension and Codex cloud are not).
openai/codexThe open-source Codex CLI repository, per the docs the primary home for Codex open-source development.
Issues and DiscussionsBug reports, feature requests and the discussion forum. The repo takes issues but not external pull requests.
OpenAI developer communityPrograms, meetups and support, including Codex Ambassadors.
Codex for StudentsThe students programme page. Check it for current eligibility and terms.
Codex for Open SourceFor maintainers of widely used open-source projects. The docs say it offers API credits, ChatGPT Pro with Codex and selective access to Codex Security.
ResourcesVideos, community programs and other OpenAI resources.

8. Beginner-level wrap-up and glossary

  1. Part 1: set up Codex safely, learn the modes and sign in.
  2. Part 2: give Codex lasting context with AGENTS.md.
  3. Part 3: spend fewer tokens, hand work off between sessions and onboard faster.
  4. Part 4: know your sign-in options, the model list and the official links.
  5. 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.

TermIn plain words
APIA way for one program to talk to another. The OpenAI API lets your code send requests to a model and read the replies.
API keyA secret string that identifies your account when you call the API. Treat it like a password.
Sign in with ChatGPTSubscription access to Codex through your ChatGPT plan.
Responses APIThe OpenAI API endpoint used in the quickstart: you send a model name and an input and get a response back.
SDKAn official library that makes API calls easier in a given language.
Model IDThe exact name to request or configure, such as gpt-6.1-sol.
Reasoning effortHow much thinking a model does before it answers. Higher is slower and uses more tokens.
SubagentA helper agent that takes one part of a bigger task. Ultra mode uses them.
CreditsExtra usage you can add to some plans once the included allowance runs out.
Retired modelA model that can no longer be selected in a given product. Replace its name in your configs and scripts.
← Back to all writing