Setup wizard

Connect your AI tool.

Pick a tool, your operating system and a model. The steps and snippets below update to match.

1Tool
2Operating system
3Instructions

Connect Codex CLI

Codex needs a provider block in config.toml and your key in an environment variable.

  1. Install Codex CLI, then open a new terminal window.
    Terminal
    curl -fsSL https://chatgpt.com/codex/install.sh | sh
  2. Save your key as an environment variable. The last line reloads your shell settings, so the variables work straight away.
    Terminal
    echo 'export CHEAPTOKENS_API_KEY="YOUR_API_KEY"' >> ~/.bashrc
    source ~/.bashrc
  3. Create the file ~/.codex/config.toml with this content. If the file 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. Go to your project folder, start Codex and send a message.
    Terminal
    codex
  • Codex only speaks the OpenAI Responses format, so it works with the models in the list on this page, not with every model.
  • Codex may warn that it has no metadata for a custom model. The model still works.
  • The Codex extension for VS Code (code --install-extension openai.chatgpt) reads the same config.toml. Start VS Code from a terminal that has the key variable, or restart your computer after setting it.
  • Switch model with codex --model gpt-6.2-sol or /model inside Codex.
  • Provider settings only work in the config file in your home folder, not in a project's .codex folder.

Open the full Codex CLI guide →