Yes, Codex CLI works without a ChatGPT subscription. OpenAI's Codex pricing documentation describes a pay-per-token mode through an API key, separate from the Plus, Pro and Business plans. The agent in your terminal stays fully functional. Only the cloud add-ons, such as code review in GitHub, switch off. The rest of this post covers how the switch works and how to put a codexkey key where the platform.openai.com key would go.
How Codex CLI tells a subscription from an API key
Codex CLI is not tied to one way of signing in. At startup it reads ~/.codex/config.toml and the environment variables. If it finds a provider with a base_url and a key, the agent talks to the API directly and the ChatGPT login is not needed. The Codex documentation words this mode as "Pay for Codex usage based on API pricing". The bill is built from the input and output tokens of the specific model, not from a flat monthly sum.
The mode has a downside, and the documentation states it plainly. Cloud features are unavailable without a subscription, first of all automatic pull request review in GitHub and the Slack integration. Local work is the same in both modes: reading and editing files, running commands, tests and builds in your terminal.
Configuring config.toml for codexkey
To make Codex CLI use a codexkey key instead of an OpenAI key, you change only the provider configuration. It takes three steps.
Step 1: get a key
Sign up at codexkey and create a key under "API keys" in your account. The key looks like sk_cdx_.... You can top up the balance from $1 through YooKassa, Platega, SBP (the Russian Faster Payments System) or crypto.
Step 2: add the provider to config.toml
model_provider = "codexkey"
model_reasoning_effort = "medium"
model = "gpt-5.6-sol"
[model_providers.codexkey]
name = "codexkey"
base_url = "https://api.codexkey.online/v1"
env_key = "CODEX_KEY"
The model_reasoning_effort parameter sets how long the model reasons before it answers. Use low for simple mechanical edits, medium for everyday development and high for hard tasks with many steps.
Step 3: put the key in an environment variable
export CODEX_KEY="your-codexkey-key"
Append the line to ~/.zshrc, ~/.bashrc or ~/.config/fish/config.fish so every new terminal session picks the key up. After that, codex in a project folder behaves exactly as it does with an OpenAI key. The Codex guide has a longer version with screenshots and details for each OS.
Which model to pick: sol, terra or luna
OpenAI's own model list for Codex CLI currently reads GPT-6 Astra, GPT-6 Sol and GPT-6 Luna. All three are in the codexkey catalog, along with gpt-6.1-sol and the previous generation, GPT-5.6: gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna. In agentic coding the gap in quality between models is smaller than the gap in price, so choose a model per task and do not default to the newest one.
Input and output are billed separately, and prices differ by model (catalog prices as of October 29, 2026; current figures are on the models page):
| Model | Input / output per 1M tokens | When to use it |
|---|---|---|
gpt-6-astra | $0.68 / $3.3 | the hardest tasks, when price comes second |
gpt-6.1-sol | $0.28 / $1.42 | complex code and professional tasks |
gpt-6-sol | $0.14 / $0.68 | complex code and agentic scenarios |
gpt-6-luna | $0.04 / $0.22 | bulk narrow tasks, quick edits |
gpt-5.6-sol | $0.24 / $1.16 | complex multi-step tasks, a large unfamiliar repository |
gpt-5.6-terra | $0.14 / $0.68 | everyday development of medium difficulty, refactoring one module |
gpt-5.6-luna | $0.06 / $0.34 | mechanical edits, boilerplate generation, parsing |
For daily work use gpt-5.6-terra or gpt-6-sol. Move up to gpt-6.1-sol or gpt-6-astra only where they keep making mistakes or losing context. When each model pays for itself is covered in GPT-5.6 Sol and Terra and GPT-5.6 Luna, the cheapest model.
What it costs in practice
The gap between a plan and per-token billing is easy to feel. One session that edits a function, with a few files as input, usually fits into 20-50 thousand tokens, input and output together. On gpt-5.6-terra that is a few cents per session, while Plus and Pro differ by $100. The bill grows with the amount of work and never turns into a monthly payment, so the mode suits irregular use: if you code a couple of evenings a week, a full subscription does not pay back.
If access from Russia matters more than price, start with Codex in Russia in 2026. It explains why a direct ChatGPT subscription often fails there and how an API key removes the problem along with the price question. If what you wanted to know is the Pro 20x plan and why it is closed, that has its own post: Where to buy Codex when Pro 20x is closed.
FAQ
Which Codex CLI models are available with a codexkey key?
The GPT-6 line: gpt-6-astra, gpt-6.1-sol, gpt-6-sol and gpt-6-luna, plus the previous generation, GPT-5.6: gpt-5.6-sol, gpt-5.6-terra and gpt-5.6-luna. The current list and prices are on the models page.
Do I need an OpenAI account to use a codexkey key?
No. codexkey issues the key itself once you register in your account. It is not linked directly to a ChatGPT account or to a platform.openai.com key.
How are tokens counted in Codex?
A token is a piece of text, usually shorter than a whole word. Code and plain prose, in both the input and the model's answer, are split into tokens, and their number is multiplied by the model's price per million. Long files in the context and detailed answers inflate the bill faster than short, targeted edits.
What do I lose without a ChatGPT subscription when I work through an API key?
According to OpenAI's documentation, the cloud features of Codex are unavailable, first of all automatic pull request review in GitHub and the Slack integration. Work in the terminal stays the same: reading and editing files, running tests and builds.
Can I get GPT-6 Astra itself through codexkey?
Yes. gpt-6-astra is in the codexkey catalog at $0.68 per 1M input tokens and $3.3 per 1M output tokens (prices as of October 29, 2026). You name the model in config.toml the same way as any other. The model itself is covered in What is GPT-6 Astra.
Which is cheaper: a $20 Plus subscription or paying per token?
It depends on volume. If you work rarely or moderately, a few sessions a week, per-token billing is almost always cheaper than a flat subscription. For intensive daily work with a long context a flat plan can win, so estimate your token use in advance.