在claude code中使用deepseek API的安装与配置

发布时间:2026/7/29 8:50:22
在claude code中使用deepseek API的安装与配置 1.安装npm与node。在cmd中使用这两个命令验证是否安装C:\Users\znode --versionv24.18.0C:\Users\znpm --version11.16.02.安装claude code2.1在cmd中使用这个命令C:\Users\znpm install -g anthropic-ai/claude-code一般返回一下内容added 2 packages in 17s npm warn allow-scripts 1 package has install scripts not yet covered by allowScripts: npm warn allow-scripts anthropic-ai/claude-code2.1.220 (postinstall: node install.cjs) npm warn allow-scripts npm warn allow-scripts Run npm approve-scripts --allow-scripts-pending to review, or npm approve-scripts pkg to allow.2.2现在使用C:\Users\zclaude --versionclaude is not recognized as an internal or external command, operable program or batch file.2.3 将claude.cmd目录添加到path环境变量中使用下面的命令C:\Users\znpm prefix -g将输出的内容添加到环境变量中。C:\Users\zclaude --version2.1.220 (Claude Code)3.将deepseek的api添加到claude的配置中3.1在 Windows 系统中路径为C:\Users\你的用户名\.claude\在该文件夹下找到或新建settings.json文件。{env: {ANTHROPIC_BASE_URL: https://api.deepseek.com/anthropic,ANTHROPIC_AUTH_TOKEN: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,ANTHROPIC_MODEL: deepseek-v4-flash}}填入以上内容ANTHROPIC_AUTH_TOKEN为deepseek的API。3.2验证C:\Users\zclaudeWelcome to Claude Code v2.1.220..........................................................* █████▓▓░* ███▓░ ░░░░░░░░ ███▓░░░░ ░░░░░░░░░░ ███▓░░░░░░░░░░░░░░░░░░░░ * ██▓░░ ▓╭─── Claude Code v2.1.220 ────────────────────────────────────────────────────────────────────────────────────────────────╮│ │ Tips for getting started ││ Welcome back! │ Run /init to create a CLAUDE.md file with instructions for Claude ││ │ Note: You have launched claude in your home directory. For the best experi… ││ ▐▛███▜▌ │ ─────────────────────────────────────────────────────────── hiThought for 3s (ctrlo to expand)● Hi! How can I help you today? If youre working on something, let me know what youd like to do — whether its coding,debugging, researching, or anything else.