opencode
Our opencode plugin registers indoRouter as a provider and reads the model list from /v1/models every time opencode starts, so new models appear without configuration changes.
Before you start
Section titled “Before you start”Create an API key on the API Key page before you start.
Store the key:
export INDOROUTER_API_KEY="ir_..."Install the plugin:
mkdir -p ~/.config/opencode/pluginscurl -fsSL https://console.indorouter.ai/opencode/indorouter.ts -o ~/.config/opencode/plugins/indorouter.tsStart opencode on a model, then switch any time with /models:
opencode -m indorouter/openai/gpt-4o-miniIn opencode the provider is indorouter, so a model is written indorouter/ followed by its ID.
What the plugin does
Section titled “What the plugin does”- It lists the chat models that support tool calls. Models without tool calls are left out, because opencode can’t work without them.
- It sets each model’s context window, output limit, reasoning and image input from what
/v1/modelssays. - It reads the key from
INDOROUTER_API_KEY. - Settings under
provider.indorouterinopencode.jsonoverride the plugin’s defaults.
If opencode can’t reach /v1/models when it starts, it prints a message and starts without indoRouter’s models. Restart it once the connection is back.
Check the connection
Section titled “Check the connection”Ask opencode something short. The request appears on the console’s Requests page.
Troubleshooting
Section titled “Troubleshooting”- No indoRouter models in
/models: check that the plugin file is in~/.config/opencode/plugins/and that opencode could reach the internet when it started. - 401:
INDOROUTER_API_KEYisn’t set in the terminal opencode was started from.