申请一个 API KEY
最好充点钱,不然 API 会有限速
执行命令安装,window 建议使用 wsl2
node 版本最好 18+, 20+
npm install -g @anthropic-ai/claude-code
用户目录下/.claude/settings.json
window 为:
C:\Users\username\\.claude\settings.json
linux/macOS:
~/.claude/settings.json
配置内容
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-xx",
"ANTHROPIC_BASE_URL": "https://api.moonshot.cn/anthropic"
}
}
打开命令终端,执行 claude
╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code! │
│ │
│ /help for help, /status for your current setup │
│ │
│ cwd: /Users/gitsilence/api-proxy │
│ │
│ ─────────────────────────────────────────────── │
│ │
│ Overrides (via env): │
│ │
│ • API Base URL: │
│ https://api.moonshot.cn/anthropic │
╰───────────────────────────────────────────────────╯
Tips for getting started:
1. Run /init to create a CLAUDE.md file with instructions for Claude
2. Use Claude to help with file analysis, editing, bash commands and git
3. Be as specific as you would with another engineer for the best results
4. ✔ Run /terminal-setup to set up terminal integration
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ >