Aider
About
Aider is a command-line pair programming tool that connects to OpenAI-compatible APIs. It lets you chat with models to edit your codebase, auto-commit changes, and build software collaboratively from the terminal.
This guide explains how to connect AI/ML API to Aider using the OpenAI-compatible flow. Youβll get a clean setup with one endpoint, support for slashes in model names, and full compatibility with all chat-completion models.
Quick Setup
Base URL
https://api.aimlapi.com/v1
API Key
Your AI/ML API key (create at aimlapi.com/app/keys)
Model
openai/meta-llama/Llama-3-70b-chat-hf (openai/<your_full_model_id>)
Command Example
aider --model openai/chatgpt-4o-latest
Tip: Always include the openai/ prefix (case-sensitive) before your model name.
This ensures Aider correctly routes requests to your AI/ML API endpoint.
Installation
β
Prerequisites
AI/ML API key
Python 3.8β3.13 installed
Internet access to
api.aimlapi.comAider installed (Install Guide)
1οΈβ£ Install Aider

2οΈβ£ Configure AI/ML API credentials
Mac/Linux
Windows (PowerShell)
3οΈβ£ Run Aider with AI/ML API
Move into your project directory:
Then launch Aider with your preferred model:

4οΈβ£ Model Prefix Rule
Aider automatically routes requests to your OPENAI_API_BASE.
To connect to AI/ML API, always prefix your model with openai/.
Pattern:
Examples:
openai/chatgpt-4o-latestopenai/meta-llama/Llama-3-70b-chat-hfopenai/deepseek/deepseek-chatopenai/anthropic/claude-3.7-sonnetopenai/google/gemini-1.5-pro
Example Aider Session
Aider will:
Load your project map.
Analyze the repo.
Apply AI-suggested edits.
Commit changes automatically.


Common Pitfalls
Bad request β check parameters β verify the model name and prefix
Unknown model β confirm it exists in AI/ML API Models
Invalid API key β re-copy from AI/ML API Dashboard
No response β check
OPENAI_API_BASEand your internet access
π References
Last updated
Was this helpful?