Aider + Cheap Claude API: How to Cut Aider's Token Bill 80%
Aider's whole-file edit format makes it accurate — and expensive. Here's how to point aider at an Anthropic-compatible endpoint at 80% off without losing a single feature.
Aider is brilliant. Aider is expensive.
Aider — the open-source AI pair programming CLI — has been the gold standard for terminal-based coding for two years now. Its repo-map awareness, git-aware commits, and SWE-bench-topping diff format make it the agent of choice for serious open-source maintainers.
Aider's own team publishes the cost of their leaderboard runs. A single sweep across 10 models costs thousands of dollars in API fees. For everyday users, the bill is smaller but real: a 30-minute coding session can hit 500k tokens once you have repo-map and history loaded. At Claude Sonnet 4.6 rates ($3/$15 per 1M), that's $5-10 per session.
Aider's whole-file and udiff edit formats are the reason. They send the entire file (or a generous diff) every turn so the model has the freshest context — accurate, but expensive.
You can't change the format without changing the agent. You *can* change the API endpoint.
The two env vars
Aider reads ANTHROPIC_API_KEY and ANTHROPIC_API_BASE from the environment, just like the underlying Anthropic SDK. Set them to point at claudeapi.cheap and aider runs unchanged at 70-80% off.
export ANTHROPIC_API_KEY="sk-cc-your-key-here"
export ANTHROPIC_API_BASE="https://claudeapi.cheap/api/proxy"
aider --model anthropic/claude-sonnet-4-6That's the entire setup. The repo-map, commit messages, edit-confirmation flow, /add, /drop, /diff — every aider command works identically.
Architect mode with two providers
Aider's --architect mode is one of its sharpest tricks: use one model to plan and another to edit. The classic combo is OpenAI o1 (or now GPT-5) as architect + Claude Sonnet as editor. Through claudeapi.cheap, both providers point at us with the same key:
export ANTHROPIC_API_KEY="sk-cc-your-key-here"
export ANTHROPIC_API_BASE="https://claudeapi.cheap/api/proxy"
export OPENAI_API_KEY="sk-cc-your-key-here"
export OPENAI_API_BASE="https://claudeapi.cheap/api/proxy/v1"
aider --architect \
--architect-model openai/gpt-5.5 \
--editor-model anthropic/claude-sonnet-4-6GPT-5.5 plans (best reasoning), Sonnet edits (best diff format), one bill at 80% off both.
What you save
Aider sessions vary wildly — quick fix vs. multi-file refactor — but realistic numbers:
| Use level | Anthropic direct | claudeapi.cheap (Pro) | Saved |
|---|---|---|---|
| Hobby (1 hr / week) | $20 | $4 | $16 |
| Daily (30 min / day) | $80 | $16 | $64 |
| Heavy (2 hr / day) | $250 | $50 | $200 |
| Open-source maintainer | $500+ | $100+ | $400+ |
The Pro plan is $19 once, lifetime. For any real aider user, that pays back in days, not months.
Edit formats and accuracy
Quick reassurance: all three of aider's edit formats work end-to-end through the proxy.
The model produces the same edit format whether the API is Anthropic direct or claudeapi.cheap. Aider's local diff applier doesn't see a difference.
Best models for aider
--architect mode. Best plans, hands off to Sonnet for execution.--weak-model for commit messages and summarization. Pennies per session.Verify
After exporting the env vars, run a small aider task on any repo. In your claudeapi.cheap dashboard, the request shows up in usage logs within seconds. Token count should match what aider reports in its tokens: line at the bottom of the output.
Get started
Free Basic plan (70% off, 200 RPM) is enough to test aider for a few days. Pro at $19 lifetime unlocks 80% off and 500 RPM. With aider's token appetite, Pro pays itself back in your first session — every session after is gravy.