Skip to content

OpenCode Configuration

Run opencode and enter the /connect command to configure a provider.

Select "Other Custom Provider" for the provider type.

Enter "nitrorouter" for the provider ID.

Enter the API Key you created in the console when prompted for the API key.

Then, edit the opencode.json in your current project or the global configuration (~/.config/opencode/opencode.json), create it if it doesn't exist:

json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "nitrorouter": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "NitroRouter",
      "options": {
        "baseURL": "https://api.nitrorouter.com/v1"
      },
      "models": {
        "gpt-5.5": {
          "name": "GPT-5.5"
        },
        "claude-opus-4-8": {
          "name": "Claude Opus 4.8"
        },
        "claude-sonnet-4-6": {
          "name": "Claude Sonnet 4.6"
        },
        "gemini-3.1-pro-preview": {
          "name": "Gemini 3.1 Pro"
        }
      }
    }
  }
}

You can add more models as needed. Restart opencode and test to see if chatting works properly.