Coding tools
Aider setup: OPENAI_API_BASE and the openai/ model prefix
In short: Aider is a terminal coding assistant that runs on our OpenAI-compatible endpoint; set OPENAI_API_BASE and OPENAI_API_KEY, then use the openai/ model prefix.
On this page
- What do I need to run Aider on the gateway?
- How do I point Aider at the gateway?
- How do I launch Aider with the openai/ prefix?
- How do I save the settings in .aider.conf.yml?
- Which models work best with Aider?
- How do I verify Aider is using the gateway?
- Why does Aider warn about an unknown model?
- How do I fix common Aider errors?
- Next steps
https://api.oneaiapikey.com/v1Aider is a terminal pair-programmer that edits files in your git repo and commits as it goes. It reaches models through LiteLLM, which supports any OpenAI-compatible endpoint. Two environment variables and a model prefix are all it takes to run Aider on our gateway, with every token billed from your prepaid balance.
What do I need to run Aider on the gateway?
Running Aider on the gateway needs three things:
- Aider installed (for example with
python -m pip install aider-installfollowed byaider-install, or your preferred method) and a git repository to work in. - A funded account: any balance above $0, the sign-up credit included, pays for every model; when it runs out, add $1 or more (create one).
- An API key from the console (it begins with
sk-).
How do I point Aider at the gateway?
Point Aider at the gateway by setting OPENAI_API_BASE and OPENAI_API_KEY, the standard OpenAI variables it reads. Set the base URL with /v1:
export OPENAI_API_BASE=https://api.oneaiapikey.com/v1
export OPENAI_API_KEY=sk-your-key-heresetx OPENAI_API_BASE "https://api.oneaiapikey.com/v1"
setx OPENAI_API_KEY "sk-your-key-here"
# then close this window and open a new terminalsetx writes the variables permanently but only for terminals opened afterwards, so restart your terminal before the next step. To keep the variables only for the current PowerShell window, use $env:OPENAI_API_BASE = "..." instead.
How do I launch Aider with the openai/ prefix?
Launch Aider with --model openai/<id>, because the openai/ prefix tells Aider (via LiteLLM) to send the request in OpenAI format to whatever OPENAI_API_BASE says, instead of trying to reach a vendor’s own API. Everything after the prefix is the exact model id from our catalogue:
aider --model openai/claude-sonnet-5-5Aider uses a second, cheaper “weak” model for commit messages and chat summaries. Point it at a fast model so those calls don’t run on your flagship. You can also pass the base URL as a flag rather than an environment variable:
aider --model openai/claude-sonnet-5-5 \
--weak-model openai/claude-haiku-4-5 \
--openai-api-base https://api.oneaiapikey.com/v1How do I save the settings in .aider.conf.yml?
Save your defaults in .aider.conf.yml instead of typing flags every time. Aider reads it from your home directory and from the root of the current repo, so put your defaults there:
# ~/.aider.conf.yml (or .aider.conf.yml in your repo root)
openai-api-base: https://api.oneaiapikey.com/v1
model: openai/claude-sonnet-5-5
weak-model: openai/claude-haiku-4-5
# keep the key in OPENAI_API_KEY rather than in this fileKeep OPENAI_API_KEY in your environment (or a .env file that is gitignored). Don’t commit keys to a repository config.
Which models work best with Aider?
Models with strong instruction following work best with Aider, because its edit formats reward them. Rates are USD per 1M tokens:
| Aider model | Good for | Input | Output |
|---|---|---|---|
openai/claude-sonnet-5-5 | Daily coding, Coding agents, Code review | $1.40 | $7 |
openai/claude-opus-5-5 | Agentic coding, Large refactors, Complex reasoning | $2.80 | $14 |
openai/gpt-6.1-sol | Codex CLI, Tool calling, Long context | $0.70 | $3.50 |
openai/claude-haiku-4-5 | Sub-agents, Extraction, Chat | $1 | $5 |
openai/glm-5.3-flash | Quick answers, Drafting, Sub-agents | $0.07 | $0.21 |
Use /model openai/<id> inside a session to switch on the fly. The full catalogue is on the models page.
How do I verify Aider is using the gateway?
Verify the connection by launching Aider in a repo and asking something read-only, such as “What does this project do?”. A normal answer means the connection works, and the request appears in your console’s usage log. Aider’s own startup banner shows the main and weak model names, which is a quick way to confirm the prefix was applied.
Why does Aider warn about an unknown model?
Because our model ids aren’t in LiteLLM’s built-in database, Aider may print a warning that it doesn’t know the model’s context window or cost. The model still works. You can silence the warning with --no-show-model-warnings, or register the model’s limits and prices in a .aider.model.metadata.json file as described in Aider’s documentation on model warnings. Remember that the cost Aider prints is only an estimate: your console’s usage log shows what was actually charged.
How do I fix common Aider errors?
The common Aider errors and their fixes are listed below.
401 / AuthenticationError. OPENAI_API_KEY is missing or wrong in the shell that started Aider. Run echo $OPENAI_API_KEY (or $env:OPENAI_API_KEY in PowerShell) to check, re-copy the key from the console, and open a new terminal after setx.
Requests go to OpenAI instead of the gateway. OPENAI_API_BASE isn’t set in this shell, or a config file overrides it. Pass --openai-api-base explicitly to rule that out.
404 Not Found. The base URL lacks /v1 or includes an endpoint path. Use exactly https://api.oneaiapikey.com/v1.
“LLM Provider NOT provided” or model not found. You left off the openai/ prefix, or the id after it doesn’t match the catalogue. It must look like openai/claude-sonnet-5-5.
Timeouts on large edits. Aider streams by default; if you disabled it with --no-stream, re-enable streaming. Proxies cut idle non-streaming requests at roughly 100 seconds, so streaming matters for long outputs.
Next steps
Want a more autonomous agent? Try Claude Code or OpenCode, or see all tool guides. Per-model rates are on the pricing page.