Aider
Use plaingateway, the free OpenRouter alternative, in Aider: three lines of config, the provider's list price for tokens and nothing on top.
Aider is a coding agent for the terminal that edits the files in your git repository. It talks to any OpenAI-compatible API, so plaingateway needs three lines of config and one key. Model ids are OpenRouter's, for example openai/gpt-5.6-luna, with one extra openai/ in front (see below).
Paste this
openai-api-base: https://api.plaingateway.com/api/v1 openai-api-key: sk-pg-v1-... model: openai/openai/gpt-5.6-luna
Where the file lives
Save the lines as .aider.conf.yml in your home directory. Aider also reads the file from the root of your git repository and from the current directory, but a file in the repository can be committed with the key in it, so keep this one in your home directory. Then run aider in your project.
The same setup as environment variables, for one terminal session:
export OPENAI_API_BASE="https://api.plaingateway.com/api/v1" export OPENAI_API_KEY="sk-pg-v1-..." aider --model openai/openai/gpt-5.6-luna
Why the model starts with openai/openai/
Aider reads the first openai/ as "send this to the OpenAI-compatible server" and drops it. It sends the rest, openai/gpt-5.6-luna, as the model id. So put openai/ in front of any plaingateway model id, for example openai/deepseek/deepseek-v4.1-flash.
Get a key
- Sign up at plaingateway.com/signup and click the link in the confirmation email.
- Open Keys, press New key and copy it. It starts with
sk-pg-v1-and is shown once. - Add credits by card on Credits. Requests are paid from it.
Check it works
Send one request to the same base URL with the model id the gateway receives (one openai/, not two):
export PLAINGATEWAY_API_KEY="sk-pg-v1-..."
curl -i https://api.plaingateway.com/api/v1/chat/completions \
-H "Authorization: Bearer $PLAINGATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-5.6-luna",
"max_tokens": 32,
"messages": [
{"role": "user", "content": "Say hello in five words."}
]
}'A 200 means the key and the base URL work. Three things in the answer tell you what happened: the X-PG-Host header names the provider that served it, X-PG-Cost-USD is the charge, and usage.cost in the body is the same charge. To find the request, open Logs in your API key's workspace. Logs keeps requests for seven days.
What it costs
You pay the provider's official list price for tokens, and plaingateway adds nothing on top: 0% platform fee, no markup, no subscription, free with your own provider keys. You can earn up to 20% bonus credit, added to your balance when you add money and never taken off the token price: each person you invite gives you 1% bonus credit once they have paid $20 in total, up to 20%, so $100 paid gets up to $120 of credit. The person you invite gets 5% bonus credit on their first top-up, and you earn 10% of what they pay (How referral works). Each model's price is on Models.
Limits today
- Only
openai/anddeepseek/models answer today. Models lists more ids; any other id returns an error. Ones that answer includedeepseek/deepseek-v4.1-flash,deepseek/deepseek-v4-proandopenai/gpt-6.1-sol. - Credit is prepaid. Requests are paid from a balance you add by card. With no balance the gateway answers 402. Each request first holds its largest possible cost, the prompt plus the maximum output; on a low balance it holds an eighth of what is left and shortens the answer to fit, so a long session can get shorter answers, then 402, before the balance is spent.
Gotchas
A warning about an unknown model. Aider does not know plaingateway's model ids, so it prints a model warning at start and guesses the context size and price. The requests still work. Aider's own guide to the warning: aider.chat/docs/llms/warnings.html.
The base URL ends in /api/v1. Aider adds /chat/completions itself.
A 401 means the key. Check that openai-api-key, or OPENAI_API_KEY if you use the variables, holds the whole plaingateway key, from sk-pg-v1- to the last character. An OpenAI key left over in your shell gets 401.
Moving from OpenRouter
Keep your model ids. Replace openrouter/ at the start of the Aider model name with openai/, set openai-api-base and openai-api-key as above. The full guide: Migrate from OpenRouter.
Aider's own reference for this setting: aider.chat/docs/llms/openai-compat.html.