Setup guide - Documented by Aider
Use OpenRouter in Aider
Aider supports OpenRouter natively: set OPENROUTER_API_KEY and run aider --model openrouter/<provider>/<model>. Provider routing is set in .aider.model.settings.yml.
Last verified 4 steps3 official sources
Steps
- Step 1.
Install aider.
Terminalpython -m pip install aider-install aider-install - Step 2.
Set your OpenRouter API key.
Terminalexport OPENROUTER_API_KEY=<key> # Mac/Linux setx OPENROUTER_API_KEY <key> # Windows, restart shell after setx - Step 3.
Start aider in your codebase with an OpenRouter model, or list the available OpenRouter models.
Terminal# Change directory into your codebase cd /to/your/project # Or any other open router model aider --model openrouter/<provider>/<model> # List models available from OpenRouter aider --list-models openrouter/ - Step 4.
Optional: control OpenRouter provider routing in .aider.model.settings.yml, placed in your home directory or the root of your git project.
YAML- name: openrouter/anthropic/claude-3.7-sonnet extra_params: extra_body: provider: # Only use these providers, in this order order: ["Anthropic", "Together"] # Don't fall back to other providers allow_fallbacks: false # Skip providers that may train on inputs data_collection: "deny" # Only use providers supporting all parameters require_parameters: true
Caveats
- Aider's docs give only the pattern openrouter/<provider>/<model>. The listed modelIds join that pattern to concrete OpenRouter slugs from OpenRouter's docs (anthropic/claude-opus-4.8, anthropic/claude-opus-5). This combines the two sources. Use aider --list-models openrouter/ to confirm.
- The settings example uses openrouter/anthropic/claude-3.7-sonnet, copied verbatim from aider's docs. It is an older model.
- Whether OpenRouter ~latest aliases work through aider's openrouter/ prefix is not documented. Prefer concrete slugs.
- If you get errors, check your OpenRouter privacy settings and enable providers that may train on inputs to allow all models.
More setup guides
Same tool, other providers
Related reading
- Model Routing Recipes: Practical Config Patterns to Cut AI SpendModel routing recipes with paste-ready OpenRouter and LiteLLM configs for task tiers, fallback chains, cost ceilings and cache-aware routing that cut AI spend.
- OpenRouter Fusion Makes Model Panels Real. Use Them Like Escalation, Not AutopilotOpenRouter Fusion turns multi-model panels into an API feature. Use it as an escalation lane for prompts where a wrong answer is expensive, not as the default.
- OpenRouter in 2026: Review, Setup, and When Model Routing PaysOpenRouter review and setup - one API key for 300+ models with fallbacks and provider routing, what it costs, and when to go direct to a provider instead.
- LLM Routers Compared: LiteLLM vs Portkey vs OpenRouter in 2026LiteLLM vs Portkey vs OpenRouter compared for production AI apps: cost tracking, fallbacks, caching, and load balancing, plus when to use each router.
- Aider vs Claude Code in 2026: Git-First Open Source vs Subagent RuntimeAider vs Claude Code: git-first, model-agnostic Aider against the Claude Code runtime of subagents and hooks. Compare architecture, cost, governance and fit.
- Aider vs Claude Code: Open Source vs Commercial AI Coding CLIAider is open source and works with any model. Claude Code is Anthropic's commercial agent. Here is how they compare for TypeScript.
FAQ
How do I use OpenRouter in Aider?
Aider supports OpenRouter natively: set OPENROUTER_API_KEY and run aider --model openrouter/<provider>/<model>. Provider routing is set in .aider.model.settings.yml.
Which OpenRouter model ids work in Aider?
The official docs read for this guide list openrouter/anthropic/claude-opus-4.8 and openrouter/anthropic/claude-opus-5.
Is this an official OpenRouter and Aider setup?
Aider documents this setup in its own docs. It was last checked against 3 official pages on October 17, 2026.
Sources
Last verified against 3 official pages.
Newsletter
New models, set up the day they ship
One email per week. New model releases, the coding tools that support them and how to wire them up.