anthropic claude code
阅读原文
建议阅读原文,始终查看最新文档版本,获得最佳阅读体验:《anthropic claude code》
如何调用anthropic claude 4大模型
请查看:[https://mp.weixin.qq.com/s/yFE73Z09-mVgnuh1sOyTRw](https://mp.weixin.qq.com/s/yFE73Z09-mVgnuh1sOyTRw)
介绍
Claude Code 是Anthropic推出的、专为编程和代码相关任务优化的基于命令行的大语言模型助手,擅长代码生成、理解和调试。其底层调用的是anthropic Claude Opus 4大模型
官网
Claude Code: Deep Coding at Terminal Velocity \ Anthropic
https://docs.anthropic.com/en/docs/claude-code/overview
Why Claude Code? 为什么使用 Claude Code?
Accelerate development 加速开发
Use Claude Code to accelerate development with the following key capabilities:
使用 Claude Code 通过以下关键功能加速开发:
-
Editing files and fixing bugs across your codebase
跨代码库编辑文件和修复 bug -
Answering questions about your code’s architecture and logic
回答关于代码架构和逻辑的问题 -
Executing and fixing tests, linting, and other commands
执行和修复测试、代码检查以及其他命令 -
Searching through git history, resolving merge conflicts, and creating commits and PRs
通过 git 历史记录搜索、解决合并冲突、创建提交和 PR -
Browsing documentation and resources from the internet using web search
使用网络搜索浏览互联网上的文档和资源
Claude Code provides a comprehensive set of tools for interacting with your development environment, including file operations, code search, web browsing, and more. Understanding these tools helps you leverage Claude Code’s full capabilities.
Claude Code
提供了一系列全面的工具,用于与您的开发环境进行交互,包括文件操作、代码搜索、网络浏览等。了解这些工具有助于您充分利用 Claude Code 的全部功能。
Security and privacy by design 设计中的安全与隐私
Your code’s security is paramount. Claude Code’s architecture ensures:
您的代码的安全性至关重要。Claude Code 的架构确保:
-
Direct API connection: Your queries go straight to Anthropic’s API without intermediate servers
直接 API 连接:您的查询直接发送到 Anthropic 的 API,不经过中间服务器 -
Works where you work: Operates directly in your terminal
在您工作的地方运行:直接在您的终端中运行 -
Understands context: Maintains awareness of your entire project structure
理解上下文:保持对整个项目结构的意识 -
Takes action: Performs real operations like editing files and creating commits
执行操作:进行实际操作,如编辑文件和创建提交
Enterprise integration 企业集成
Claude Code seamlessly integrates with enterprise AI platforms. You can connect to Amazon Bedrock or Google Vertex AI for secure, compliant deployments that meet your organization’s requirements.
Claude Code
无缝集成到企业 AI 平台。您可以连接到 Amazon Bedrock 或 Google Vertex AI,以实现安全、合规的部署,满足组织的要求。
安装
要安装claude code,首先要安装node.js,详见:《Node.js(NPM)》
mkdir claude_code_cli_test
cd claude_code_cli_test/
npm install -g @anthropic-ai/claude-code
首次使用
#配置base url和API key
export ANTHROPIC_AUTH_TOKEN=<此处替换为你的API KEY>
export ANTHROPIC_BASE_URL=https://anyrouter.top
claude
选择主题
按回车键继续
按回车键信任当前目录
现在可以开始与 claude code对话了
示例
询问claude code一个项目的功能
我曾经用Python开发了一个AI客服系统(《基于知识库的AI客服系统 - 项目总结报告》),我先cd到项目的目录,然后直接提问“这个项目是做什么的?”
接着再问“what technologies does this project use?”
使用claude code的技巧
最好用英文提问
我注意到,如果用其他语言提问,思考的的过程也是英文的,但最终的回答通常是基于提问的语言。