OpenCode
Set up OpenCode with Claude API — open-source terminal AI assistant. Configure API key and model selection.
Config Path
Windows:
C:\Users\User\.config\opencode\opencode.jsoncLinux / macOS:
~/.config/opencode/opencode.jsoncExample Config
opencode.jsoncjson
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"anthropic": {
"options": {
"baseURL": "https://api2.claudestore.store/v1",
"apiKey": "sk-cs2-YOUR_KEY"
}
}
}
}Notes
- Use your API key from the dashboard
- OpenCode should point to
/v1 - Recommended model IDs are the same stable Claude IDs used everywhere else
Windows setup
1. Install OpenCode
OpenCode ships as a standalone binary or via npm. Easiest path on Windows:
npm install -g opencode-ai
opencode --versionAlternative: download opencode-windows-x64.exe from GitHub Releases and put it on your PATH.
2. Create the config folder
OpenCode reads %USERPROFILE%\.config\opencode\opencode.jsonc:
mkdir $env:USERPROFILE\.config\opencode -ErrorAction SilentlyContinue
notepad $env:USERPROFILE\.config\opencode\opencode.jsoncPaste the example config from the section above.
3. Optional: env vars instead of JSON
If you prefer environment variables, set them once with setx:
setx ANTHROPIC_BASE_URL "https://api2.claudestore.store/v1"
setx ANTHROPIC_API_KEY "sk-cs2-YOUR_KEY"setx takes effect only in NEW terminals — open a fresh PowerShell.4. WSL note
If you run OpenCode inside WSL, the config path becomes ~/.config/opencode/opencode.jsonc and Windows env vars do not propagate — re-export them in ~/.bashrc.
5. Troubleshooting
- "opencode" not recognized — open a new PowerShell, or add
%APPDATA%\npmto PATH. - JSONC parse error — Notepad may save the file as UTF-8 with BOM. Use VS Code or
notepad++and save as UTF-8 (no BOM). - 404 on requests — verify
baseURLends with/v1. - SmartScreen warning on first launch — click "More info" → "Run anyway" once, Windows will remember the choice.