Skip to content

1935417243/claude-code-deepseek

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code + DeepSeek

简体中文| English

使用 DeepSeek 官方 Anthropic 兼容接口运行 Claude Code。

无需登录 Anthropic 账号,仅需 DeepSeek API Key。


特性

  • 支持 Claude Code
  • 使用 DeepSeek 官方 Anthropic 兼容接口
  • 无需 Claude / Anthropic 账号
  • macOS Keychain 安全存储 API Key
  • Windows DPAPI 加密存储 API Key
  • 自动生成 Claude Code 配置
  • 开箱即用

默认模型:

类型 模型
主模型 deepseek-v4-pro[1m]
快速模型 deepseek-v4-flash

DeepSeek开放平台:

https://platform.deepseek.com/api_keys

前置要求

安装 Node.js(LTS 版本):

https://nodejs.org/

安装完成后重新打开终端,确认:

npm --version

安装 Claude Code

如果尚未安装 Claude Code:

npm install -g @anthropic-ai/claude-code

安装完成后确认:

claude --version

macOS 安装

1. 下载脚本

下载:

install-mac.sh

2. 运行脚本

方法一:双击运行(推荐)

macOS 可直接双击:

install-mac.sh

首次运行如果被系统拦截:

  • 系统设置
  • 隐私与安全性
  • 允许脚本运行

方法二:终端运行

进入脚本目录:

cd 脚本所在目录

执行:

chmod +x install-mac.sh
./install-mac.sh

3. 输入 DeepSeek API Key

脚本会要求输入一次 API Key。

输入时终端不会显示内容,这是正常现象。


4. 启动 Claude Code

重新打开终端:

claude

测试:

claude -p "你好,只回答 OK"

macOS 安全说明

API Key 会保存到 macOS Keychain:

  • 不会明文写入 shell 配置
  • 不会暴露到环境变量

Windows 安装

1. 下载脚本

下载:

install-windows.ps1

2. 打开 PowerShell

不要直接双击 .ps1 文件。

推荐方式:

在脚本所在目录:

  • 按住 Shift
  • 鼠标右键
  • 点击:
在此处打开 PowerShell

或者:

在终端中打开

3. 运行安装脚本

执行:

powershell -ExecutionPolicy Bypass -File .\install-windows.ps1

如果当前 PowerShell 不在脚本目录:

先切换目录:

cd D:\your-folder

再执行:

powershell -ExecutionPolicy Bypass -File .\install-windows.ps1

4. 输入 DeepSeek API Key

脚本会要求输入一次 API Key。

输入时终端不会显示内容,这是正常现象。


5. 启动 Claude Code

重新打开:

  • PowerShell
  • Windows Terminal

运行:

claude

测试:

claude -p "你好,只回答 OK"

Windows 安全说明

API Key 会通过 Windows DPAPI 加密后保存:

%USERPROFILE%\.claude\deepseek-api-key.secret

该文件只能由当前 Windows 用户解密。


常见问题


npm: command not found

说明未安装 Node.js,或安装后未重新打开终端。

下载:

https://nodejs.org/


Windows PowerShell 执行策略问题

如果 Windows PowerShell 报:

无法加载文件 xxx.ps1,因为在此系统上禁止运行脚本

或者:

npm.ps1 无法运行

这是 Windows PowerShell 的执行策略(Execution Policy)限制,不是脚本本身损坏。

运行本项目安装脚本时,推荐使用临时绕过方式:

powershell -ExecutionPolicy Bypass -File .\install-windows.ps1

该方式只对本次命令生效,不会永久修改系统策略。

如果是执行 npm 时遇到 npm.ps1 无法运行,可以改用:

npm.cmd --version

或重新打开 cmd / Windows Terminal 后再试。


模型不存在 / model not found

通常是旧配置残留。

重新运行安装脚本即可自动覆盖:

macOS:

~/.claude/settings.json

Windows:

%USERPROFILE%\.claude\settings.json

Auth conflict

如果看到黄色提示:

Auth conflict

说明同时存在:

  • ANTHROPIC_AUTH_TOKEN
  • apiKeyHelper

删除环境变量即可。

macOS / Linux:

unset ANTHROPIC_AUTH_TOKEN

Windows:

Remove-Item Env:ANTHROPIC_AUTH_TOKEN

ParserError / UnexpectedToken

如果 Windows 报:

ParserError
UnexpectedToken

或者脚本中文乱码:

说明使用了旧版脚本。

新版脚本已经:

  • 使用纯 ASCII
  • 兼容 Windows PowerShell 5.1

请重新下载最新版脚本。


ConvertTo-SecureString 报错

如果运行:

claude

时出现:

apiKeyHelper failed
ConvertTo-SecureString

说明旧版脚本生成了错误的密钥文件。

重新运行新版:

powershell -ExecutionPolicy Bypass -File .\install-windows.ps1

即可自动修复。


更换 API Key

重新运行安装脚本即可覆盖旧 Key。

macOS:

./install-mac.sh

Windows:

powershell -ExecutionPolicy Bypass -File .\install-windows.ps1

更改思考档位

当前安装脚本默认写入:

"CLAUDE_CODE_EFFORT_LEVEL": "xhigh"

后续如果想调整,可以改成以下任意一档:

low
medium
high
xhigh
max

macOS:

nano ~/.claude/settings.json

找到 CLAUDE_CODE_EFFORT_LEVEL,把它改成想使用的档位,例如:

"CLAUDE_CODE_EFFORT_LEVEL": "max"

Windows:

打开 PowerShell,直接执行:

$settings = Join-Path $env:USERPROFILE ".claude\settings.json"
$json = Get-Content $settings -Raw | ConvertFrom-Json
$json.env.CLAUDE_CODE_EFFORT_LEVEL = "max"
$json | ConvertTo-Json -Depth 10 | Set-Content $settings -Encoding UTF8

这段命令不需要在安装脚本目录执行,因为它会直接修改当前 Windows 用户的:

%USERPROFILE%\.claude\settings.json

把示例里的 "max" 换成你想使用的档位即可。修改后重新打开终端,或重新运行 claude


卸载

macOS

删除 Claude 配置:

rm -rf ~/.claude

如需删除 Keychain 中保存的 API Key:

打开:

钥匙串访问

搜索:

deepseek

手动删除对应记录。


Windows

删除配置目录:

Remove-Item -Recurse -Force "$env:USERPROFILE\.claude"

免责声明

本项目仅用于:

  • 配置 Claude Code
  • 转发请求到 DeepSeek 官方 Anthropic 兼容接口

用户需自行承担 API 使用费用。

本项目与 Anthropic、DeepSeek 官方无关联。

About

Run Claude Code using DeepSeek's official Anthropic-compatible API — no Anthropic account required, only a DeepSeek API Key.

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors