Use Aider with GammaInfra
Point Aider at GammaInfra's smart router and you get dollar-cost visibility per edit (not just token counts), the cost-quality dial for cheap-mode vs quality-mode per session, and automatic provider fallback when one provider rate-limits in the middle of a multi-file refactor. Setup is two env vars — Aider's existing CLI works unchanged.
The pain Aider users hit
Aider is precise — every edit is a diff, every diff is reviewable, every refactor goes through git. That precision has a cost shape Aider users know well:
- Per-edit cost grows with repo size. Aider sends a chunk of relevant repo context with every call. Heavy edits on big codebases can cost 5–10× what you'd expect from the prompt alone.
- Token counts ≠ dollars. Aider prints token counts after each edit but you have to translate that into provider rates yourself.
- Rate-limit walls mid-session. Aider sessions naturally fan out — 20+ edits in a refactor. OpenAI/Anthropic throttle, you wait.
What changes with GammaInfra
Point Aider at GammaInfra's smart router with two env-var changes — its existing CLI works unchanged on top of the OpenAI SDK shape. After the swap:
- Every response carries
X-GammaInfra-Cost-USD. The dashboard at dashboard.gammainfra.com rolls these up so you can see exact spend per session. - Provider rate-limits cascade. When Anthropic throttles your key, GammaInfra's fallback chain serves the next provider (Google, then DeepSeek, etc.) — Aider sees a 200 and moves on.
- You can switch quality tiers per command via headers without re-launching Aider.
X-GammaInfra-Cost-Quality: 0.7for cheap refactors,0.0for hard architectural changes.
Setup
1. Get a GammaInfra API key
Sign up at gammainfra.com and verify your email. $3 trial credit covers maybe 30–50 Aider edits on a small repo, plenty to feel the difference.
2. Set environment variables
The cleanest way — put these in your shell rc file (.bashrc, .zshrc, etc.):
export OPENAI_API_BASE="https://api.gammainfra.com/v1"
export OPENAI_API_KEY="sk-gammainfra-..."
Aider reads these environment variables automatically — no flag needed.
3. Or pass them as CLI flags
aider --openai-api-base https://api.gammainfra.com/v1 \
--openai-api-key sk-gammainfra-... \
--model gammainfra/auto
4. Or put them in .aider.conf.yml
If you want repo-local config (or want different settings per repo):
# .aider.conf.yml (in your repo root)
openai-api-base: https://api.gammainfra.com/v1
openai-api-key: sk-gammainfra-...
model: gammainfra/auto
5. Pick a model
Aider benefits from quality models for harder edits. Some patterns:
gammainfra/auto— task-aware routing. Reasonable default for most repos.anthropic/claude-opus-4-7— Anthropic flagship. Best for complex refactors and tricky type-system work.anthropic/claude-sonnet-4-6— Sonnet. Balanced quality + cost.openai/gpt-5— OpenAI flagship.deepseek/deepseek-v4-pro— Cheap reasoning tier with thinking mode. Slower per-edit but materially cheaper on big sessions.gammainfra/cheap— cost-optimized routing. Use for docs edits, comment fixes, simple type adjustments.
--architect mode uses two models — one for planning, one for editing. Set --model anthropic/claude-opus-4-7 for the architect role and --editor-model openai/gpt-5-mini for the editor role. Opus plans cleanly, GPT-5-mini applies diffs cheaply. GammaInfra supports both via the same endpoint.
Cost-conscious patterns
- Cost-quality dial per session. Pass
--extra-headers 'X-GammaInfra-Cost-Quality: 0.7'when you start aider for a heavy refactor that doesn't need top-tier reasoning. Switch to0.0for the gnarly stuff. - Max-latency budget.
X-GammaInfra-Max-Latency-Ms: 30000as a header — GammaInfra returns 504 if any single edit takes more than 30 seconds, instead of Aider quietly stalling on a slow provider. - BYOK for high-volume. If you already pay OpenAI/Anthropic directly, add those keys via the dashboard's Provider Keys tab. GammaInfra charges 1–2% per request instead of the pass-through model.
Verify it's working
Start an aider session, make one edit, then in the dashboard:
- Recent requests show with model, provider, latency, exact cost.
- Aider's own cost line (after each commit) reflects actual provider rates — no markup.
- If you ever care about the underlying provider chosen, the
X-GammaInfra-Endpointresponse header reveals it.
Trade-offs
- Latency. ~10–50 ms overhead per call. Imperceptible during the slower think-then-diff cycles Aider does anyway.
- Cost. 3% top-up fee (launch window) / 5% (standard) on managed credits. Pass-through token rates — no markup. Compares favorably with Aider users currently topping up OpenAI/Anthropic credits directly.
- Privacy. Prompts and responses aren't logged by default. See privacy policy.
Troubleshoot
- Aider says "model not found". Your
--modelargument is malformed. Use slash-namespaced format:gammainfra/auto, notauto. Or use provider direct-pins:anthropic/claude-opus-4-7. - Tool calls fail on some models. Aider uses tool calls for architect mode and structured edits. Pin a high-quality model (
claude-opus-4-7) if you hit tool-call failures withgammainfra/auto. - Token counts look off. Aider's count includes its internal prompt; the cost-USD header reflects actual provider tokens including system prompts the provider adds.
Ready to try it?
$3 free trial credit on signup, $10 minimum top-up. Pass-through provider token rates plus 3% top-up fee during the launch window (5% after 2026-06-23).
Frequently asked questions
What's the aider command flag for GammaInfra?
--openai-api-base https://api.gammainfra.com/v1 and --openai-api-key sk-gammainfra-... on the aider command line. Or set OPENAI_API_BASE and OPENAI_API_KEY environment variables. Then use --model gammainfra/auto or any specific model. aider remembers these in ~/.aider.conf.yml for the next session.Can I see how much each aider edit cycle cost?
X-GammaInfra-Cost-USD response header.Does aider's /architect mode work with smart routing?
/architect uses one model for the architect (planning) pass and another for the editor (diff) pass. Point the architect model at a quality tier (anthropic/claude-opus-4-7, or gammainfra/auto biased to quality via the X-GammaInfra-Cost-Quality header) and the editor model at a cheaper tier (anthropic/claude-sonnet-4-6 or gammainfra/cheap). aider exposes separate settings for the two passes — see aider's current docs for the exact option names; each pass routes independently through GammaInfra.What model should I pin for code-heavy aider sessions?
anthropic/claude-sonnet-4-6 is the practical sweet spot — best real-world code quality, reasonable cost. claude-opus-4-7 for hard problems where you want max quality. For straightforward edits in well-organized repos, gpt-5-mini or deepseek-v4-flash via gammainfra/cheap can produce equivalent results at a fraction of the cost.Does GammaInfra support aider's /web command?
/web command fetches a URL locally and adds the page content to the chat context. That's an aider-side feature — it doesn't touch the LLM call. After the page content is in the chat, the next message routes through GammaInfra normally. So yes, /web works, GammaInfra just doesn't see the fetch step.