Setup guide
Connect Codex App
The Codex app is OpenAI's desktop coding agent for Windows and macOS. It reads the same config.toml as Codex CLI, so you add CheapTokens as a model provider there.
Before you start
- A CheapTokens account with some balance. Create one if you haven't.
- Your API key from Dashboard → API key. It starts with
ct_live_. - A model that supports the OpenAI Responses format. GPT models all do, and the model list on this page shows the others.
The snippets below use gpt-6.2-sol. Pick another model to update them.
Windows
-
Install the Codex app from chatgpt.com/download. It is also in the Microsoft Store.
-
Save your key as an environment variable. Close PowerShell and open it again so the new variables load.PowerShell
setx CHEAPTOKENS_API_KEY "YOUR_API_KEY"
-
Create the file
%USERPROFILE%\.codex\config.tomlwith this content. The app and Codex CLI share this file. If it already exists, put the first two lines at the very top and the rest at the end.config.tomlmodel = "gpt-6.2-sol" model_provider = "cheaptokens" [model_providers.cheaptokens] name = "CheapTokens" base_url = "https://cheaptokens.pw/v1" env_key = "CHEAPTOKENS_API_KEY" wire_api = "responses" requires_openai_auth = false
-
Quit the Codex app completely and open it again. On the sign-in screen you can skip the ChatGPT login.
-
Start a new chat and send a message. To check the provider, open Settings → Model Providers: CheapTokens should be the current one.
macOS
-
Install the Codex app from chatgpt.com/download.
-
Save your key where desktop apps can read it. Apps opened from the Dock don't see variables from your shell settings, so use
launchctl. Run it again after you restart your Mac.Terminallaunchctl setenv CHEAPTOKENS_API_KEY "YOUR_API_KEY"
-
Create the file
~/.codex/config.tomlwith this content. The app and Codex CLI share this file. If it already exists, put the first two lines at the very top and the rest at the end.config.tomlmodel = "gpt-6.2-sol" model_provider = "cheaptokens" [model_providers.cheaptokens] name = "CheapTokens" base_url = "https://cheaptokens.pw/v1" env_key = "CHEAPTOKENS_API_KEY" wire_api = "responses" requires_openai_auth = false
-
Quit the Codex app completely and open it again. On the sign-in screen you can skip the ChatGPT login.
-
Start a new chat and send a message. To check the provider, open Settings → Model Providers: CheapTokens should be the current one.
Linux
-
The Codex desktop app is available for Windows and macOS. On Linux, use Codex CLI instead: it uses the same settings.
Check that it works
Send a short message in Codex App, then open Dashboard → Usage. The request appears there within a few seconds, with its model, tokens and cost.
Good to know
- You can also add the provider in the app: Settings → Model Providers → Add → Gateway or custom provider. Enter the base URL https://cheaptokens.pw/v1 and
CHEAPTOKENS_API_KEYas the API key environment variable, then turn on Set as current provider. - Codex only speaks the OpenAI Responses format, so it works with the models in the list on this page, not with every model.
- Without a ChatGPT login, cloud tasks and some plugins are not available.
- If the app can't find your key, the environment variable isn't visible to it. Set it again and restart the app.
If something goes wrong
| What you see | What to do |
|---|---|
401 or invalid_api_key | The key is wrong, disabled or has extra spaces. Create a new key and paste it again. |
402 or insufficient_quota | Your balance is empty. Top up under Billing. |
404 or model_not_found | The model ID has a typo. Copy it from the models page. |
| 404 on every request | The base URL is wrong. Check whether this tool needs the /v1 ending (see the steps above). |
| 429 | Too many requests per minute. Wait a few seconds and retry. |
Prefer a guided version? Open the setup wizard →