Quick reference guide for setting up Claude Code with OpenCode
OpenCode is an AI-powered coding assistant CLI tool that helps with software engineering tasks. It uses various LLM providers including Anthropic Claude.
Website: https://opencode.ai/
Claude Code is Anthropic's official CLI tool for interacting with Claude AI. It can be configured to use OpenCode's free API endpoint instead of Anthropic's direct API.
Product Page: https://claude.com/product/claude-code
- Windows 10/11 Machine Running WSL2 Linux Ubuntu Machine
- Node.js
- OpenCode Zen account
sudo apt updatesudo apt install nodejs npmsudo npm install -g @anthropic-ai/claude-codeEdit ~/.claude/settings.json:
code ~/.claude/settings.json{
"env": {
"ANTHROPIC_BASE_URL": "https://opencode.ai/zen",
"ANTHROPIC_MODEL": "minimax-m2.5-free",
"ANTHROPIC_API_KEY": "opencode-api-key",
"ENABLE_TOOL_SEARCH": "true"
}
}| Variable | Value | Description |
|---|---|---|
ANTHROPIC_BASE_URL |
https://opencode.ai/zen |
OpenCode API endpoint |
ANTHROPIC_MODEL |
minimax-m2.5-free |
Model to use |
ANTHROPIC_API_KEY |
opencode-api-key |
Your OpenCode API key |
ENABLE_TOOL_SEARCH |
true |
Enable tool search feature |
| Command | Description |
|---|---|
claude -helps |
To check available commands |
claude -p "<prompt>" |
Run single prompt |
claude --version |
To check current version |
Download from https://nodejs.org/en/download and run the installer.
npm install -g @anthropic-ai/claude-codeEdit %USERPROFILE%\.claude\settings.json:
code $env:USERPROFILE\.claude\settings.json{
"env": {
"ANTHROPIC_BASE_URL": "https://opencode.ai/zen",
"ANTHROPIC_MODEL": "minimax-m2.5-free",
"ANTHROPIC_API_KEY": "opencode-api-key",
"ENABLE_TOOL_SEARCH": "true"
}
}- Node not found: Restart terminal after installation or add Node.js to PATH
- Permission denied: Use
sudoon Linux or run as administrator on Windows - API errors: Verify your
ANTHROPIC_BASE_URLis correctly set tohttps://opencode.ai/zen
- OpenCode Website: https://opencode.ai/
- Claude Code: https://claude.com/product/claude-code
- Node.js Downloads: https://nodejs.org/en/download