OpenCode
Prerequisites
- OpenCode installed
- A Chuizi.AI account with an API key (starts with
ck-)
Option 1: Anthropic Protocol (Recommended for Claude)
Configure via environment variables for Claude model users:
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:
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:
export OPENAI_BASE_URL=https://api.chuizi.ai/v1 export OPENAI_API_KEY=ck-your-key-here
To make this permanent:
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:
cd your-project opencode
OpenCode will automatically detect the environment variables and connect to Chuizi.AI.
Verify the Configuration
- Run
opencodein a project directory - Send a test message, such as "describe this project"
- If you receive a normal response, the configuration is working
- 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
- Choose a Model — find the best model for your coding tasks
- Choosing a Protocol — OpenAI vs Anthropic protocol trade-offs
- Cost Optimization — reduce costs with model tiering and caching