OpenCode Setup Guide

Website: https://opencode.ai (click to open)

OpenCode is an open-source terminal / editor agent. Use @ai-sdk/openai-compatible for custom providers, and don't borrow built-in vendor names such as google.

Before you start, get an LLMoxy token. The auto group is recommended.

Connect to LLMoxy

Write this in your project root or in ~/.config/opencode/opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "model": "llmoxy/grok-4.7",
  "provider": {
    "llmoxy": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LLMoxy",
      "options": {
        "baseURL": "https://llmoxy.com/v1",
        "apiKey": "your LLMoxy API Key"
      },
      "models": {
        "grok-4.7": { "name": "Grok 4.7" },
        "claude-opus-5-5": { "name": "Claude Opus 5.5" }
      }
    }
  }
}
JSON
FieldDescription
options.baseURLhttps://llmoxy.com/v1; don't append /chat/completions
options.apiKeyLLMoxy token; you can also use {env:LLMOXY_API_KEY}
Keys under modelsMust match the LLMoxy model IDs exactly
Top-level modelprovider-ID/model-ID, for example llmoxy/grok-4.7

After starting OpenCode, use /models to pick a model under LLMoxy.

💡 Tip If you previously ran opencode auth login openai, the built-in openai provider may be hijacked by OAuth. For custom providers, use a separate ID (such as llmoxy) and don't reuse openai.