Unlimited Aider with the Claude API
Aider is a terminal-based AI pair programming tool that works with your existing git repository. It uses a unique architecture with separate models for different roles — a main coding model, an editor model for applying changes, and an architect model for planning. Each refactoring cycle involves multiple API calls as Aider generates changes, applies them with the editor model, commits them to git, and updates its repo map. This multi-model, multi-call pattern makes Aider a natural fit for flat-rate unlimited API access.
Aider's Multi-Call Architecture and Token Patterns
Aider does not simply send your request and return a response. Each interaction triggers a pipeline: the main model generates the edit instructions, the editor model parses and applies them to your files, and if architect mode is active, a separate planning step precedes everything. Additionally, Aider maintains a repository map — a compressed representation of your entire codebase's structure — that is included in every request to give the model awareness of files it has not explicitly been shown.
The repo map alone can consume 10,000-30,000 tokens depending on project size, and it is sent with every single request. When you add the file contents you have explicitly included in the chat, the conversation history, and the model's response, a typical Aider interaction uses 50,000-100,000 tokens. A refactoring session involving five or six exchanges easily reaches half a million tokens total.
Architect mode doubles the calls per interaction: first the architect model plans the changes at a high level, then the main model implements the plan in concrete edits. This produces better results for complex changes but literally doubles the API consumption. On per-token billing, users often disable architect mode to save money. On unlimited, you should leave it enabled for every non-trivial task.
Connecting via the Native Anthropic Path
Aider supports Anthropic models natively through the anthropic/ model prefix. To use a custom base URL, set the ANTHROPIC_API_BASE environment variable to https://unlimited.aiprimetech.io — the root host without /v1, because the Anthropic SDK handles path construction internally. Set ANTHROPIC_API_KEY to your AI Prime Tech Unlimited key.
Launch Aider with the model flag: aider --model anthropic/claude-sonnet-4-5. The anthropic/ prefix tells Aider to use the Anthropic SDK path (which reads ANTHROPIC_API_BASE and ANTHROPIC_API_KEY). There is no --anthropic-api-base command-line flag — you must use the environment variable or the --set-env flag: aider --set-env ANTHROPIC_API_BASE={SITE} --model anthropic/claude-sonnet-4-5.
This path gives you full Anthropic Messages API support including streaming, tool use, and thinking blocks. It is the recommended path for Claude models because Aider's edit format parsing is optimized for Anthropic's response structure. The editor model and weak model can also be set to Claude variants on this path.
Connecting via the OpenAI-Compatible Path
Alternatively, use the OpenAI-compatible path by setting OPENAI_API_BASE to https://unlimited.aiprimetech.io/v1 (note the /v1 suffix here) and OPENAI_API_KEY to your unlimited key. Launch with: aider --model openai/claude-sonnet-4-5. The openai/ prefix routes through LiteLLM's OpenAI handler.
The OpenAI path works well for basic interactions but may have limitations with some Anthropic-specific features. Aider uses LiteLLM under the hood to translate between provider formats, and the translation layer handles most cases correctly. However, for maximum compatibility — especially with tool calling and structured edits — the native Anthropic path is preferable.
You can mix paths: use the Anthropic path for the main model and a different provider for the weak model. This flexibility is useful if you want Claude for heavy reasoning but a cheaper model for trivial tasks like commit message generation. On unlimited, however, there is no cost incentive to mix — you can use Claude for everything.
Architect Mode and Model Splits
Aider's /architect command activates a two-phase workflow: an architect model plans the changes, then the editor model implements them. Set the architect model with --architect anthropic/claude-opus-4-6 for maximum planning quality. The editor model handles the mechanical work of producing correctly-formatted diffs and can use a faster model.
The weak-model setting controls which model handles lightweight tasks — generating commit messages, summarizing changes, and other non-critical work. Set it with --weak-model anthropic/claude-haiku-4-5. On per-token billing, the weak model saves significant money by offloading trivial tasks from expensive models. On unlimited, the savings are in latency rather than cost — Haiku responds faster for simple tasks.
A fully-configured Aider session on unlimited might use: --model anthropic/claude-sonnet-4-5 (main coding), --architect anthropic/claude-opus-4-6 (planning), --weak-model anthropic/claude-haiku-4-5 (commits and summaries). This gives you the strongest model at each decision point without any cost concern. The only tradeoff is response latency for Opus-powered architect steps.
Repository Map and CONVENTIONS.md
Aider automatically generates a repo map — a condensed view of your repository's file structure, class hierarchies, and function signatures — and includes it in every API request. This gives the model awareness of code it hasn't been shown explicitly, enabling it to suggest imports, call existing functions, and maintain consistency with the broader codebase.
The repo map size scales with your project. For a small project (50 files), it might add 5,000 tokens. For a large monorepo (500+ files), it can reach 30,000 tokens. Since this is included in every request, it represents a significant baseline token cost per interaction. On unlimited, this is a non-issue — let the repo map be as detailed as Aider wants without worrying about the per-request cost.
CONVENTIONS.md is Aider's equivalent of project-level instructions. Place it in your repo root and Aider includes its content in the system prompt. Use it to specify coding standards, naming conventions, preferred patterns, and project-specific rules. Like the repo map, this adds tokens to every request — on unlimited, write comprehensive conventions without worrying about the token cost per character.
Git Integration and Auto-Commits
Aider commits every change to git automatically with a descriptive commit message generated by the weak model. This creates a clean history of AI-assisted changes that you can review, cherry-pick, or revert individually. The auto-commit feature requires that your working directory is a git repository with no uncommitted changes (or use --dirty to override).
Each commit message generation is a separate API call to the weak model. Over a session with many small changes, these calls add up. On unlimited, auto-commits are free to run at maximum frequency — commit after every single change for the finest-grained history. You can always squash commits later, but you cannot un-squash a single large commit.
Use /undo to revert the last change and its commit, then rephrase your request. On unlimited, this undo-retry loop costs nothing extra, making it a natural workflow for iterative refinement. Try a change, check the result, undo if it is not right, adjust your instructions, and try again — each iteration is covered by the flat rate.
Troubleshooting Aider Configuration
The most common error is mixing up the base URL format between paths. For the Anthropic path (anthropic/ prefix): ANTHROPIC_API_BASE must be the root host without /v1. For the OpenAI path (openai/ prefix): OPENAI_API_BASE must include /v1. If you get connection errors or 404s, check this first.
If Aider reports 'model not found' errors, verify the model string includes the correct prefix — anthropic/claude-sonnet-4-5 for the Anthropic path or openai/claude-sonnet-4-5 for the OpenAI path. The prefix tells LiteLLM which SDK to use, and the model ID after the slash must match what the gateway serves.
Streaming errors (partial responses, cut-off output) can indicate a proxy or firewall interfering with Server-Sent Events. Aider streams responses by default. If you are behind a corporate proxy, try --no-stream to disable streaming and use synchronous requests instead. This increases perceived latency but avoids streaming-related connection issues.
# Native Anthropic path (recommended)
export ANTHROPIC_API_BASE="https://aiprimetech.io"
export ANTHROPIC_API_KEY="<your AI Prime Tech Unlimited key>"
aider --model anthropic/claude-sonnet-4-5 \
--architect anthropic/claude-opus-4-6 \
--weak-model anthropic/claude-haiku-4-5
# OpenAI-compatible path (alternative)
# export OPENAI_API_BASE="https://aiprimetech.io/v1"
# export OPENAI_API_KEY="<your key>"
# aider --model openai/claude-sonnet-4-5
# Or inline with --set-env:
# aider --set-env ANTHROPIC_API_BASE=https://aiprimetech.io \
# --model anthropic/claude-sonnet-4-5
Frequently asked questions
Does Aider have an --anthropic-api-base command-line flag?
No. Aider reads the Anthropic base URL from the ANTHROPIC_API_BASE environment variable. Use --set-env ANTHROPIC_API_BASE=https://unlimited.aiprimetech.io to set it inline, or export it in your shell profile for persistent configuration.
Should I use the anthropic/ or openai/ prefix for Claude models in Aider?
Use the anthropic/ prefix for the native Anthropic SDK path. It provides better compatibility with Claude's tool calling, edit formats, and streaming. The openai/ prefix works but adds a translation layer that can occasionally cause formatting issues with complex edits.
What is the repo map and how does it affect token usage?
The repo map is a compressed representation of your codebase's structure included in every request. It adds 5,000-30,000 tokens per call depending on project size. On unlimited, this overhead is covered by the flat rate — let it run at full detail for best results.
Can I use architect mode without extra cost on unlimited?
Yes. Architect mode doubles API calls per interaction (plan + implement), which doubles token consumption. On the unlimited plan this is fully covered. Keep architect mode enabled for any non-trivial refactoring to get better results from the planning step.
Why does Aider make a separate API call for each commit message?
Aider uses the weak model to generate descriptive commit messages for each auto-commit. This is a lightweight call that on unlimited costs nothing extra. The result is a clean, well-documented git history of all AI-assisted changes.
Get an API key — no Anthropic account or waitlist required.
Get your API keyAI Prime Tech is an independent API gateway. It is not affiliated with, endorsed by, or a reseller of Anthropic. Claude and related model names are trademarks of their respective owners.