$Cheapa API Docs

Aider

Configure Aider, the terminal-based AI pair programmer, to use Cheapa API for powerful code generation and modification.

What This Does

Aider is a command-line tool that lets you edit code through natural language conversations. It can read your codebase, make precise edits, and even commit changes to git. By connecting Aider to Cheapa API, you gain access to powerful models while managing all your AI spending through a single account.


Setup

Step 1: Install Aider

pip install aider-chat

Or with pipx for isolation:

pipx install aider-chat

Step 2: Set Environment Variables

Aider uses OpenAI-style environment variables. Set them in your shell:

export OPENAI_API_BASE="https://api.cheapaapi.com/v1"
export OPENAI_API_KEY="YOUR_Cheapa API_API_KEY"

Replace YOUR_Cheapa API_API_KEY with your actual key from cheapaapi.com/keys.

Step 3: Persist the Configuration

Add the exports to your shell profile for persistence:

Zsh (~/.zshrc):

echo 'export OPENAI_API_BASE="https://api.cheapaapi.com/v1"' >> ~/.zshrc
echo 'export OPENAI_API_KEY="YOUR_Cheapa API_API_KEY"' >> ~/.zshrc
source ~/.zshrc

Bash (~/.bashrc):

echo 'export OPENAI_API_BASE="https://api.cheapaapi.com/v1"' >> ~/.bashrc
echo 'export OPENAI_API_KEY="YOUR_Cheapa API_API_KEY"' >> ~/.bashrc
source ~/.bashrc

Step 4: Launch Aider with Your Model

Navigate to your project directory and start Aider:

cd /path/to/your/project
aider --model kimi-k2.7-code

Or specify a different model:

aider --model deepseek-v4-pro
aider --model minimax-m3
aider --model glm-5.1

Step 5: Add Files to the Chat

Once Aider is running, add the files you want to work on:

> add main.py utils.py

Then start chatting naturally about what changes you want.


TaskModelRationale
Code-specialized reasoningkimi-k2.7-codeMoonshot's code-tuned K2.7 — best for generation and refactoring
Frontier code reasoningclaude-opus-4.8Anthropic flagship — best at architectural changes and tricky bugs
Strong general devgpt-5.5 or gpt-5.4OpenAI's latest GPT-5 family, 1M context
Cost-balanced sessionsclaude-sonnet-4.6Strong code reasoning at lower cost than Opus
General developmentdeepseek-v4-proOptimized for code edits
Complex refactoringkimi-k2.6Strong reasoning for architectural changes
Large codebasesminimax-m3 or gpt-5.51M context fits more files
Quick fixesgemini-3.1-flash-lite-preview or glm-5.1Fast iteration, low cost

Command Reference

CommandDescription
aider --model kimi-k2.7-codeStart with the code-specialized default
aider --list-modelsShow available models
aider file1.py file2.pyStart with specific files
aider --auto-commitsAuto-commit changes
aider --no-auto-commitsDisable auto-commits

Troubleshooting

"API key not found" error

  • Ensure OPENAI_API_KEY is exported in your current shell
  • Run echo $OPENAI_API_KEY to verify it's set

"Model not available" error

  • Use the exact model slug from the Models reference
  • Try aider --list-models to see what Aider detects

Connection timeout

  • Verify OPENAI_API_BASE is exactly https://api.cheapaapi.com/v1
  • Check your network can reach api.cheapaapi.com

Slow responses on large files

  • Use a model with larger context: minimax-m3
  • Add fewer files to the chat context at once

Changes not applying correctly

  • Ensure files are added to the chat with add <filename>
  • Check that Aider has write permissions in the directory

Notes

  • Aider works best when you add relevant files to context before asking for changes
  • It integrates with git — commits are created automatically unless disabled
  • Use --dry-run to preview changes without modifying files
  • All token usage appears in your Cheapa API dashboard immediately
  • For sensitive projects, consider using --no-auto-commits to review before committing

On this page