What is Aider?
Aider is an open-source AI pair-programming agent that runs in your terminal and operates directly inside your git repo. It maps your project, generates code diffs, applies the changes to your files and auto-commits each one with an AI-written message — all through an OpenAI-compatible API endpoint.
- Performs inline or diff-based file edits and commits changes with AI-generated messages.
- Maps your whole repository to give the model context on all relevant files, not just the ones you name.
- Accepts structured in-chat commands like
/add,/architect,/undoand/run(to feed test output back to the model). - Talks to any OpenAI-compatible endpoint via
OPENAI_API_BASE+OPENAI_API_KEY; swap models per turn with--model openai/<slug>.
Why route Aider through Tokonomix?
Aider's workflow bounces between fast, repetitive line edits and critical architectural decisions. Tokonomix makes both efficient: switch models per task with a single key — no separate provider setups — and add a verification step exactly where being wrong is expensive.
- Switch instantly between fast direct models (for frequent line edits) and the multi-model
tokonomix-consensusfor large refactors or risky architecture changes. - Single-key access to 130+ models from Anthropic, OpenAI, Google, Meta, Mistral and more — all behind one OpenAI-compatible endpoint.
- Control cost precisely with per-call spend caps, so a runaway loop or oversized context can’t bust your budget.
- Enable EU / sovereignty routing to keep proprietary repo data compliant — vital, since Aider streams real source code in every API call.
Connect Aider to Tokonomix
Aider works out of the box with Tokonomix — supply the base URL and your tok- key, then pick the right model slug for the task. Install Aider itself with python -m pip install aider-install && aider-install (or pipx install aider-chat).
- Generate (or copy) your
tok-API key from the Tokonomix dashboard. - Set
OPENAI_API_BASEtohttps://tokonomix.ai/api/v1. - Set
OPENAI_API_KEYto your Tokonomix key. - Launch Aider with
--model openai/tokonomix-consensusfor design/refactor turns, or a direct slug likeopenai/anthropic/claude-sonnet-4-6for rapid edits.
export OPENAI_API_BASE="https://tokonomix.ai/api/v1"
export OPENAI_API_KEY="tok-..."
# Fast, high-volume edits (cheap, direct model)
aider --model openai/anthropic/claude-sonnet-4-6
# Major refactors, /architect turns, or risky changes (multi-model + judge)
aider --model openai/tokonomix-consensusCreate a free account at tokonomix.ai/dashboard/signup — it includes a free starter balance — then paste the key into your shell as OPENAI_API_KEY.
Consensus vs direct: when to use which
Aider's efficiency comes from matching model choice to task risk. Use direct models for routine code edits; reserve tokonomix-consensus for structural or high-stakes decisions, where a second and third opinion pays for itself.
| Aider task | Recommended model | Why |
|---|---|---|
| Fix typos, rename functions, update a few lines | openai/anthropic/claude-sonnet-4-6 | High-frequency; one fast model is accurate enough at minimal cost and latency. |
| Implement features in existing modules | openai/anthropic/claude-sonnet-4-6 | Quick edit/commit turns thrive on low overhead — ideal for fast feedback on small-scope changes. |
| Large-scale refactor, migration or cross-file redesign | openai/tokonomix-consensus | Multi-model output plus an independent judge lowers the risk of single-model oversights in codebase-wide changes. |
| Scaffolding new architecture or critical design reasoning | openai/tokonomix-consensus | Several LLM perspectives keep the design consistent and surface subtle, costly mistakes early. |
The tokonomix-consensus model runs several top-tier LLMs in parallel and uses a judge to resolve disagreements, so its latency is much higher than a direct model. For Aider's normal rapid edit/commit loop, stick with a direct model; switch to consensus only for /architect, whole-repo refactors, or other crucial design turns.
Verify it works
Test the integration with a one-line edit to confirm Tokonomix routing and model response.
- Run Aider in a scratch or demo repo with a direct model and make a simple file edit.
- Check Aider applies the edit, prints the diff, and creates a git commit.
- Open your Tokonomix dashboard and confirm the request and token usage are logged.
aider --model openai/anthropic/claude-sonnet-4-6 --message "insert a # Hello World comment at the top of main.py"
# Success: Aider prints a diff, applies the change, and logs the call on your Tokonomix dashboard.