OpenCode Setup
OpenCode is an open-source terminal AI coding tool, similar to an open-source alternative to Claude Code. With OfoxAI, you can use any model.
Setup Steps
1. Install OpenCode
# macOS / Linux
curl -fsSL https://opencode.ai/install | bash
# Or install with Go
go install github.com/opencode-ai/opencode@latest2. Configure Environment Variables
OpenCode supports multiple provider configurations. We recommend using OpenAI compatible mode:
~/.zshrc
# OpenAI compatible mode
export OPENAI_API_KEY=<your OFOXAI_API_KEY>
export OPENAI_BASE_URL=https://api.ofox.ai/v1If you primarily use Claude models, you can configure Anthropic mode instead:
~/.zshrc
export ANTHROPIC_API_KEY=<your OFOXAI_API_KEY>
export ANTHROPIC_BASE_URL=https://api.ofox.ai/anthropic3. Configuration File
You can also configure via OpenCode’s config file:
~/.config/opencode/config.toml
[providers.ofoxai]
api_key = "<your OFOXAI_API_KEY>"
base_url = "https://api.ofox.ai/v1"
[models.default]
provider = "ofoxai"
model = "anthropic/claude-sonnet-4.5"4. Verify
opencode "Hello, how are you?"Recommended Models
| Scenario | Model | Description |
|---|---|---|
| Daily coding | anthropic/claude-sonnet-4.5 | Balanced performance |
| Complex tasks | anthropic/claude-opus-4.6 | Most capable reasoning |
| Quick tasks | moonshotai/kimi-k2.5 | Low cost, high speed |
OpenCode’s configuration options may change with version updates. See the OpenCode official documentation for the latest information.
Last updated on