Install the Four Major AI Coding Agents and Seamlessly Configure Six Chinese Models
This article walks through selecting the most suitable AI coding agent, provides step‑by‑step installation commands for Claude Code, OpenCode, Pi Agent and Hermes, details how to configure six domestic large language models, introduces the cc‑switch tool for quick model swapping, compares model capabilities, and offers troubleshooting tips.
AI coding agents and domestic model support
Four terminal‑based AI coding agents are covered: Claude Code, OpenCode, Pi Agent, and Hermes Agent. Each has distinct installation methods and target users.
Claude Code – npm global install; requires Node.js 18+. Provides agentic planning and strong tool integration.
OpenCode – one‑line curl script or go install; Go‑based TUI with support for 75+ model providers.
Pi Agent – npm global install or source build; minimalist design supporting only bash, read, write, edit tools.
Hermes Agent – curl install script; learns user habits, supports multi‑platform integration (WeChat, Feishu, Telegram).
Installation commands
Claude Code
npm install -g @anthropic-ai/claude-code
claude --version # prints version if installation succeededMac users should manage Node.js with nvm to avoid permission issues.
OpenCode
# One‑line install (recommended)
curl -fsSL https://opencode.ai/install | bash
# Alternative Go install
go install github.com/sst/opencode@latest
opencode --versionRun opencode in a project directory to start the TUI and follow the model‑configuration wizard.
Pi Agent
npm install -g @anthropic-ai/pi-agent
# Or build from source
git clone https://github.com/anthropics/pi.git
cd pi && npm install && npm link
pi # launches the agent and prompts for API keyHermes Agent
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
hermes setup # runs interactive configuration wizardThe wizard asks for model provider, API key and base URL.
Configuring domestic models for Claude Code
Claude Code defaults to Anthropic’s API, which is inaccessible in China. Replace the endpoint and token with a compatible Chinese model.
DeepSeek V4 Pro
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-<your‑DeepSeek‑key>
export ANTHROPIC_MODEL=deepseek-v4-pro
export ANTHROPIC_DEFAULT_OPUS_MODEL=deepseek-v4-pro
export ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-v4-pro
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash
export CLAUDE_CODE_SUBAGENT_MODEL=deepseek-v4-flash
export CLAUDE_CODE_EFFORT_LEVEL=maxWindows PowerShell users replace export with $env:VARIABLE="value" and add the lines to ~/.bashrc or ~/.zshrc for persistence.
智谱 GLM
{
"env": {
"ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<your‑GLM‑APIKey>",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.7",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air"
}
}To use the latest GLM‑5.1, change the model name to glm-5.1 and restart the terminal.
Kimi (Moonshot)
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.moonshot.cn/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<your‑Kimi‑APIKey>",
"ANTHROPIC_MODEL": "kimi-k2.5",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k2.5",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k2.5",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2.5"
}
}MiniMax
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.minimaxi.chat/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<your‑MiniMax‑APIKey>",
"ANTHROPIC_MODEL": "MiniMax-M3",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "MiniMax-M3",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "MiniMax-M3",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "MiniMax-M3",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "512000",
"API_TIMEOUT_MS": "3000000",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}Domestic users use https://api.minimaxi.chat; overseas users use https://api.minimax.io.
豆包 (Seed‑Code)
{
"env": {
"ANTHROPIC_BASE_URL": "https://ark.cn-beijing.volces.com/api/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<your‑Doubao‑APIKey>",
"ANTHROPIC_MODEL": "seed-code",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "seed-code",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "seed-code",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "seed-code"
}
}通义千问 (Qwen3)
{
"env": {
"ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/compatible/anthropic",
"ANTHROPIC_AUTH_TOKEN": "<your‑Qwen‑APIKey>",
"ANTHROPIC_MODEL": "qwen3-max",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "qwen3-max",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "qwen3-max",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "qwen3-turbo"
}
}cc‑switch: one‑click model switching
A shell script enables rapid switching without editing configuration files.
# Clone the repository
git clone https://github.com/foreveryh/claude-code-switch.git
cd claude-code-switch
chmod +x ccm.sh
sudo cp ccm.sh /usr/local/bin/ccm
# Edit API‑key file
vim ~/.ccm/config
# Example entries
DEEPSEEK_API_KEY=sk-<your‑DeepSeek‑key>
GLM_API_KEY=<your‑GLM‑key>
KIMI_API_KEY=<your‑Kimi‑key>
MINIMAX_API_KEY=<your‑MiniMax‑key>
ARK_API_KEY=<your‑Doubao‑key>
QWEN_API_KEY=<your‑Qwen‑key>
# Switch models
ccm deepseek # activate DeepSeek
ccm glm # activate GLM
ccm kimi # activate Kimi
ccm minimax # activate MiniMax
ccm seed # activate Doubao
ccm qwen # activate Qwen
ccm status # show current modelOpenCode and Hermes configuration for domestic models
OpenCode
Model providers are defined in opencode.json placed in the project root or user directory.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"deepseek": {
"apiKey": "${DEEPSEEK_API_KEY}",
"baseURL": "https://api.deepseek.com",
"models": {
"deepseek-v4-pro": {
"name": "DeepSeek V4 Pro",
"attachment": true
}
}
}
},
"model": "deepseek/deepseek-v4-pro"
}After editing, run opencode /models to list and select the new model, or use opencode /connect for interactive credential entry.
Hermes
Hermes provides an interactive setup wizard:
hermes setup # launch wizard to choose provider, enter API key and base URL
hermes model # quick model switch commandThe wizard lists supported providers, including DeepSeek, GLM, Kimi, MiniMax, Qwen, and others. Hermes also supports integration with WeChat and Feishu.
Cross‑model capability comparison
DeepSeek V4 Pro – balanced quality, fast response, low price; occasional loss of detail in very long contexts. ★★★★★
智谱 GLM‑5.1 – strongest Chinese understanding, good at documentation; occasional API latency. ★★★★☆
Kimi K2.5 – excellent price‑performance; slightly weaker on complex refactoring. ★★★★☆
MiniMax M3 – 512 K token window, ideal for large codebases; overkill for small tasks. ★★★★☆
豆包 Seed‑Code – front‑end‑focused, fast, good for React/Vue component generation; less capable for back‑end architecture. ★★★☆☆
通义千问 Qwen3 – good overall, tight integration with Alibaba Cloud services; not as specialized for pure coding. ★★★☆☆
Common issues and troubleshooting
Q1: Claude Code errors after configuration
Most problems stem from environment variables not being exported. Verify with:
echo $ANTHROPIC_BASE_URL
echo $ANTHROPIC_AUTH_TOKEN
# If empty, reload the profile
source ~/.bashrc # or source ~/.zshrcEnvironment variables take precedence over settings.json values.
Q2: Model appears unchanged after switching
Claude Code caches the model. Close the current session, open a new terminal, run claude, and check status with /status.
Q3: Data‑security considerations
Use open‑source or locally deployed models for sensitive code; any provider is acceptable for learning or open‑source projects.
Q4: Combining multiple models in daily workflow
Daily coding – DeepSeek V4 Pro
Complex refactoring – GLM‑5.1
Large‑project analysis – MiniMax M3
Front‑end work – Doubao Seed‑Code
Budget‑friendly option – Kimi K2.5
Switch between them instantly with ccm.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
AI Agent Super App
AI agent applications, installation, large-model testing, computer fundamentals, IT operations and maintenance exchange, network technology exchange, Linux learning
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
