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

Field
Value

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


Installation

βœ… Prerequisites

  • AI/ML API key

  • Python 3.8–3.13 installed

  • Internet access to api.aimlapi.com

  • Aider installed (Install Guide)


1️⃣ Install Aider

Install Aider via terminal

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:

Running Aider with AI/ML API model
Running Aider with AI/ML API 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-latest

  • openai/meta-llama/Llama-3-70b-chat-hf

  • openai/deepseek/deepseek-chat

  • openai/anthropic/claude-3.7-sonnet

  • openai/google/gemini-1.5-pro


Example Aider Session

Aider will:

  1. Load your project map.

  2. Analyze the repo.

  3. Apply AI-suggested edits.

  4. Commit changes automatically.

Aider researching your repo
Aider researching your repo
Aider working on code changes
Aider working on code changes

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_BASE and your internet access


πŸ“š References

Last updated

Was this helpful?