Skip to content
Relaykit
DocsAider

CLI guide

Aider setup: OPENAI_API_BASE and the openai/ model prefix

Run Aider through our OpenAI-compatible endpoint: set OPENAI_API_BASE and OPENAI_API_KEY, launch with openai/<model>, save it in .aider.conf.yml and fix errors.

Updated OpenAI formatCLIView .md
On this page
https://api.oneaiapikey.com/v1

Aider 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 you need

  • Aider installed (for example with python -m pip install aider-install followed by aider-install, or your preferred method) and a git repository to work in.
  • A funded account; top-ups start at $3: create one.
  • An API key from the API keys page (it begins with sk-).

Step 1: point Aider at the gateway

Aider reads the standard OpenAI variables. Set the base URL with /v1:

macOS / Linux / Git Bash
export OPENAI_API_BASE=https://api.oneaiapikey.com/v1
export OPENAI_API_KEY=sk-your-key-here
Windows
setx OPENAI_API_BASE "https://api.oneaiapikey.com/v1"
setx OPENAI_API_KEY "sk-your-key-here"
# then close this window and open a new terminal

setx 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.

Step 2: launch with the openai/ prefix

The openai/ prefix is important. It 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:

Start Aider
aider --model openai/claude-sonnet-5

Aider 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:

Main and weak model
aider --model openai/claude-sonnet-5 \
  --weak-model openai/claude-haiku-4-5 \
  --openai-api-base https://api.oneaiapikey.com/v1

Step 3: save it in .aider.conf.yml

Typing flags every time gets old. Aider reads .aider.conf.yml from your home directory and from the root of the current repo, so put your defaults there:

.aider.conf.yml
# ~/.aider.conf.yml  (or .aider.conf.yml in your repo root)
openai-api-base: https://api.oneaiapikey.com/v1
model: openai/claude-sonnet-5
weak-model: openai/claude-haiku-4-5
# keep the key in OPENAI_API_KEY rather than in this file

Keep OPENAI_API_KEY in your environment (or a .env file that is gitignored). Don’t commit keys to a repository config.

Aider’s edit formats reward strong instruction following. Rates are USD per 1M tokens:

Aider modelGood forInputOutput
openai/claude-sonnet-5Daily coding, Code review, Writing$2.20$11
openai/claude-opus-5-5Agentic coding, Large refactors, Complex reasoning$4.40$22
openai/gpt-6.1-solCodex CLI, Tool calling, Long context$2.20$11
openai/claude-haiku-4-5Sub-agents, Extraction, Chat$1.10$5.50
openai/deepseek-v4-flashBudget coding, Sub-agents, Batch jobs$0.24$0.96

Use /model openai/<id> inside a session to switch on the fly. The full catalogue is on the models page.

Step 4: verify it works

Launch Aider in a repo and ask 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.

About the “unknown model” warning

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.

Troubleshooting

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.

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.

↑ ↓ moveEnter openEsc close