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
- A CheapTokens account with some balance. Create one if you haven't.
- Your API key from Dashboard → API key. It starts with
ct_live_. - Any text model from the models page. They all work over the OpenAI Chat Completions format.
The snippets below use claude-sonnet-5-5. Pick another model to update them.
Windows
-
Install aider, then open a new terminal window.PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://aider.chat/install.ps1 | iex"
-
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"
-
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.PowerShellaider --model openai/claude-sonnet-5-5 --weak-model openai/claude-sonnet-5-5 --no-show-model-warnings
-
To avoid typing the options each time, save them in a file named
.aider.conf.ymlin your home folder or project:.aider.conf.ymlmodel: 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
-
Install aider, then open a new terminal window.Terminal
curl -LsSf https://aider.chat/install.sh | sh
-
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
-
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.Terminalaider --model openai/claude-sonnet-5-5 --weak-model openai/claude-sonnet-5-5 --no-show-model-warnings
-
To avoid typing the options each time, save them in a file named
.aider.conf.ymlin your home folder or project:.aider.conf.ymlmodel: 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
-
Install aider, then open a new terminal window.Terminal
curl -LsSf https://aider.chat/install.sh | sh
-
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
-
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.Terminalaider --model openai/claude-sonnet-5-5 --weak-model openai/claude-sonnet-5-5 --no-show-model-warnings
-
To avoid typing the options each time, save them in a file named
.aider.conf.ymlin your home folder or project:.aider.conf.ymlmodel: 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
--weak-modelsets the model aider uses for commit messages. Without it, aider may pick a model that CheapTokens doesn't have.- Aider doesn't know the size or price of custom models, so it shows a warning.
--no-show-model-warningshides it. Billing is unaffected. edit-format: diffmakes edits faster and cheaper on large files. Remove it if a model struggles to produce diffs.- You can also install aider with Python:
python -m pip install aider-install, thenaider-install.
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 →