OpenCode

Set up OpenCode to use Modelway.

Step 01

Get your Modelway key

Sign in, open API keys and click Create key. Copy it right away: it’s shown once. New to Modelway? Start with getting access.

Step 02

Install OpenCode

Open a terminal and run the installer:

shell
curl -fsSL https://opencode.ai/install | bash

On Arch Linux:

shell
sudo pacman -S opencode
Step 03

Point it at Modelway

OpenCode reads its global config from ~/.config/opencode/opencode.json. Create the folder if it doesn’t exist yet, then open the file in an editor:

shell
1mkdir -p ~/.config/opencode
2nano ~/.config/opencode/opencode.json

Paste this in, with your key in place of the placeholder:

~/.config/opencode/opencode.jsonjson
1{
2 "model": "modelway/claude-sonnet-5",
3 "provider": {
4 "modelway": {
5 "npm": "@ai-sdk/anthropic",
6 "options": {"baseURL": "https://modelway.vip/v1", "apiKey": "<your Modelway API key>"},
7 "models": {
8 "claude-sonnet-5": {"attachment": true, "reasoning": true, "limit": {"context": 1000000, "output": 64000}}
9 }
10 }
11 }
12}
Step 04

Start OpenCode

Open a terminal in a project folder and run:

shell
opencode

It starts on the model in model. Switch with /models.

FAQ

How do I add more models?

Add each model id from the catalog under models, next to the one that’s there. Set model to query/<id> to start on it.

How do I update?

Run opencode upgrade, or update it with the package manager you installed it with.