OpenCode + OpenRouter
Connect one key to and you can try most — , , , , Qwen and more — switching between them in the same .
One terminal, one key, hundreds of models
-
You
Say what you want done
-
OpenCode
An in the — it reads and edits files and runs commands
-
OpenRouter
A service that connects from many companies through one and one key
Model families you can pick (some of them)
- Claude Anthropic See models
- GPT OpenAI See models
- Gemini Google See models
- Grok xAI See models
- DeepSeek DeepSeek See models
- Qwen Alibaba See models
- Kimi Moonshot AI See models
- GLM Z.ai See models
- Mistral Mistral AI See models
- Llama Meta See models
can connect to more than 75 model providers, and alone gives you most of those models. Not every model is good at coding-agent work, though — a model that is weak at (the way it edits files) may just answer and stop.
Four steps
-
1Install OpenCode
Run the first command below in a terminal. If you have , the second command works too.
curl -fsSL https://opencode.ai/install | bashnpm install -g opencode-ai -
2Create an OpenRouter key
Sign up for OpenRouter, press [Create ] on the Keys page and copy the key. Set a spending limit on the key so it never costs more than you expect.
Open the OpenRouter keys page (new window) -
3Connect the key to OpenCode
Run opencode in your project folder and type /connect. Find OpenRouter in the list, pick it and paste the key you copied.
opencode/connect -
4Pick a model
Type /models to see the OpenRouter model list. Pick a model to try and give it a task. In a new project, run once to create AGENTS.md — every model then starts by reading your project rules.
/models/init
Give the same task to several models and compare
-
Save with
-
Ask model A
-
Switch with /models
-
Ask model B the same
-
Compare with git
Commit before you start, so you can a result you do not like with git and try again with another model. Compare not only the result but also the time it took and the cost on the OpenRouter Activity page.
Start with free models
Models whose names end in :free cost nothing to use. In exchange, the number of requests per day is limited.
Be careful
-
The key is a password
Never paste it into chats, or . If it leaks, delete it on OpenRouter right away and make a new one.
-
Spending limit
Set a limit on each key and check what you spent on the Activity page often. Buying credits adds a 5.5% fee.
-
Free models and your data
Some providers of free models store your input or use it for . Do not put company or personal information in it.
-
Commit first
The edits your files directly. Commit before you give it a task and you can always roll back.
Official docs
Checked against the official docs on 2026-10-26. Commands and screens may change, so read the official docs too.
Loading…
Choose a pending booking to cancel. Each cancellation requires confirmation.
Your :