Skip to content

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.

Create an API key on the API Key page before you start.

Store the key:

Terminal window
export INDOROUTER_API_KEY="ir_..."

Install the plugin:

Terminal window
mkdir -p ~/.config/opencode/plugins
curl -fsSL https://console.indorouter.ai/opencode/indorouter.ts -o ~/.config/opencode/plugins/indorouter.ts

Start opencode on a model, then switch any time with /models:

Terminal window
opencode -m indorouter/openai/gpt-4o-mini

In opencode the provider is indorouter, so a model is written indorouter/ followed by its ID.

  • 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/models says.
  • It reads the key from INDOROUTER_API_KEY.
  • Settings under provider.indorouter in opencode.json override 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.

Ask opencode something short. The request appears on the console’s Requests page.

  • 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_KEY isn’t set in the terminal opencode was started from.