Skip to main content
OpenCode

Prerequisites

Follow the official documentation to install either the command-line version or the desktop version of OpenCode. Supported platforms: macOS, Windows, and Linux. For pricing ratios of GPT (CodeX) and other models, please refer to Models & Pricing. For API addresses and backup URLs, see API Call Examples

Locate the OpenCode Configuration File

macOS / Linux: ~/.config/opencode/opencode.json Windows: %APPDATA%\opencode\opencode.json or <User Home Directory>\.config\opencode\opencode.json

Configure GPT / CodeX Models

Modify opencode.json as shown below: CodeX Update the OpenAI provider configuration:
Adjust the default GPT model selection menu in OpenCode to match the following: gpt-models

Configure Claude Models

Claude Add a custom Claude provider:

Configure Gemini Models

Gemini Add a custom provider:

Configure Other OpenAI-Compatible Models

Add a custom provider: