Using Routic with Aider

Switch Aider's AI backend to Routic and use Claude, DeepSeek, and more at a lower cost.

How it works

Aider supports --openai-api-base for any OpenAI-compatible endpoint and --anthropic-api-base for Anthropic-compatible endpoints. Routic supports both formats.

Prerequisites

  • Aider installed (pip install aider-install or pip install aider-chat)
  • A Routic Base URL and API Key

Option 1: Let your AI agent configure it (fastest)

Tell your AI agent:

Configure Aider to use Routic as the AI backend.

Give it this information:

Via config file (recommended): Edit ~/.aider.conf.yml and add:

openai-api-key: sk-YOUR_KEY_HERE
openai-api-base: https://api.routic.ai/v1
model: deepseek-v3

openai-api-base must include the /v1 suffix.

Or via environment variables (add to ~/.bashrc or ~/.zshrc):

export OPENAI_API_KEY="sk-YOUR_KEY_HERE"
export OPENAI_BASE_URL="https://api.routic.ai/v1"

Once the agent is done, replace sk-YOUR_KEY_HERE with your actual key.

Option 2: Manual setup

Command-line flags (quick test)

aider \
  --openai-api-key sk-YOUR_KEY_HERE \
  --openai-api-base https://api.routic.ai/v1 \
  --model deepseek-v3

--openai-api-base must include the /v1 suffix.

Config file (recommended for daily use)

Edit ~/.aider.conf.yml:

openai-api-key: sk-YOUR_KEY_HERE
openai-api-base: https://api.routic.ai/v1
model: deepseek-v3

After this, run aider from the project directory without extra flags.

Environment variables

export OPENAI_API_KEY="sk-YOUR_KEY_HERE"
export OPENAI_BASE_URL="https://api.routic.ai/v1"

Older Aider versions may read OPENAI_API_BASE (without _URL). Check your version's docs.

Using Anthropic format (Claude models)

export ANTHROPIC_BASE_URL="https://api.routic.ai"
aider \
  --anthropic-api-key sk-YOUR_KEY_HERE \
  --model claude-3-5-sonnet-20241022

ANTHROPIC_BASE_URL should not include /v1 — Aider appends the path automatically.

Verify

aider --message "reply with pong" --no-git

A normal response confirms success.

Choosing a model

The --model value must exactly match a name in the Routic model catalog.

Use caseRecommended model
Everyday coding (speed/cost balance)deepseek-v3
Complex reasoningdeepseek-r1
Fast small editsdeepseek-v3.1

Troubleshooting

Model ... not found
Use the full catalog name — shorthand like sonnet won't work.

Aider warns about missing function calling support
Switch to a model that supports function calling (check the capability matrix in the model catalog).

Different models per project
Create a .aider.conf.yml in each project root; project-level config overrides ~/.aider.conf.yml.

Related