Aider Integration

AVELIN API is fully compatible with Aider — an AI pair programming tool that runs in your terminal. Aider lets you edit code in your local git repository through natural language, with automatic commits, multi-file editing, and repo-map awareness powered by AVELIN's frontier models.

Why AVELIN + Aider? Aider's repo-map and multi-file editing shine with 1M-token context windows. AVELIN delivers the best coding models with 90% prompt caching discounts, automatic failover, and ~100 tps throughput — all through a single OpenAI-compatible endpoint.


Quick Setup

Step 1: Get your AVELIN API key

Sign up at avelin.ai and generate an API key. It will look like sk-ave...xxxx.

Step 2: Install Aider

# Option A: pip
pip install aider-chat

# Option B: dedicated installer (recommended for isolated environments)
aider-install

# Option C: Homebrew (macOS)
brew install aider

Step 3: Configure Aider

Aider supports OpenAI-compatible endpoints out of the box. You can configure it via environment variables, a config file, or CLI flags.

Option A: Environment Variables

export OPENAI_API_BASE=https://api.avelin.ai/v1
export OPENAI_API_KEY=sk-ave...xxxx

Add these to your ~/.bashrc or ~/.zshrc for persistence.

Option B: Config File

Create or edit ~/.aider.conf.yml:

openai-api-base: https://api.avelin.ai/v1
openai-api-key: sk-ave...xxxx
model: openai/avelin-coding-pro

Option C: CLI Flags

aider --model openai/avelin-coding-pro \
      --openai-api-base https://api.avelin.ai/v1 \
      --openai-api-key sk-ave...xxxx

Step 4: Select Your Model

Start Aider with your chosen model:

# Using the config file (model already set)
aider

# Or specify on the command line
aider --model openai/avelin-coding-pro

# Add files to work with
aider src/main.py src/utils.py

Primary Recommendation: avelin-coding-pro

For pair programming in the terminal:

Featureavelin-coding-proWhy it matters for Aider
Context window1M tokensAider's repo-map plus full file contents fit without truncation
Max output65K tokensLarge multi-file diffs and comprehensive refactors
Throughput~100 tokens/sec2× faster than standard tiers — tighter edit loops
ReasoningDeep step-by-step thinkingUnderstands cross-file dependencies and side effects
Tool callingFirst-class supportReliable structured edit format for Aider's diff/whole modes

Alternative Models

ModelWhen to use
avelin-coding-fastLighter coding tasks, quick questions — saves cost on simple edits
avelin-coding-ultraSystem design, architecture reviews, large-scale refactors (use as architect model)
avelin-fastQuick lookups, simple fixes — lowest cost, fastest response

Why AVELIN for Aider?

1. Cost Optimization

Aider sends your repo-map and file contents with every request. AVELIN minimizes the cost:

  • Prompt caching: ~80% cost reduction on repeated system prompts and repo-maps
  • Competitive pricing: Lower per-token costs than direct provider APIs
  • Pay-per-token: No subscription lock-in — pay only for what you use

2. Model Diversity

Access multiple frontier coding models through one API. Use Aider's architect/edit model split:

aider --architect \
      --model openai/avelin-coding-ultra \
      --editor-model openai/avelin-coding-pro

This lets the architect model plan changes while the editor model writes the code.

3. Reliability

  • Automatic failover: If one provider is slow or down, AVELIN switches to another
  • Retry logic: Transient errors are handled automatically
  • 99.9% uptime: Enterprise-grade infrastructure — no interrupted editing sessions

4. 1M Context Windows

Aider's repo-map gives the model a structural overview of your entire codebase. With 1M-token context windows, even large monorepos fit comfortably — no need to aggressively exclude files from the map.


Example Workflows

Multi-File Editing

# Start aider with the files you want to work on
$ aider src/auth.py src/models.py src/routes.py

> Add JWT authentication with refresh tokens. Update the User model
  to store refresh token hashes, and add login/refresh/logout endpoints.

Aider: I'll make these changes across all three files:

1. src/models.py — Add refresh_token_hash field to User model
2. src/auth.py — Add JWT generation, refresh token creation, and verification
3. src/routes.py — Add /auth/login, /auth/refresh, /auth/logout endpoints

[Applies edits to all three files]
[Commits: "Add JWT authentication with refresh tokens"]

Refactoring Workflow

$ aider --map-tokens 4096

> /add src/**/*.py

> Refactor all database access to use the repository pattern.
  Create a BaseRepository class and migrate existing queries.

Aider: I'll analyze the codebase and implement the repository pattern...

[Creates src/repositories/base.py]
[Creates src/repositories/user_repo.py]
[Updates src/services/user_service.py]
[Commits: "Refactor database access to repository pattern"]

Bug Fixing

$ aider src/api/endpoints.py tests/test_endpoints.py

> The /users endpoint returns a 500 error when the page parameter
  is negative. Fix the bug and add a test for edge cases.

Aider: Let me look at the endpoint code...

I see the issue — there's no validation on the `page` parameter before
it's used in the SQL OFFSET clause. I'll add validation and a test.

[Fixes src/api/endpoints.py — adds parameter validation]
[Updates tests/test_endpoints.py — adds edge case tests]
[Commits: "Fix 500 error on negative page parameter"]

Advanced Configuration

Full .aider.conf.yml

# API Configuration
openai-api-base: https://api.avelin.ai/v1
openai-api-key: sk-ave...xxxx

# Model Selection
model: openai/avelin-coding-pro

# Editor Model (for architect mode)
editor-model: openai/avelin-coding-pro

# Weak/Fast model (for simple tasks like commit messages)
weak-model: openai/avelin-fast

# Context and Map Settings
map-tokens: 4096
map-multiplier-no-files: 2

# Edit Format
edit-format: diff

# Git Settings
auto-commits: true
dirty-commits: true
attribute-author: true
attribute-committer: true

# Output
dark-mode: true
pretty: true

Architect Mode

Use a stronger model for planning and a faster model for editing:

aider --architect \
      --model openai/avelin-coding-ultra \
      --editor-model openai/avelin-coding-pro \
      --weak-model openai/avelin-fast

Map Type Settings for Large Repos

Aider's repo-map is essential for understanding large codebases. Tune it for your project:

# Increase map tokens for large repos
map-tokens: 8192

# Use tree-sitter for better code parsing
map-tokens-mult: 2

# Exclude generated/vendor files
read: .aiderignore

Create a .aiderignore file (gitignore syntax) to exclude noise:

node_modules/
dist/
*.min.js
vendor/
__pycache__/
*.pyc

Model-Specific Flags

# Higher max output for large refactors
aider --model openai/avelin-coding-pro --max-chat-history-tokens 65536

# Streaming for real-time output
aider --stream

# No streaming (if terminal has issues)
aider --no-stream

Troubleshooting

IssueSolution
"Model not found"Ensure the model name is prefixed with openai/ (e.g., openai/avelin-coding-pro)
"API key invalid"Verify your AVELIN API key starts with sk-ave and OPENAI_API_BASE is set to https://api.avelin.ai/v1
Slow responsesTry avelin-fast for simpler tasks, or check your network connection
Edit format errorsSwitch edit format: --edit-format whole or --edit-format diff
Repo-map too largeReduce --map-tokens or add exclusions to .aiderignore
Context overflowStart a new chat (/clear) or use /drop to remove files you no longer need
Streaming garbled outputUse --no-stream flag or try a different terminal emulator
Architect mode not workingEnsure both --model and --editor-model are set with openai/ prefix