Tools & integrationsGuide
How to connect Aider to CheapTokens
Point Aider at the CheapTokens OpenAI-compatible API with two environment variables and the openai/ model prefix, then check that it answers.

On this page
Aider is an AI pair programmer that works in your terminal and commits its edits to git. It talks to any OpenAI-compatible API, so connecting it to CheapTokens takes two environment variables and a model name. The steps follow Aider's documentation for OpenAI-compatible APIs as of October 2026; they have not been run on a live Aider installation yet.
Before you start#
- Aider is installed (
aider --versionprints a version). - You have a CheapTokens API key and a positive balance. If not, start with Your first API request.
Step 1. Set the API address and key#
export OPENAI_API_BASE="https://api.cheaptokens.dev/v1"
export OPENAI_API_KEY="your-cheaptokens-key"The address must end with /v1. Put both lines in your shell profile or in a .env file in the project if you don't want to repeat them.
Step 2. Start Aider with a model#
aider --model openai/deepseek-ai/DeepSeek-V4-Flash-0731The openai/ prefix tells Aider to use the OpenAI-compatible protocol; it is removed before the request, and the API receives the full model ID. Other models:
openai/— reasons before answering, good for harder changes.zai- org/ GLM- 5. 3- Flash openai/— for long agent sessions; 200K context.MiniMaxAI/ MiniMax- M2. 7
How they differ and what they cost: GLM vs DeepSeek vs MiniMax.
Aider may warn that it does not know the model's context window and prices. It then uses safe defaults, and the requests still work; the limits of each model are listed in Connecting Cline.
Step 3. Check that it works#
Ask something small in the chat, for example /. An answer means the setup is done. Architect mode, the repo map and git commits run on your machine, so they work the same way.
Common errors#
- 401 — the key has a typo or was rotated; export it again.
- 404 —
OPENAI_API_BASEdoes not end with/v1. - 400
Model "…" not found— the model ID afteropenai/has a typo. - 402 — the balance is used up.
All codes: Connection errors and fixes. Aider resends the conversation on every turn, so most of the bill is input tokens — see What an AI agent costs.
Recommending CheapTokens to other developers? The referral program credits you a percentage of their top-ups.



