Setup guide

Provider setup guide

Browse setup steps and troubleshooting by tool.

Provider setup guide/OpenCode Configuration

OpenCode Configuration

OpenCode is an open-source terminal AI coding assistant. It's suitable for code Q&A, file modifications, and model switching within a project directory. Beginners should first use its own connection wizard and avoid manually writing the complete JSON at the start.

What this tool is and what it is used for

Configuration File Location

systemConfiguration File LocationDescription
WindowsC: \Users\YourUsername\. config\opencode\opencode.jsonIf the file doesn't exist, create a new one
macOS / Linux~/. config/opencode/opencode.jsonIf the file doesn't exist, create a new one

Start with the connection wizard

OpenCode Connection Wizard
cd YOUR_TEST_PROJECT opencode /connect

What to pay attention to when configuring manually

Only edit the configuration file if your provider's documentation clearly specifies the OpenCode Provider field, where to place the Base URL, and Key. Fields may vary between versions, do not directly copy JSON examples from other tools into OpenCode.

Items to verifyDescription
Provider TypeDo not mix OpenAI, Claude, Gemini, or other protocols
Base URLUse the complete address provided by the provider for OpenCode or the corresponding protocol
KeyUse the Key corresponding to the current Provider
Model NameCopy the model list from the provider's backend

How to test after saving

  1. Run after entering a test project directory opencode.
  2. First use /models Confirm that the model you just configured is visible.
  3. After selecting the model, send 'Please only reply: OpenCode configuration successful'.
  4. The first time, do not let it modify files; just let it explain the current directory or the current file.
  5. If you fail, go back first /connect Or check the provider, base URL, key, and model name against the provider's documentation.
PhenomenonPriority checkHandle
/models There is no model insideWhether the provider saved successfully, whether the model list can be retrievedManually add provider backend model ID / model name
Connection failedWhether the Base URL belongs to the current Provider protocolDo not mix addresses of Claude, Gemini, and OpenAI
The configuration file is invalidJSON format, commas, quotation marksPrioritize generating the configuration using the connection wizard, then make minor manual adjustments.
OpenCode Official Website View installation, authentication, and command instructions.
OpenCode AI provider Configuration Reference Refer to the configuration approach of opencode.json.