Back to blog
Claude Code Free Setup
Quick reference for setting up Claude Code with OpenCode's free API endpoint.
OpenCode is an AI-powered coding assistant CLI tool that helps with software engineering tasks. It uses various LLM providers including Anthropic Claude.
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.
Prerequisites
| Requirement | Windows | Mac | Linux |
|---|---|---|---|
| Node.js 18+ | nodejs.org | nodejs.org or brew install node | apt, yum, dnf, or pacman |
| Package Manager | choco install nodejs | brew install node | System package manager |
Installation
1. Install Node.js
Option A - Chocolatey:
choco install nodejsOption B - Direct Download:
Download the installer from Node.js and run it.
2. Install Claude Code
npm install -g @anthropic-ai/claude-code3. Configure Settings
Edit %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"
}
}Environment Variables
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
Quick Commands
claude
Start interactive session
claude -p "prompt"
Run single prompt
claude --verbose
Enable verbose logging
Troubleshooting
Node not foundRestart terminal after installation or add Node.js to PATH.
Permission deniedUse sudo on Linux/Mac or run as administrator on Windows.
API errorsVerify your ANTHROPIC_BASE_URL is set to https://opencode.ai/zen.