OpenCode Installation and Configuration Guide
This guide will help you install OpenCode and configure it to use CC Club’s Claude models.
Why Is Special Configuration Needed?
Compatibility Notes
- Different model ID formats: OpenCode defaults to using Anthropic model IDs without dates (e.g.
claude-sonnet-4-5), while CC Club uses model IDs with dates (e.g.claude-sonnet-4-5-20250929). - Model mapping required: To allow OpenCode to correctly call CC Club’s models, you need to resolve this compatibility issue through configuration tools or a proxy service.
- Avoiding client restrictions: Proper configuration can help avoid restrictions that warn against using OpenCode clients.
We offer three configuration methods:
- Method 1 (Recommended): Edit the configuration file directly — the simplest and fastest approach
- Method 2: Use the CC Switch desktop app for visual configuration management with one-click switching
- Method 3 (Advanced): Use the New API proxy service — suitable for scenarios requiring more custom configuration
Method 1: Direct Configuration (Recommended)
This is the simplest configuration method — just edit OpenCode’s configuration file.
Install OpenCode
go install github.com/anomalyco/opencode@latestGet Your CC Club API Key
Visit the Get API Key page to learn how to obtain a CC Club API key.
Edit the Configuration File
Edit ~/.config/opencode/opencode.json (create it if it does not exist):
cat ~/.config/opencode/opencode.json{
"provider": {
"anthropic": {
"options": {
"baseURL": "https://claude-code.club/api/v1",
"apiKey": "cr_your-api-key-here"
},
"npm": "@ai-sdk/anthropic",
"name": "cc-club(Claude)"
}
},
"$schema": "https://opencode.ai/config.json"
}Note: Replace cr_your-api-key-here with your actual CC Club API key.
CC Club API Addresses
Based on your network environment, you can choose from different API addresses:
| Address | Description |
|---|---|
https://claude-code.club/api/v1 | Default address (fastest when direct connection latency < 100ms) |
https://jp.claude-code.club/api/v1 | Japan node (Alibaba Cloud, optimized for China) |
https://hk.claude-code.club/api/v1 | Hong Kong node (Alibaba Cloud, optimized for China) |
Verify the Configuration
Launch OpenCode to verify the configuration is working:
opencodeVerification success indicator: OpenCode starts normally and you can have a conversation
Method 2: Configure Using CC Switch
CC Switch is an open-source cross-platform desktop app designed specifically for unified visual configuration management of AI coding assistant tools. It supports visual configuration management for Claude Code, Codex, OpenCode, and Gemini CLI.
Why use CC Switch
- Visual interface — no need to manually edit configuration files
- One-click switching between multiple API providers
- Built-in latency testing to select the fastest node
- Automatically handles model ID mapping issues
- Supports configuration backup and cloud sync
Install CC Switch
Choose the installation method for your operating system:
Option 1: MSI installer (recommended)
- Visit CC Switch Releases
- Download the latest
.msifile - Double-click the installer and follow the prompts to complete installation
Option 2: Portable version
- Download the
.zipportable version - Extract to any directory
- Run
cc-switch.exedirectly
Install OpenCode
go install github.com/anomalyco/opencode@latestGet Your CC Club API Key
Visit the Get API Key page to learn how to obtain a CC Club API key.
Configure CC Switch
After launching the CC Switch app, follow these steps to add a CC Club provider:
-
Click the “Add Provider” button
-
Select “Custom” for custom configuration
-
Fill in the configuration details:
- Name: CC Club (or a custom name)
- Base URL: select the appropriate API address (see the address table below)
- API Key: enter your CC Club API key
- Model mapping (important): configure model ID mapping
-
Example model mapping configuration:
{ "claude-opus-4-5": "claude-opus-4-5-20251101", "claude-sonnet-4-5": "claude-sonnet-4-5-20250929", "claude-opus-4-5-20251101": "claude-opus-4-5-20251101", "claude-sonnet-4-5-20250929": "claude-sonnet-4-5-20250929" }
About model mapping: The left side is the model ID used by OpenCode (without a date), and the right side is the actual model ID in CC Club (with a date). With this configuration, OpenCode can correctly call CC Club’s models.
CC Club API Addresses
Choose the appropriate address based on your network environment:
| Address | Description |
|---|---|
https://claude-code.club/api | Default address (fastest when direct connection latency < 100ms) |
https://jp.claude-code.club/api | Japan node (Alibaba Cloud, optimized for China) |
https://hk.claude-code.club/api | Hong Kong node (Alibaba Cloud, optimized for China) |
Switch to the CC Club Provider
After saving the configuration:
- Find “CC Club” in the provider list on the CC Switch main screen
- Click the “Switch” button or click directly on that provider
- CC Switch will automatically update OpenCode’s configuration file
Test the Connection
-
Use CC Switch’s speed test feature:
- Click the “Test” button next to the provider
- Wait for the latency test to complete
- Check the response time and status indicator
-
Launch OpenCode to verify:
opencode
Verification success indicator: OpenCode starts normally and you can have a conversation
Detailed tutorial: CC Switch Complete Guide
Method 3: Use New API Proxy (Advanced)
If you need more custom configuration or the first two methods do not meet your needs, you can use a New API proxy service.
Why use a proxy?
- OpenCode’s default Anthropic model IDs use a format without dates (e.g.
claude-sonnet-4-5), while CC Club uses model IDs with dates (e.g.claude-sonnet-4-5-20250929). A New API proxy can resolve this compatibility issue. - Using a proxy can also help avoid restrictions that warn against using OpenCode clients.
Deploy the New API Proxy Service
New API is an open-source API management and proxy service that supports unified management of multiple AI models.
Deployment reference
New API supports Docker, 1Panel, and other deployment methods. For detailed deployment steps, refer to:
- Official documentation: https://docs.newapi.pro/zh/docs
- GitHub repository: https://github.com/QuantumNous/new-api
Configure the New API Channel
After deployment, configure the CC Club channel in New API.
Add a channel
Go to the New API admin interface, click “Channel Management” → “Add Channel.”
Fill in the channel information
Enter the following:
- Channel type: select Anthropic Claude
- Channel name: CC Club (or a custom name)
- Proxy address: enter the CC Club API address (refer to CC Club API Address)
- Key: enter your CC Club API key
Test the channel
Click the “Test” button to confirm the channel is configured correctly. A success message will appear when the test passes.
Install OpenCode
go install github.com/anomalyco/opencode@latestConfigure OpenCode
Locate OpenCode’s configuration file and edit it. The configuration file is typically at ~/.config/opencode/config.json.
Important notes:
- The API address suffix must include
/v1 - You must add a
modelsparameter for model renaming, because OpenCode defaults to using model IDs without dates
Configuration example
{
"anthropic": {
"options": {
"baseURL": "http://your-newapi-address/v1"
},
"models": {
"claude-opus-4-5-20251101": {
"name": "claude-opus-4-5-20251101"
},
"claude-sonnet-4-5-20250929": {
"name": "claude-sonnet-4-5-20250929"
}
}
}
}Configuration notes
| Config key | Description |
|---|---|
options.baseURL | New API address — must end with /v1 |
models | Model configuration — defines the available models and their names |
Verify the Configuration
After completing the configuration, launch OpenCode to verify:
opencodeVerification success indicators:
- OpenCode starts normally and you can have a conversation
- Call records are visible in New API’s logs
View call logs
In the “Logs” page of the New API admin interface, you can view OpenCode’s call records and confirm that requests are being correctly forwarded to CC Club.
Frequently Asked Questions
Q: Which method should I choose?
A: It is recommended to start with Method 1 (direct configuration) — it is the simplest and fastest. If you need visual management of multiple providers, use Method 2 (CC Switch). Only consider Method 3 (New API) if you need more custom configuration.
Q: Getting a “model not found” error?
A:
- Method 1: Check that
baseURLin the configuration file is correct and ends with/v1 - Method 2: Check that the Base URL configured in CC Switch is correct
- Method 3: Check that the
modelsconfiguration is correct and the model IDs are configured properly
Q: Request failing or timing out?
A: Check the following:
- Is the network connection working?
- Is the API key correct?
- Is the Base URL correct (must end with
/v1)? - If using Method 3, is the New API service running properly?
Q: How do I get a CC Club API key?
A: Visit the Get API Key page to learn how to obtain a key.