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:
JSON
| Field | Description |
|---|---|
options.baseURL | https://llmoxy.com/v1; don't append /chat/completions |
options.apiKey | LLMoxy token; you can also use {env:LLMOXY_API_KEY} |
Keys under models | Must match the LLMoxy model IDs exactly |
Top-level model | provider-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-inopenaiprovider may be hijacked by OAuth. For custom providers, use a separate ID (such asllmoxy) and don't reuseopenai.
