Skip to main content
Watch: I Built an AI App Without Leaving Databricks

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

  1. Step 1.

    Install aider.

    Terminal
    python -m pip install aider-install
    aider-install
  2. Step 2.

    Set your OpenRouter API key.

    Terminal
    export OPENROUTER_API_KEY=<key> # Mac/Linux
    setx   OPENROUTER_API_KEY <key> # Windows, restart shell after setx
  3. 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/
  4. 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.

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.