How to use your own OpenRouter key with a terminal coding agent
OpenRouter gives you one key for models from many providers. It charges the providers' own prices for the models and a fee of 5.5%, at least $0.80, when you buy credits. Any coding agent that talks to an OpenAI-compatible endpoint can use it.
Aider and OpenCode read the key from OPENROUTER_API_KEY, Cline takes it in its settings, and Clixad's /key runs a turn on it straight from your machine, using no Clixad credits. The free models are limited to 50 requests a day until you have bought 10 credits, which is about four agent tasks.
What OpenRouter is, and what it charges
OpenRouter sells access to models from many providers through one account and one key. Its FAQ says "OpenRouter implements the OpenAI API specification", so any coding agent that can talk to an OpenAI-compatible endpoint can use it. Two things decide what it costs you.
The model price is the provider's. "We pass through the pricing of the underlying model providers without any markup, so you pay the same rate as you would directly with the provider." Its pricing page puts it as "Inference is billed at the provider's list price on every plan."
Buying credits costs a fee. "OpenRouter charges a 5.5% ($0.80 minimum) fee when you purchase credits." The fee is charged "when you buy credits, not on individual API requests." The minimum makes small purchases dearer in proportion:
| Credits bought | Fee | Fee as a share |
|---|---|---|
| $5 | $0.80 | 16% |
| $10 | $0.80 | 8% |
| $20 | $1.10 | 5.5% |
| $50 | $2.75 | 5.5% |
| $100 | $5.50 | 5.5% |
From about $15 upward the minimum stops mattering and the fee is 5.5%. Below it, a $5 purchase pays a fee of 16%.
The free models, and their limits
OpenRouter lists free variants of some models. Its limits page gives them 20 requests a minute and 50 a day for an account that has bought less than 10 credits, and 1,000 a day for one that has bought at least 10. Its pricing page adds that "Failed attempts count toward that daily cap, and a negative balance blocks free models until you add credits."
A request there is one model call, and an agent makes many calls for one instruction: about a dozen for an ordinary task, as our post on what free limits buy works out. Fifty requests a day is about four such tasks. A thousand is about 83.
Setting it up in four agents
Create a key in your OpenRouter account first. Then, in each agent:
- Aider:
export OPENROUTER_API_KEY=<key>, thenaider --model openrouter/<provider>/<model>.aider --list-models openrouter/lists the names. - OpenCode: "Run /connect, choose a provider, and enter its credentials. Then run /models to select one of its models." It also reads
OPENROUTER_API_KEY. - Cline: choose OpenRouter as the API provider in its settings, paste the key, and pick a model.
- Clixad: type
/keyfollowed by the key. It accepts only a key that begins withsk-or-, saves it, and runs the next turn on the model you have selected, billed to your OpenRouter account.
Keep the key out of the repository. Aider and OpenCode read it from the environment. Clixad keeps it in
~/.clixad/config.json, which only your user can read, and only a key saved with /key
is used: one that happens to be in the environment is left alone.
Choosing a model and a provider
Most open-weight models are served by several providers on OpenRouter, and "Each model and provider has a different price per million tokens." OpenRouter picks one for each request, and "If a provider returns an error OpenRouter will automatically fall back to the next provider." For a coding agent that is usually what you want. Its pricing page adds that "For consistent latency, pin a specific model and provider." Aider's documentation shows how to ignore providers in your OpenRouter account settings.
Two things are worth checking before a long session. The model has to support tool calls, or the agent cannot edit anything. And the price on the model's page is per million tokens, while an agent resends the whole conversation on every call, so a task costs many times what one message suggests.
How Clixad uses your key
Clixad normally sends every request through our gateway, which holds our own provider keys and meters each call
in credits. With /key that changes for as long as you leave it on:
- Requests go from your machine straight to OpenRouter on your key. They do not pass through our gateway, and no Clixad credits are used.
- After each such turn the agent tells our server how many calls and tokens it took and the model's name. Our server adds that to a daily total that names no account.
- Web search is not available in that mode, because it runs on our gateway. Reading a web page still works.
/key offgoes back to Clixad's credits, and/key forgetdeletes the saved key.
It is most useful when the free limit and your credits have run out in the middle of a task: the conversation carries on where it stopped, on the same model, billed to OpenRouter. Our docs on running out list the other ways on.
FAQ
Does OpenRouter charge more than the model provider?
Not for the model: OpenRouter says it passes through the providers' prices without any markup. It charges a fee of 5.5%, at least $0.80, when you buy credits, so a small purchase pays a larger share in fees.
How many requests do OpenRouter's free models allow?
20 a minute, and 50 a day for an account that has bought less than 10 credits or 1,000 a day for one that has bought at least 10, by OpenRouter's limits page. Failed attempts count toward the daily cap.
How do I use an OpenRouter key in Aider?
Set OPENROUTER_API_KEY in your environment, then start Aider with --model openrouter/ followed by the provider and the model name. aider --list-models openrouter/ lists the names.
Can I use my OpenRouter key in Clixad?
Yes. Type /key followed by the key. The next turns run on the model you have selected, from your machine straight to OpenRouter, billed to your OpenRouter account and using no Clixad credits. /key off goes back.
Does Clixad see my OpenRouter key?
It is stored in ~/.clixad/config.json on your machine and sent to OpenRouter and nowhere else. Our server receives only a count of calls and tokens and the model's name.
Sources
- OpenRouter, FAQ, for "OpenRouter implements the OpenAI API specification", the pass-through sentence, the fee of 5.5% with a $0.80 minimum, "Each model and provider has a different price per million tokens." and the fallback sentence. Read 2 December 2026.
- OpenRouter, Pricing, for "Inference is billed at the provider's list price on every plan.", when the fee is charged, the sentence on failed attempts and a negative balance, and "For consistent latency, pin a specific model and provider." Read 2 December 2026.
- OpenRouter, Limits, for the free usage limits by credits purchased. Read 2 December 2026.
- Aider, OpenRouter, for the environment variable, the model flag and the provider settings. OpenCode, Providers, for the /connect steps and
OPENROUTER_API_KEY. Cline, OpenRouter, for its settings. All read 2 December 2026. - How Clixad handles the key, the count it sends and the missing web search: the source of the command line tool at github.com/clixad/cli, and section 4 of our privacy policy. The twelve-call task shape: the tier-limits post.