The configuration surface
Aider takes the base URL either as a flag or from the environment:--openai-api-base, and its own environment variable is
AIDER_OPENAI_API_BASE. Note the variable name: Aider’s documentation names
OPENAI_API_BASE, and does not mention OPENAI_BASE_URL, which is the name the
official OpenAI SDKs read. They are different strings and only the first is
documented here, so set that one.
Include the version segment in the value. Aider’s own documentation gives no
example value for a compatible endpoint, so this comes from the mechanism rather
than from a quoted example: the endpoint path is appended to what you give it.
The project carries a report of a version where the segment was dropped from the
outgoing path and requests answered 404 as a result, so if every request comes
back 404 with endpoint_not_supported, print the path Aider is calling before
assuming
the key or the model is wrong.
The three models
This is the edit people miss on Aider specifically. It configures up to three models separately, and each one needs its own pinned id:--weak-model and --editor-model fall back to defaults rather than to your
main model in some configurations, and a default is a bare vendor name, which
this API refuses with model_id_not_pinned. Set all three explicitly if you use
architect mode or let Aider write your commit messages.
The model id, and the prefix collision
Aider’s documented way of naming a model on a compatible endpoint is to prefix it withopenai/. That prefix is a provider selector for the library underneath
Aider rather than part of the model name, and it is consumed to choose the
adapter, with the rest forwarded.
Our ids already begin with the provider that serves them, and for models served
by OpenAI that provider is also openai. So a pinned id and Aider’s prefix
convention produce a doubled first segment:
400 with
model_id_not_pinned means only one segment arrived, and a 404 with
model_not_found means both did. The refusal names which, and neither costs
anything.
An id whose provider is not openai does not have this problem, because the
prefix and the provider are then different strings.
The repository map does not use embeddings
Aider builds its repository map with a parser and a graph ranking over your source files. It calls no embeddings endpoint, and the project has never shipped an embeddings-based index. So the feature that would break first on other harnesses is not a concern here, and Aider needs nothing configured for it.Two things that cost money quietly
Prompt caching is provider-specific, and the keepalive is extra requests. Aider’s--cache-prompts is off by default and its documentation names specific
vendor families it works on, so whether it does anything for the model you pinned
is a question about that model rather than about this API.
--cache-keepalive-pings is the one to think about before enabling: it keeps a
cache warm by sending periodic requests, and each of those is a request here,
billed and recorded in Activity like any other.
Aider does not enforce token limits. Its documentation is explicit that it
reports the provider’s limit errors rather than pre-empting them, and that for a
model it does not recognise it assumes an unknown context window and no cost,
warning you once. Ours is a model it does not recognise, so expect that warning
and expect Aider’s own cost display to be empty or wrong. What a request cost is
in your usage record.
You can supply the missing figures with a model metadata file,
.aider.model.metadata.json, or --model-metadata-file. Take the context window
and maximum output from GET /v1/models, which publishes both per model.
Keep the key out of the repository
Aider reads.aider.conf.yml and .env from your home directory, your
repository root and the current directory, in that order, with the later files
overriding. Two of those three locations are inside the repository. Aider can add
its own files to .gitignore for you, and the safe habit is the home-directory
copy plus the environment variables above.
What we did not verify
- That an Aider session against this API succeeds. Nothing was run.
- What model string reaches the wire for a doubled provider prefix. Described above with the way to find out.
- Whether
--list-modelsqueries this API or matches against the library’s own local model database. Its wording suggests the local database, so do not expect it to show our catalog; askGET /v1/modelsfor that. - Whether Aider honours
OPENAI_BASE_URLas well asOPENAI_API_BASE. Only the second is documented, so only the second is written above. - Whether the
openaiadapter path can be made to call anything other than chat completions. We found no documentation either way, and this API serves only chat completions among the inference endpoints, so a configuration that reached another one would answer404.