How to Use TokenAir with Aider
TokenAir can significantly lower Aider model spend when routine code changes use a lower-cost model and difficult edits keep a stronger one. Aider supports OpenAI-compatible endpoints through an API base, API key, and openai-prefixed model name.
Compatibility verdict
Direct setup
Aider's documented configuration maps to TokenAir: OPENAI_API_BASE sets the endpoint, OPENAI_API_KEY stores the credential, and openai/model-name selects the model.
The tool documents a custom OpenAI-compatible endpoint path.
Before you start
- A current Aider installation and a repository with a clean or reviewable working state.
- A TokenAir API key stored outside source control.
- An exact model ID returned by TokenAir's /models endpoint or shown in your account.
Setup and compatibility steps
Step 1
Set the TokenAir endpoint
Export the TokenAir base URL and API key in the shell that will start Aider. Use a secret manager or local environment file that is excluded from version control for repeated use.
Step 2
Start Aider with the TokenAir model
Prefix the exact TokenAir model ID with openai/. Aider uses that prefix to send the request through its OpenAI-compatible client.
Step 3
Check any model warning
Aider may warn when a model is missing from its metadata catalog. Review the warning before setting context limits, edit format, or token pricing.
Step 4
Test a small code change
Ask for one bounded edit, review the diff, and run the relevant test. Compare the total cost of an accepted change, including retries.
Shell setup and launch command
export OPENAI_API_BASE=https://api.tokenair.ai/v1
export OPENAI_API_KEY=YOUR_TOKENAIR_API_KEY
aider --model openai/YOUR_TOKENAIR_MODEL_IDReplace placeholders with values from your own TokenAir account. Never commit an API key to source control.
How to verify it
- Aider starts without authentication or model-not-found errors.
- A simple question returns a complete response from the configured model.
- A bounded edit produces a correct, reviewable diff in the repository.
- The change passes its test and costs less per accepted result than the comparison route.
How to lower cost without hiding quality loss
TokenAir gives the client access to premium and lower-cost model choices through one OpenAI-compatible API. Savings depend on matching each task with a model that still passes review.
- Use a lower-cost model for explanations, small refactors, and well-scoped edits.
- Switch to a stronger model for unfamiliar architecture, hard debugging, or final review.
- Count rejected diffs and repeated prompts when comparing cost.
Limits to know before production
- Aider can connect to an unfamiliar model. That model may still struggle with Aider's edit format.
- Model metadata such as context limits and pricing may need local configuration when Aider does not recognize the model ID.
- A successful response does not prove that a large repository edit will be accurate or economical.
FAQ
Does Aider accept a custom TokenAir base URL?
Yes. Aider documents OPENAI_API_BASE for OpenAI-compatible endpoints and uses OPENAI_API_KEY for authentication.
Why does the Aider model name start with openai/?
The prefix tells Aider which compatible client to use. The part after the slash must be an exact model ID enabled in TokenAir.
What if Aider warns that the model is unknown?
Review Aider's model warning guidance and verify the model's real limits. Do not silence a warning by inventing context or pricing values.
Official sources and related TokenAir docs
Tool settings change between releases. We checked these notes on July 17, 2026. Review the linked tool docs again before a production rollout.
Try one workflow before changing the default.
Use the cost checkup to choose a bounded test, then compare cost per accepted result with your current route.