Aider
Open-source AI pair programmer for your terminal, pointed at Melious through its OpenAI-compatible settings
Aider is an open-source AI pair programmer that runs in your terminal, edits files in your git repo, and commits each change with a message it writes itself. Every model call goes through LiteLLM, so Aider already speaks OpenAI-compatible Chat Completions — pointing it at Melious is two environment variables and an openai/ prefix on the model name. Add two small files and Aider edits with the same diff format and cost tracking it gives the models it ships metadata for.
Setup
Install Aider
Aider's own installer sets up an isolated Python 3.12 environment, so it won't collide with whatever Python your project uses:
python -m pip install aider-install
aider-installOr uv, which is what aider-install runs under the hood:
uv tool install --force --python python3.12 --with pip aider-chat@latestEither way the installer adds its own bin directory to your PATH, so restart your shell before the next step. If aider still isn't found — a common one on Windows — python -m aider works with the same arguments.
Other methods (pipx, Docker, GitHub Codespaces) are in Aider's install docs.
Point Aider at Melious
Aider hands OPENAI_API_BASE and OPENAI_API_KEY to LiteLLM's OpenAI transport:
export OPENAI_API_BASE=https://api.melious.ai/v1
export OPENAI_API_KEY=sk-mel-<YOUR_API_KEY>Windows PowerShell:
$env:OPENAI_API_BASE = "https://api.melious.ai/v1"
$env:OPENAI_API_KEY = "sk-mel-<YOUR_API_KEY>"The base URL carries /v1, unlike the Anthropic-shape endpoint that Claude Code uses.
To keep the pair scoped to one project instead of your whole shell, put it in a .env file at the root of the repo. Aider loads it on startup and offers to add it to .gitignore:
OPENAI_API_BASE=https://api.melious.ai/v1
OPENAI_API_KEY=sk-mel-<YOUR_API_KEY>.aider.conf.yml works too, and can pin the model as well:
model: openai/glm-5.2
openai-api-base: https://api.melious.ai/v1
openai-api-key: sk-mel-<YOUR_API_KEY>Run Aider
From inside your repo:
aider --model openai/glm-5.2The openai/ prefix selects LiteLLM's OpenAI-compatible transport, not OpenAI the company — OPENAI_API_BASE decides who answers. The part after the prefix is the Melious model ID.
Aider prints its wiring before the first prompt. On a bare run it also warns that it doesn't know the model:
Warning for openai/glm-5.2: Unknown context window size and costs, using sane defaults.
Did you mean one of these?
- openai/gpt-5.2
- zai/glm-5.2
You can skip this check with --no-show-model-warnings
Aider v0.86.2
Model: openai/glm-5.2 with whole edit format
Git repo: .git with 1 files
Repo-map: using 1024 tokens, auto refreshEverything works at this point, but whole means the model rewrites entire files on every change. The next step fixes that.
Add model settings
Aider ships edit settings and metadata for the models it knows by name. For a Melious model you supply both, in two files at the root of your repo — or in your home directory, to cover every project.
.aider.model.settings.yml switches Aider from whole-file rewrites to search-and-replace edits:
- name: openai/glm-5.2
edit_format: diff
use_repo_map: true
accepts_settings: ["reasoning_effort"]Without that last line Aider ignores --reasoning-effort and says so: does not support 'reasoning_effort', ignoring. With it, the value rides along with the request — whether a model acts on it is up to the model.
.aider.model.metadata.json tells Aider the context window and rates. That clears the warning, turns on per-message cost reporting, and grows the repo map budget from 1,024 to 4,096 tokens:
{
"openai/glm-5.2": {
"max_input_tokens": 1000000,
"input_cost_per_token": 0.000001,
"output_cost_per_token": 0.000004,
"litellm_provider": "openai",
"mode": "chat"
}
}Take the numbers from GET /v1/models?include_meta=true: _meta.context_length is max_input_tokens, and _meta.pricing lists EUR per million tokens, so divide by a million. Both files key on the full model name, and the provider/ prefix has to match litellm_provider. Run Aider again and the header reads:
Aider v0.86.2
Model: openai/glm-5.2 with diff edit format
Git repo: .git with 1 files
Repo-map: using 4096 tokens, auto refreshNative provider on the way
A melious/ provider is landing upstream in LiteLLM, with a built-in melious alias for Aider on top of it. Once an Aider release ships both, the whole setup is one variable and one flag — no base URL, and the edit settings and metadata come built in:
export MELIOUS_API_KEY=sk-mel-<YOUR_API_KEY>
aider --model meliousOr pass the key inline with aider --model melious --api-key melious=sk-mel-<YOUR_API_KEY>. Until then, the steps above are the way.
Picking a model
Aider doesn't use tool calls. It asks the model to write edits as text blocks and applies them itself, so what matters is a model that follows a strict output format across a long conversation. Browse melious.ai/hub/models, or GET /v1/models?include_meta=true for context length and pricing.
Images work on the models that take them: add "supports_vision": true to the model's metadata entry and pass the file like any other. Without that flag Aider quietly leaves the image out of the request.
Name a model every time. With no --model, Aider picks a default from the keys it finds, sees OPENAI_API_KEY, and announces Using gpt-4o model with API key from environment — a model we don't run. Pin it with model: in .aider.conf.yml if you'd rather not pass the flag.
aider --list-models <name> won't help you browse our catalog: it searches LiteLLM's built-in table plus whatever you put in your metadata file, so it returns other providers' copies of a model name. Use the models hub or GET /v1/models.
Aider also uses a weak model for commit messages and chat summaries, and falls back to your main model when you don't name one. It sends that model the diff plus the chat history, so pick something cheap — and non-reasoning:
aider --model openai/glm-5.2 --weak-model openai/mistral-small-3.2-24b-instructA reasoning model is the wrong fit here. Aider waits for the whole reply, and a small hybrid model can spend thousands of reasoning tokens on a one-line commit message. Check _meta.reasoning_type for non_reasoning.
Architect mode splits the work between two models — one plans the change, the other writes the edits:
aider --architect --model openai/glm-5.2 --editor-model openai/qwen3-coder-nextAppend a flavor suffix to bias provider selection — openai/glm-5.2:speed, :price, or :eco. See Routing for the decision table.
What's different
OPENAI_API_BASEis global to the transport. In a shell where it's exported, everyopenai/model goes to Melious — including OpenAI's own, if you switch to one mid-project. Keep the pair in a project.envwhen you use both.- Settings match the exact model name.
openai/glm-5.2:speedis a different name fromopenai/glm-5.2, so a flavored model falls back towholeedits until the settings file has an entry for it, and loses cost reporting until the metadata file does too. - Reasoning shows up in the transcript. Hybrid and reasoning models stream their thinking, and Aider prints it under a
THINKINGheading before theANSWER. Those tokens bill as output. - Costs print in dollars. Aider always labels cost with
$, but the number comes from the rates in your metadata file. Enter our EUR rates and read the figure as EUR. - No Melious CLI support.
melious tools installcovers Claude Code, Codex, OpenCode, Mistral Vibe, and Pi. Aider you wire by hand. - Caching happens, but Aider can't see it. We cache prefixes automatically — a repeated 6.2k-token prompt comes back with
cached_tokens: 6144— and bill reads at the cheaper rate. Aider looks for DeepSeek'sprompt_cache_hit_tokensor Anthropic'scache_read_input_tokens, not OpenAI'scached_tokens, so it never prints a cache-hit line and the cost it shows is the uncached one.--cache-promptschanges nothing here. See Models. - Extra response fields are ignored. Non-streaming responses carry
environment_impactandbilling_cost; streamed chunks don't. Aider doesn't read either; your usage dashboard aggregates them.
When it breaks
Using gpt-4o model with API key from environment, thenModel not found: gpt-4o— you didn't pass--model, so Aider picked a default for the OpenAI key it found. Name a Melious model.LLM Provider NOT provided. Pass in the LLM provider you are trying to call. You passed model=glm-5.2— theopenai/prefix is missing. LiteLLM can't tell which transport to use without it.NotFoundError: OpenAIException - The requested resource was not found.— the model ID is fine, butOPENAI_API_BASEis missing/v1.APIConnectionError: OpenAIException - Model not found: <MODEL_ID>— a model ID we don't run. We report it as an error event inside the stream, which LiteLLM surfaces as a dropped connection rather than a clean 404, so the failure looks like a network problem instead of a bad model ID. That's on us. Check the ID withGET /v1/models.AuthenticationError: OpenAIException - Invalid API key format— the key is truncated or mistyped. Copy it again from melious.ai/account/api/keys.OPENAI_API_KEY: Not set— Aider warns before the first prompt, and the first request then fails withThe api_key client option must be set. Export the key in the shell that launches Aider, or add it to.env.Unknown context window size and costs, using sane defaults— Aider has no metadata for the model name you passed. Add it to.aider.model.metadata.json, spelled exactly as on the command line.- Aider applies the edit, then sits silent — it's waiting on the commit message from a reasoning weak model. Switch
--weak-modelto a non-reasoning model. 429mid-session — per-plan token caps, and Aider resends the repository map and chat history on every turn. Rate limits covers which plan lifts which limit.
Errors and retry patterns: Errors.