Codex CLI (command line)

Download Codex CLI, then connect it to CheapAI with CC Switch or Folkbench Switch.

If you haven't installed a setup tool yet, start with Setup tools (required).

Install Codex CLI

Open Terminal, paste the official install command, and press Return:

Terminal
curl -fsSL https://chatgpt.com/codex/install.sh | sh

Or install with Homebrew:

Homebrew
brew install --cask codex

When it finishes, run codex --version to confirm. See also the official Codex CLI guide.

Configure with CC Switch

  1. Open CC Switch, select Codex in the left sidebar, then click Add provider.

  2. Choose Custom
  3. Fill in the following fields:

    • Name: CheapAI
    • API Key: paste the key from API Keys
    • API URL: https://cheapai.info/v1
  4. Scroll down and click Fetch model list.

    In the Select models dialog, check the models you want, then click Apply.

    After you click Fetch model list, check models in Select models, then click Apply.
    After you click Fetch model list, check models in Select models, then click Apply.
  5. Scroll further to Advanced options and set Upstream format based on the models you use most:

    • Mainly OpenAI (GPT) models: choose Responses
    • Also using other domestic models: choose Chat Completions
    • Mainly Anthropic (Claude) models: choose Anthropic Messages
    In Advanced options, set Upstream format based on the models you use most.
    In Advanced options, set Upstream format based on the models you use most.
  6. Click Add. CheapAI should show In use (if not, click ▷ on the card).
  7. Close and reopen the terminal, then run codex

Configure with Folkbench Switch

  1. Open Folkbench Switch, then:

    • Switch to Pro in the top-right
    • Select Codex in the top bar
    • Click + Add service
  2. Choose Quick fill from listed sites
  3. Pick CheapAI in the list
  4. In Prepare service, confirm and fill in:

    • Protocol: OpenAI Responses (recommended)
    • API Base URL: https://cheapai.info/v1
    • API Key: paste the key from API Keys
    • Model: optional

    Then click Save.

  5. Saving only adds it to the local list.

    On the cheapai card at the bottom, click Switch.

  6. Restart codex

Manual setup

If you prefer not to use CC Switch or Folkbench Switch, set CHEAPAI_API_KEY in your environment and merge these fields into your user-level ~/.codex/config.toml. Avoid duplicate TOML keys and choose a model that supports Responses.

~/.codex/config.toml
model_provider = "cheapai"
model = "YOUR_MODEL_ID"

[model_providers.cheapai]
name = "CheapAI"
base_url = "https://cheapai.info/v1"
env_key = "CHEAPAI_API_KEY"
wire_api = "responses"
requires_openai_auth = false