- tags:: AI Coding 应用
- source:: anthropics/claude-code: Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.
Claude Code 是一个闭源的 CLI 工具(提供了良好的 TUI 功能),基于 TypeScript 和 wasm 实现。
功能
- 支持 MCP 工具集成
- 支持代码阅读及代码编辑
安装配置
npm install -g @anthropic-ai/claude-code安装完后,启动一次 claude 然后编辑 home 目录下的 .claude.json 添加一行以下内容:
"hasCompletedOnboarding": true,
在 ~/.claude/settings.json 中设置 api url 及 api key 和模型名称,例如
{
"env": {
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
"ANTHROPIC_AUTH_TOKEN": "你的apikey",
"ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
"API_TIMEOUT_MS": "3000000",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "glm-4.5-air",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "glm-4.6",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "glm-4.6"
}
}fish 函数快速切换模型:
function set_cc_model
set -gx ANTHROPIC_DEFAULT_OPUS_MODEL $argv[1]
set -gx ANTHROPIC_DEFAULT_SONNET_MODEL $argv[1]
set -gx ANTHROPIC_DEFAULT_HAIKU_MODEL $argv[1]
end
set_cc_model default_model注意 env 配置项 CLAUDE_CODE_ATTRIBUTION_HEADER ,它保证使用第三方 API 时不会导致大量 cache miss,具体见 Kai on X: “Claude Code v2.1.36+ quietly added an x-anthropic-billing-header block at the start of the system prompt. It includes a random 5-character cch value. If you are using Claude Code with Ollama, LM Studio, or a third-party proxy, that tiny changing field can break prompt cache https://t.co/oNsk3BUxuh” / X
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-xxx",
"ANTHROPIC_BASE_URL": "https://xxx",
"CLAUDE_CODE_ENABLE_TELEMETRY": "0",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"DO_NOT_TRACK": "1",
"DISABLE_AUTOUPDATER": "1",
"DISABLE_UPGRADE_COMMAND": "1",
"CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION": "0",
"CLAUDE_CODE_TMUX_TRUECOLOR": "1",
"DISABLE_ERROR_REPORTING": "1",
"DISABLE_EXTRA_USAGE_COMMAND": "1",
"DISABLE_INSTALL_GITHUB_APP_COMMAND": "1"
},
"promptSuggestionEnabled": false,
"prefersReducedMotion": false,
"terminalProgressBarEnabled": false,
"attribution": {
"commit": "Co-Authored-By: Claude Code",
"pr": ""
},
...
}所有环境变量: Environment variables - Claude Code Docs
相关扩展
- AndyMik90/Auto-Claude: Autonomous multi-session AI coding
- AnandChowdhary/continuous-claude: 🔂 Run Claude Code in a continuous loop, autonomously creating PRs, waiting for checks, and merging
GUI:
- Cloud CLI
- nimbalyst/nimbalyst: Nimbalyst - visual workspace for building with Codex, Claude Code, and more
- OpenSource03/harnss: Open-source, desktop client/UI build to harness Claude Code, Codex and any other Agent accepting Agent Client Protocol. Run multiple AI coding agents side by side with rich tool visualization, MCP integrations, built-in terminal, git, browser and just about anything else you may need.
- Emdash