Spaces:
Sleeping
Sleeping
test
Browse files
README.md
CHANGED
@@ -1,279 +1,6 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
[](https://openai.com)
|
8 |
-
|
9 |
-
</div>
|
10 |
-
|
11 |
-
<div>
|
12 |
-
<h3 style="color: #FF9909"> 特别说明:对于不太会部署,只是希望使用上最强 DeepClaude 组合的朋友,请直接联系 Erlich(微信:geekthings)购买按量付费的 API 即可,国内可以直接访问 </h3>
|
13 |
-
</div>
|
14 |
-
|
15 |
-
---
|
16 |
-
|
17 |
-
<details>
|
18 |
-
<summary><strong>更新日志:</strong></summary>
|
19 |
-
<div>
|
20 |
-
2025-02-08.2: 支持非流式请求,支持 OpenAI 兼容的 models 接口返回。(⚠️ 当前暂未实现正确的 tokens 消耗统计,稍后更新)
|
21 |
-
|
22 |
-
2025-02-08.1: 添加 Github Actions,支持 fork 自动同步、支持自动构建 Docker 最新镜像、支持 docker-compose 部署
|
23 |
-
|
24 |
-
2025-02-07.2: 修复 Claude temperature 参数可能会超过范围导致的请求失败的 bug
|
25 |
-
|
26 |
-
2025-02-07.1: 支持 Claude temputerature 等参数;添加更详细的 .env.example 说明
|
27 |
-
|
28 |
-
2025-02-06.1:修复非原生推理模型无法获得到推理内容的 bug
|
29 |
-
|
30 |
-
2025-02-05.1: 支持通过环境变量配置是否是原生支持推理字段的模型,满血版本通常支持
|
31 |
-
|
32 |
-
2025-02-04.2: 支持跨域配置,可在 .env 中配置
|
33 |
-
|
34 |
-
2025-02-04.1: 支持 Openrouter 以及 OneAPI 等中转服务商作为 Claude 部分的供应商
|
35 |
-
|
36 |
-
2025-02-03.3: 支持 OpenRouter 作为 Claude 的供应商,详见 .env.example 说明
|
37 |
-
|
38 |
-
2025-02-03.2: 由于 deepseek r1 在某种程度上已经开启了一个规范,所以我们也遵循推理标注的这种规范,更好适配支持的更好的 Cherry Studio 等软件。
|
39 |
-
|
40 |
-
2025-02-03.1: Siliconflow 的 DeepSeek R1 返回结构变更,支持新的返回结构
|
41 |
-
|
42 |
-
</div>
|
43 |
-
</details>
|
44 |
-
|
45 |
-
# Table of Contents
|
46 |
-
|
47 |
-
- [Table of Contents](#table-of-contents)
|
48 |
-
- [Introduction](#introduction)
|
49 |
-
- [Implementation](#implementation)
|
50 |
-
- [How to run](#how-to-run)
|
51 |
-
- [1. 获得运行所需的 API](#1-获得运行所需的-api)
|
52 |
-
- [2. 开始运行(本地运行)](#2-开始运行本地运行)
|
53 |
-
- [Deployment](#deployment)
|
54 |
-
- [Railway 一键部署(推荐)](#railway-一键部署推荐)
|
55 |
-
- [Zeabur 一键部署(一定概率下会遇到 Domain 生成问题,需要重新创建 project 部署)](#zeabur-一键部署一定概率下会遇到-domain-生成问题需要重新创建-project-部署)
|
56 |
-
- [使用 docker-compose 部署(Docker 镜像将随着 main 分支自动更新到最新)](#使用-docker-compose-部署docker-镜像将随着-main-分支自动更新到最新)
|
57 |
-
- [Docker 部署(自行 Build)](#docker-部署自行-build)
|
58 |
-
- [Automatic fork sync](#automatic-fork-sync)
|
59 |
-
- [Technology Stack](#technology-stack)
|
60 |
-
- [Star History](#star-history)
|
61 |
-
- [Buy me a coffee](#buy-me-a-coffee)
|
62 |
-
- [About Me](#about-me)
|
63 |
-
|
64 |
-
# Introduction
|
65 |
-
最近 DeepSeek 推出了 [DeepSeek R1 模型](https://platform.deepseek.com),在推理能力上已经达到了第一梯队。但是 DeepSeek R1 在一些日常任务的输出上可能仍然无法匹敌 Claude 3.5 Sonnet。Aider 团队最近有一篇研究,表示通过[采用 DeepSeek R1 + Claude 3.5 Sonnet 可以实现最好的效果](https://aider.chat/2025/01/24/r1-sonnet.html)。
|
66 |
-
|
67 |
-
<img src="https://img.erlich.fun/personal-blog/uPic/heiQYX.png" alt="deepseek r1 and sonnet benchmark" style="width=400px;"/>
|
68 |
-
|
69 |
-
> **R1 as architect with Sonnet as editor has set a new SOTA of 64.0%** on the [aider polyglot benchmark](https://aider.chat/2024/12/21/polyglot.html). They achieve this at **14X less cost** compared to the previous o1 SOTA result.
|
70 |
-
|
71 |
-
并且 Aider 还 [开源了 Demo](https://github.com/getasterisk/deepclaude),你可以直接在他们的项目上进行在线体验。
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
本项目受到该项目的启发,通过 fastAPI 完全重写,并支持 OpenAI 兼容格式,支持 DeepSeek 官方 API 以及第三方托管的 API。
|
76 |
-
|
77 |
-
用户可以自行运行在自己的服务器,并对外提供开放 API 接口,接入 [OneAPI](https://github.com/songquanpeng/one-api) 等实现统一分发(token 消耗部分仍需开发)。也可以接入你的日常 ChatBox 软件以及 接入 [Cursor](https://www.cursor.com/) 等软件实现更好的编程效果(Claude 的流式输出+ Tool use 仍需开发)。
|
78 |
-
|
79 |
-
# Implementation
|
80 |
-
⚠️Notice: 目前只支持流式输出模式(因为这是效率最高的模式,不会浪费时间);接下来会实现第一段 DeepSeek 推理阶段流式,Claude 输出非流式的模式(处于节省时间的考虑)。
|
81 |
-
|
82 |
-

|
83 |
-
|
84 |
-
# How to run
|
85 |
-
|
86 |
-
> 项目支持本地运行和服务器运行,本地运行可与 Ollama 搭配,实现用本地的 DeepSeek R1 与 Claude 组合输出
|
87 |
-
|
88 |
-
|
89 |
-
## 1. 获得运行所需的 API
|
90 |
-
|
91 |
-
1. 获取 DeepSeek API,因为最近 DeepSeek 还在遭受攻击,所以经常无法使用,推荐使用 Siliconflow 的效果更好(也可以本地 Ollama 的): https://cloud.siliconflow.cn/i/RXikvHE2 (点击此链接可以获得到 2000 万免费 tokens)
|
92 |
-
2. 获取 Claude 的 API KEY (目前还没有做中转模式,以及对 Google 和 AWS 托管的版本的兼容支持,欢迎 PR):https://console.anthropic.com
|
93 |
-
|
94 |
-
## 2. 开始运行(本地运行)
|
95 |
-
Step 1. 克隆本项目到适合的文件夹并进入项目
|
96 |
-
|
97 |
-
```bash
|
98 |
-
git clone [email protected]:ErlichLiu/DeepClaude.git
|
99 |
-
cd DeepClaude
|
100 |
-
```
|
101 |
-
|
102 |
-
Step 2. 通过 uv 安装依赖(如果你还没有安装 uv,请看下方注解)
|
103 |
-
|
104 |
-
```bash
|
105 |
-
# 通过 uv 在本地创建虚拟环境,并安装依赖
|
106 |
-
uv sync
|
107 |
-
# macOS 激活虚拟环境
|
108 |
-
source .venv/bin/activate
|
109 |
-
# Windows 激活虚拟环境
|
110 |
-
.venv\Scripts\activate
|
111 |
-
```
|
112 |
-
|
113 |
-
Step 3. 配置环境变量
|
114 |
-
|
115 |
-
```bash
|
116 |
-
# 复制 .env 环境变量到本地
|
117 |
-
cp .env.example .env
|
118 |
-
```
|
119 |
-
|
120 |
-
Step 4. 按照环境变量当中的注释依次填写配置信息(在此步骤可以配置 Ollama)
|
121 |
-
|
122 |
-
Step 5. 本地运行程序
|
123 |
-
|
124 |
-
```bash
|
125 |
-
# 本地运行
|
126 |
-
uvicorn app.main:app
|
127 |
-
```
|
128 |
-
|
129 |
-
Step 6. 配置程序到你的 Chatbox(推荐 [NextChat](https://nextchat.dev/)、[ChatBox](https://chatboxai.app/zh)、[LobeChat](https://lobechat.com/))
|
130 |
-
|
131 |
-
```bash
|
132 |
-
# 通常 baseUrl 为:http://127.0.0.1:8000/v1
|
133 |
-
```
|
134 |
-
|
135 |
-
**注:本项目采用 uv 作为包管理器,这是一个更快速更现代的管理方式,用于替代 pip,你可以[在此了解更多](https://docs.astral.sh/uv/)**
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
# Deployment
|
140 |
-
|
141 |
-
> 项目支持 Docker 服务器部署,可自行调用接入常用的 Chatbox,也可以作为渠道一直,将其视为一个特殊的 `DeepClaude`模型接入到 [OneAPI](https://github.com/songquanpeng/one-api) 等产品使用。
|
142 |
-
|
143 |
-
## Railway 一键部署(推荐)
|
144 |
-
<details>
|
145 |
-
<summary><strong>一键部署到 Railway</strong></summary>
|
146 |
-
|
147 |
-
<div>
|
148 |
-
1. 首先 fork 一份代码。
|
149 |
-
|
150 |
-
2. 点击打开 Railway 主页:https://railway.com?referralCode=RNTGCA
|
151 |
-
|
152 |
-
3. 点击 `Deploy a new project`
|
153 |
-

|
154 |
-
|
155 |
-
4. 点击 `Deploy from GitHub repo`
|
156 |
-

|
157 |
-
|
158 |
-
5. 点击 `Login with GitHub`
|
159 |
-

|
160 |
-
|
161 |
-
6. 选择升级,选择只需 5 美金的 Hobby Plan 即可
|
162 |
-

|
163 |
-

|
164 |
-
|
165 |
-
1. 点击 `Create a New Project`
|
166 |
-

|
167 |
-
|
168 |
-
1. 继续选择 `Deploy from GitHub repo`
|
169 |
-

|
170 |
-
|
171 |
-
1. 输入框内搜索`DeepClaude`,选中后点击。
|
172 |
-

|
173 |
-
|
174 |
-
1. 选择`Variable`,并点击`New Variable` 按钮,按照环境变量内的键值对进行填写
|
175 |
-

|
176 |
-
|
177 |
-
1. 填写完成后重新点击 `Deploy` 按钮,等待数秒后即可完成部署
|
178 |
-

|
179 |
-
|
180 |
-
1. 部署完成后,点击 `Settings` 按钮,然后向下查看到 `Networking` 区域,然后选择 `Generate Domain`,并输入 `8000` 作为端口号
|
181 |
-

|
182 |
-

|
183 |
-

|
184 |
-
|
185 |
-
1. 接下来就可以在你喜欢的 Chatbox 内配置使用或作为 API 使用了
|
186 |
-

|
187 |
-
|
188 |
-
</div>
|
189 |
-
</details>
|
190 |
-
|
191 |
-
## Zeabur 一键部署(一定概率下会遇到 Domain 生成问题,需要重新创建 project 部署)
|
192 |
-
<details>
|
193 |
-
<summary><strong>一键部署到 Zeabur</strong></summary>
|
194 |
-
<div>
|
195 |
-
|
196 |
-
|
197 |
-
[](https://zeabur.com?referralCode=ErlichLiu&utm_source=ErlichLiu)
|
198 |
-
|
199 |
-
1. 首先 fork 一份代码。
|
200 |
-
2. 进入 [Zeabur](https://zeabur.com?referralCode=ErlichLiu&utm_source=ErlichLiu),登录。
|
201 |
-
3. 选择 Create New Project,选择地区为新加坡或日本区域。
|
202 |
-
4. 选择项目来源为 Github,搜索框搜索 DeepClaude 后确认,然后点击右下角的 Config。
|
203 |
-
5. 在 Environment Variables 区域点击 Add Environment Variables,逐个填写 .env.example 当中的配置,等号左右对应的就是 Environment Variables 里的 Key 和 Value。(注意:ALLOW_API_KEY 是你自己规定的外部访问你的服务时需要填写的 API KEY,可以随意填写,不要有空格)
|
204 |
-
6. 全部编辑完成后点击 Next,然后点击 Deploy,静待片刻即可完成部署。
|
205 |
-
7. 完成部署后点击当前面板上部的 Networking,点击 Public 区域的 Generate Domain(也可以配置自己的域名),然后输入一个你想要的域名即可(这个完整的 xxx.zeabur.app 将是你接下来在任何开源对话框、Cursor、Roo Code 等产品内填写的 baseUrl)
|
206 |
-
8. 接下来就可以去上述所说的任何的项目里去配置使用你的 API 了,也可以配置到 One API,作为一个 OpenAI 渠道使用。(晚点会补充这部分的配置方法)
|
207 |
-
</div>
|
208 |
-
</details>
|
209 |
-
|
210 |
-
## 使用 docker-compose 部署(Docker 镜像将随着 main 分支自动更新到最新)
|
211 |
-
|
212 |
-
推荐可以使用 `docker-compose.yml` 文件进行部署,更加方便快捷。
|
213 |
-
|
214 |
-
1. 确保已安装 Docker Compose。
|
215 |
-
2. 复制 `docker-compose.yml` 文件到项目根目录。
|
216 |
-
3. 修改 `docker-compose.yml` 文件中的环境变量配置,将 `your_allow_api_key`,`your_allow_origins`,`your_deepseek_api_key` 和 `your_claude_api_key` 替换为你的实际配置。
|
217 |
-
4. 在项目根目录下运行 Docker Compose 命令启动服务:
|
218 |
-
|
219 |
-
```bash
|
220 |
-
docker-compose up -d
|
221 |
-
```
|
222 |
-
|
223 |
-
服务启动后,DeepClaude API 将在 `http://宿主机IP:8000/v1/chat/completions` 上进行访问。
|
224 |
-
|
225 |
-
|
226 |
-
## Docker 部署(自行 Build)
|
227 |
-
|
228 |
-
1. **构建 Docker 镜像**
|
229 |
-
|
230 |
-
在项目根目录下,使用 Dockerfile 构建镜像。请确保已经安装 Docker 环境。
|
231 |
-
|
232 |
-
```bash
|
233 |
-
docker build -t deepclaude:latest .
|
234 |
-
```
|
235 |
-
|
236 |
-
2. **运行 Docker 容器**
|
237 |
-
|
238 |
-
运行构建好的 Docker 镜像,将容器的 8000 端口映射到宿主机的 8000 端口。同时,通过 `-e` 参数设置必要的环境变量,包括 API 密钥、允许的域名等。请根据 `.env.example` 文件中的说明配置环境变量。
|
239 |
-
|
240 |
-
```bash
|
241 |
-
docker run -d \
|
242 |
-
-p 8000:8000 \
|
243 |
-
-e ALLOW_API_KEY=your_allow_api_key \
|
244 |
-
-e ALLOW_ORIGINS="*" \
|
245 |
-
-e DEEPSEEK_API_KEY=your_deepseek_api_key \
|
246 |
-
-e DEEPSEEK_API_URL=https://api.deepseek.com/v1/chat/completions \
|
247 |
-
-e DEEPSEEK_MODEL=deepseek-reasoner \
|
248 |
-
-e IS_ORIGIN_REASONING=true \
|
249 |
-
-e CLAUDE_API_KEY=your_claude_api_key \
|
250 |
-
-e CLAUDE_MODEL=claude-3-5-sonnet-20241022 \
|
251 |
-
-e CLAUDE_PROVIDER=anthropic \
|
252 |
-
-e CLAUDE_API_URL=https://api.anthropic.com/v1/messages \
|
253 |
-
-e LOG_LEVEL=INFO \
|
254 |
-
--restart always \
|
255 |
-
deepclaude:latest
|
256 |
-
```
|
257 |
-
|
258 |
-
请替换上述命令中的 `your_allow_api_key`,`your_allow_origins`,`your_deepseek_api_key` 和 `your_claude_api_key` 为你实际的 API 密钥和配置。`ALLOW_ORIGINS` 请设置为允许访问的域名,如 `"http://localhost:3000,https://chat.example.com"` 或 `"*"` 表示允许所有来源。
|
259 |
-
|
260 |
-
|
261 |
-
# Automatic fork sync
|
262 |
-
项目已经支持 Github Actions 自动更新 fork 项目的代码,保持你的 fork 版本与当前 main 分支保持一致。如需开启,请 frok 后在 Settings 中开启 Actions 权限即可。
|
263 |
-
|
264 |
-
|
265 |
-
# Technology Stack
|
266 |
-
- [FastAPI](https://fastapi.tiangolo.com/)
|
267 |
-
- [UV as package manager](https://docs.astral.sh/uv/#project-management)
|
268 |
-
- [Docker](https://www.docker.com/)
|
269 |
-
|
270 |
-
# Star History
|
271 |
-
|
272 |
-
[](https://star-history.com/#ErlichLiu/DeepClaude&Date)
|
273 |
-
|
274 |
-
# Buy me a coffee
|
275 |
-
<img src="https://img.erlich.fun/personal-blog/uPic/IMG_3625.JPG" alt="微信赞赏码" style="width: 400px;"/>
|
276 |
-
|
277 |
-
# About Me
|
278 |
-
- Email: [email protected]
|
279 |
-
- Website: [Erlichliu](https://erlich.fun)
|
|
|
1 |
+
title: Deep Claude Proxy
|
2 |
+
emoji: 💻
|
3 |
+
colorFrom: pink
|
4 |
+
colorTo: green
|
5 |
+
sdk: docker
|
6 |
+
pinned: false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|