Setup guide

Connect Aider

Aider is an open-source AI pair programmer for the terminal. It connects to CheapTokens as an OpenAI-compatible API.

Before you start

The snippets below use claude-sonnet-5-5. Pick another model to update them.

Windows

  1. Install aider, then open a new terminal window.
    PowerShell
    powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex"
  2. Save the base URL and your key as environment variables. Close PowerShell and open it again so the new variables load.
    PowerShell
    setx OPENAI_API_BASE "https://cheaptokens.pw/v1"
    setx OPENAI_API_KEY "YOUR_API_KEY"
  3. Go to your project folder and start aider. Keep the openai/ prefix in front of the model ID: it tells aider to use the OpenAI format.
    PowerShell
    aider --model openai/claude-sonnet-5-5 --weak-model openai/claude-sonnet-5-5 --no-show-model-warnings
  4. To avoid typing the options each time, save them in a file named .aider.conf.yml in your home folder or project:
    .aider.conf.yml
    model: openai/claude-sonnet-5-5
    weak-model: openai/claude-sonnet-5-5
    openai-api-base: https://cheaptokens.pw/v1
    openai-api-key: YOUR_API_KEY
    show-model-warnings: false
    edit-format: diff

macOS

  1. Install aider, then open a new terminal window.
    Terminal
    curl -LsSf https://aider.chat/install.sh | sh
  2. Save the base URL and your key as environment variables. The last line reloads your shell settings, so the variables work straight away.
    Terminal
    echo 'export OPENAI_API_BASE="https://cheaptokens.pw/v1"' >> ~/.zshrc
    echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.zshrc
    source ~/.zshrc
  3. Go to your project folder and start aider. Keep the openai/ prefix in front of the model ID: it tells aider to use the OpenAI format.
    Terminal
    aider --model openai/claude-sonnet-5-5 --weak-model openai/claude-sonnet-5-5 --no-show-model-warnings
  4. To avoid typing the options each time, save them in a file named .aider.conf.yml in your home folder or project:
    .aider.conf.yml
    model: openai/claude-sonnet-5-5
    weak-model: openai/claude-sonnet-5-5
    openai-api-base: https://cheaptokens.pw/v1
    openai-api-key: YOUR_API_KEY
    show-model-warnings: false
    edit-format: diff

Linux

  1. Install aider, then open a new terminal window.
    Terminal
    curl -LsSf https://aider.chat/install.sh | sh
  2. Save the base URL and your key as environment variables. The last line reloads your shell settings, so the variables work straight away.
    Terminal
    echo 'export OPENAI_API_BASE="https://cheaptokens.pw/v1"' >> ~/.bashrc
    echo 'export OPENAI_API_KEY="YOUR_API_KEY"' >> ~/.bashrc
    source ~/.bashrc
  3. Go to your project folder and start aider. Keep the openai/ prefix in front of the model ID: it tells aider to use the OpenAI format.
    Terminal
    aider --model openai/claude-sonnet-5-5 --weak-model openai/claude-sonnet-5-5 --no-show-model-warnings
  4. To avoid typing the options each time, save them in a file named .aider.conf.yml in your home folder or project:
    .aider.conf.yml
    model: openai/claude-sonnet-5-5
    weak-model: openai/claude-sonnet-5-5
    openai-api-base: https://cheaptokens.pw/v1
    openai-api-key: YOUR_API_KEY
    show-model-warnings: false
    edit-format: diff

Check that it works

Send a short message in Aider, 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 →