Opencode Manual Setup
Edit opencode.json and auth.json to connect Opencode to GETMODEL
Make sure you have completed the environment check before continuing with the steps below.
Opencode is an open-source terminal AI coding assistant. The following shows how to replace its Anthropic provider address with GETMODEL.
1. Install Opencode
You first need Node.js ready (see environment check), then install it globally:
npm install -g opencode-ai2. Open the config directory
Opencode uses two directories (~ represents your user home directory, which on Windows is C:\Users\YourUsername):
| File | Purpose |
|---|---|
~/.config/opencode/opencode.json | Provider config: base URL, models, etc. |
~/.local/share/opencode/auth.json | Stores your API Key |
Press Win + R and enter each of the two lines below, pressing Enter, to open the corresponding directory:
%userprofile%\.config\opencode%userprofile%\.local\share\opencodeIn the terminal:
open ~/.config/opencode # macOS
xdg-open ~/.config/opencode # Linux
open ~/.local/share/opencode # macOS
xdg-open ~/.local/share/opencode # LinuxIf the directories or files do not exist, create them manually.
3. Configure the provider address
Edit (or create) ~/.config/opencode/opencode.json and replace the built-in anthropic address with GETMODEL:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"options": {
"baseURL": "https://getmodel.ai"
}
}
}
}About the base URL: This document uses https://getmodel.ai as an example. Please rely on the actual address shown on the Console "API Info" page.
4. Configure the key
Edit (or create) ~/.local/share/opencode/auth.json and write in your API token. Configuring just the anthropic entry is enough:
{
"anthropic": {
"type": "api",
"key": "你的-API-令牌"
}
}Replace "你的-API-令牌" with the string you generated on the Create Token page.
When creating a key in the Console, remember to select a Claude-related group (such as "claude exclusive").
5. Verify
Open a terminal, run opencode, then enter:
/modelsPick any model under anthropic from the list, and you are ready to go.