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

The snippets below use gpt-6.2-sol. Pick another model to update them.

Windows

  1. Install the Codex app from chatgpt.com/download. It is also in the Microsoft Store.
  2. 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"
  3. Create the file %USERPROFILE%\.codex\config.toml with 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.toml
    model = "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
  4. Quit the Codex app completely and open it again. On the sign-in screen you can skip the ChatGPT login.
  5. Start a new chat and send a message. To check the provider, open Settings → Model Providers: CheapTokens should be the current one.

macOS

  1. Install the Codex app from chatgpt.com/download.
  2. 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.
    Terminal
    launchctl setenv CHEAPTOKENS_API_KEY "YOUR_API_KEY"
  3. Create the file ~/.codex/config.toml with 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.toml
    model = "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
  4. Quit the Codex app completely and open it again. On the sign-in screen you can skip the ChatGPT login.
  5. Start a new chat and send a message. To check the provider, open Settings → Model Providers: CheapTokens should be the current one.

Linux

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

If something goes wrong

What you seeWhat to do
401 or invalid_api_keyThe key is wrong, disabled or has extra spaces. Create a new key and paste it again.
402 or insufficient_quotaYour balance is empty. Top up under Billing.
404 or model_not_foundThe model ID has a typo. Copy it from the models page.
404 on every requestThe base URL is wrong. Check whether this tool needs the /v1 ending (see the steps above).
429Too many requests per minute. Wait a few seconds and retry.

Prefer a guided version? Open the setup wizard →