OpenCode

Prerequisites

Configure via environment variables for Claude model users:

terminal
bash
export ANTHROPIC_BASE_URL=https://api.chuizi.ai/anthropic
export ANTHROPIC_API_KEY=ck-your-key-here

To make this permanent, add to your shell configuration:

terminal
bash
echo 'export ANTHROPIC_BASE_URL=https://api.chuizi.ai/anthropic' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY=ck-your-key-here' >> ~/.zshrc
source ~/.zshrc

Option 2: OpenAI-Compatible Protocol

Use this when working with GPT, DeepSeek, or other models:

terminal
bash
export OPENAI_BASE_URL=https://api.chuizi.ai/v1
export OPENAI_API_KEY=ck-your-key-here

To make this permanent:

terminal
bash
echo 'export OPENAI_BASE_URL=https://api.chuizi.ai/v1' >> ~/.zshrc
echo 'export OPENAI_API_KEY=ck-your-key-here' >> ~/.zshrc
source ~/.zshrc

Usage

Once configured, launch OpenCode in your project directory:

terminal
bash
cd your-project
opencode

OpenCode will automatically detect the environment variables and connect to Chuizi.AI.

Verify the Configuration

  1. Run opencode in a project directory
  2. Send a test message, such as "describe this project"
  3. If you receive a normal response, the configuration is working
  4. Check the Chuizi.AI dashboard for request logs

Common Issues

Environment Variables Not Taking Effect

Make sure you have run source ~/.zshrc or opened a new terminal window. Run echo $ANTHROPIC_BASE_URL to verify the variable is set correctly.

Both Protocols Configured

If you have both Anthropic and OpenAI environment variables set, OpenCode will automatically use the appropriate protocol based on your selected model. You can configure both, but it is simpler to set up only the one you use most.

Rate Limiting

Connecting through Chuizi.AI reduces provider-specific interruptions through managed routing and capacity. If you encounter 429 errors, check your key's rate limit settings in the Chuizi.AI dashboard.

Next Steps

OpenCode — Chuizi AI Docs | Chuizi AI