Aider is one of the most effective AI coding tools available โ it reads your codebase, makes multi-file edits, and commits them to git automatically. But it is also one of the most expensive to run. A typical Aider session sends the full content of every file in context with every prompt, which means a single "fix this bug" command might burn 50K tokens. Multiply that by a day of active pair programming and you are looking at serious costs, even on GPT-4o-mini.
The thing is, not every Aider command needs the same level of intelligence. When Aider reads a file to understand its structure, that is a simple parsing task. When it generates a commit message, that is boilerplate. When it plans a complex refactor across five files โ that is where you actually need a premium model. But with a static model configuration, every single one of those operations hits the same endpoint at the same price.
Antbase brings per-request routing to Aider sessions. Each API call gets independently classified: simple operations go to fast free models, complex code generation goes to premium ones. The result is Aider sessions that feel just as capable but cost a fraction of what they used to. And because Antbase has fallover across providers, your pair programming session does not crash if OpenAI has a hiccup โ it just routes to another capable model and keeps going.
Aider is a command-line AI coding assistant that edits files in your git repo. It supports multi-file edits, automatic git commits, and works with any OpenAI-compatible API. Connecting it to Antbase gives you intelligent routing โ complex refactors get premium models, simple edits get fast ones.
Setup
pip install aider-chat
# Set environment variables
export OPENAI_API_BASE=https://antbase.ai/v1
export OPENAI_API_KEY=ant_your-api-keyRunning Aider
# Use auto-routing
aider --model openai/auto
# Or pin a specific model
aider --model openai/gpt-4o
# Add files to the chat context
aider --model openai/auto src/auth.ts src/middleware.tsPersistent Configuration
Create a .aider.conf.yml in your project root for persistent settings:
# .aider.conf.yml
model: openai/auto
openai-api-base: https://antbase.ai/v1
openai-api-key: ant_your-api-key
auto-commits: true
gitignore: trueTips
- โขAider sends the full file content as context. For large files, Antbase may route to a model with a bigger context window automatically.
- โขUse /tokens in the Aider chat to see token usage. Antbase shows per-request routing details in the dashboard.
- โขAider supports architect mode (--architect) where one model plans and another executes. You can use Antbase for both or mix providers.
- โขIf Aider reports model errors, ensure you prefix the model name with openai/ so Aider uses the OpenAI-compatible provider.


