gudada commited on
Commit
ff00a54
·
verified ·
1 Parent(s): 370d9b8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -443
README.md CHANGED
@@ -1,443 +1,9 @@
1
- # 跃问StepChat Free 服务
2
-
3
- ![](https://img.shields.io/github/license/llm-red-team/step-free-api.svg)
4
- ![](https://img.shields.io/github/stars/llm-red-team/step-free-api.svg)
5
- ![](https://img.shields.io/github/forks/llm-red-team/step-free-api.svg)
6
- ![](https://img.shields.io/docker/pulls/vinlic/step-free-api.svg)
7
-
8
- 支持高速流式输出、支持多轮对话、支持联网搜索、支持长文档解读、支持图像解析,零配置部署,多路token支持,自动清理会话痕迹。
9
-
10
- 与ChatGPT接口完全兼容。
11
-
12
- 还有以下五个free-api欢迎关注:
13
-
14
- Moonshot AI(Kimi.ai)接口转API [kimi-free-api](https://github.com/LLM-Red-Team/kimi-free-api)
15
-
16
- 阿里通义 (Qwen) 接口转API [qwen-free-api](https://github.com/LLM-Red-Team/qwen-free-api)
17
-
18
- ZhipuAI (智谱清言) 接口转API [glm-free-api](https://github.com/LLM-Red-Team/glm-free-api)
19
-
20
- 秘塔AI (metaso) 接口转API [metaso-free-api](https://github.com/LLM-Red-Team/metaso-free-api)
21
-
22
- 聆心智能 (Emohaa) 接口转API [emohaa-free-api](https://github.com/LLM-Red-Team/emohaa-free-api)
23
-
24
- ## 目录
25
-
26
- * [声明](#声明)
27
- * [在线体验](#在线体验)
28
- * [效果示例](#效果示例)
29
- * [接入准备](#接入准备)
30
- * [多账号接入](#多账号接入)
31
- * [Docker部署](#Docker部署)
32
- * [Docker-compose部署](#Docker-compose部署)
33
- * [Render部署](#Render部署)
34
- * [Vercel部署](#Vercel部署)
35
- * [原生部署](#原生部署)
36
- * [接口列表](#接口列表)
37
- * [对话补全](#对话补全)
38
- * [文档解读](#文档解读)
39
- * [图像解析](#图像解析)
40
- * [refresh_token存活检测](#refresh_token存活检测)
41
- * [注意事项](#注意事项)
42
- * [Nginx反代优化](#Nginx反代优化)
43
-
44
- ## 声明
45
-
46
- 仅限自用,禁止对外提供服务或商用,避免对官方造成服务压力,否则风险自担!
47
-
48
- 仅限自用,禁止对外提供服务或商用,避免对官方造成服务压力,否则风险自担!
49
-
50
- 仅限自用,禁止对外提供服务或商用,避免对官方造成服务压力,否则风险自担!
51
-
52
- ## 在线体验
53
-
54
- 此链接仅临时测试功能,不可长期使用,长期使用请自行部署。
55
-
56
- https://udify.app/chat/RGqDVPHspgQgGSgf
57
-
58
- ## 效果示例
59
-
60
- ### 验明正身Demo
61
-
62
- ![验明正身](./doc/example-1.png)
63
-
64
- ### 多轮对话Demo
65
-
66
- ![多轮对话](./doc/example-2.png)
67
-
68
- ### 联网搜索Demo
69
-
70
- ![联网搜索](./doc/example-3.png)
71
-
72
- ### 长文档解读Demo
73
-
74
- ![长文档解读](./doc/example-4.png)
75
-
76
- ### 图像解析Demo
77
-
78
- ![图像解析](./doc/example-6.png)
79
-
80
- ## 接入准备
81
-
82
- 从 [stepchat.cn](https://stepchat.cn) 获取Oasis-Token
83
-
84
- 进入StepChat随便发起一个对话,然后F12打开开发者工具,从Application > Cookies中找到`Oasis-Token`的值,这将作为Authorization的Bearer Token值:`Authorization: Bearer TOKEN`
85
-
86
- ![example5](./doc/example-5.png)
87
-
88
- ### 多账号接入
89
-
90
- 你可以通过提供多个账号的refresh_token并使用`,`拼接提供:
91
-
92
- `Authorization: Bearer TOKEN1,TOKEN2,TOKEN3`
93
-
94
- 每次请求服务会从中挑选一个。
95
-
96
- ## Docker部署
97
-
98
- 请准备一台具有公网IP的服务器并将8000端口开放。
99
-
100
- 拉取镜像并启动服务
101
-
102
- ```shell
103
- docker run -it -d --init --name step-free-api -p 8000:8000 -e TZ=Asia/Shanghai vinlic/step-free-api:latest
104
- ```
105
-
106
- 查看服务实时日志
107
-
108
- ```shell
109
- docker logs -f step-free-api
110
- ```
111
-
112
- 重启服务
113
-
114
- ```shell
115
- docker restart step-free-api
116
- ```
117
-
118
- 停止服务
119
-
120
- ```shell
121
- docker stop step-free-api
122
- ```
123
-
124
- ### Docker-compose部署
125
-
126
- ```yaml
127
- version: '3'
128
-
129
- services:
130
- step-free-api:
131
- container_name: step-free-api
132
- image: vinlic/step-free-api:latest
133
- restart: always
134
- ports:
135
- - "8000:8000"
136
- environment:
137
- - TZ=Asia/Shanghai
138
- ```
139
-
140
- ### Render部署
141
-
142
- **注意:部分部署区域可能无法连接step,如容器日志出现请求超时或无法连接,请切换其他区域部署!**
143
- **注意:免费账户的容器实例将在一段时间不活动时自动停止运行,这会导致下次请求时遇到50秒或更长的延迟,建议查看[Render容器保活](https://github.com/LLM-Red-Team/free-api-hub/#Render%E5%AE%B9%E5%99%A8%E4%BF%9D%E6%B4%BB)**
144
-
145
- 1. fork本项目到你的github账号下。
146
-
147
- 2. 访问 [Render](https://dashboard.render.com/) 并登录你的github账号。
148
-
149
- 3. 构建你的 Web Service(New+ -> Build and deploy from a Git repository -> Connect你fork的项目 -> 选择部署区域 -> 选择实例类型为Free -> Create Web Service)。
150
-
151
- 4. 等待构建完成后,复制分配的域名并拼接URL访问即可。
152
-
153
- ### Vercel部署
154
-
155
- **注意:Vercel免费账户的请求响应超时时间为10秒,但接口响应通常较久,可能会遇到Vercel返回的504超时错误!**
156
-
157
- 请先确保安装了Node.js环境。
158
-
159
- ```shell
160
- npm i -g vercel --registry http://registry.npmmirror.com
161
- vercel login
162
- git clone https://github.com/LLM-Red-Team/step-free-api
163
- cd step-free-api
164
- vercel --prod
165
- ```
166
-
167
- ## 原生部署
168
-
169
- 请准备一台具有公网IP的服务器并将8000端口开��。
170
-
171
- 请先安装好Node.js环境并且配置好环境变量,确认node命令可用。
172
-
173
- 安装依赖
174
-
175
- ```shell
176
- npm i
177
- ```
178
-
179
- 安装PM2进行进程守护
180
-
181
- ```shell
182
- npm i -g pm2
183
- ```
184
-
185
- 编译构建,看到dist目录就是构建完成
186
-
187
- ```shell
188
- npm run build
189
- ```
190
-
191
- 启动服务
192
-
193
- ```shell
194
- pm2 start dist/index.js --name "step-free-api"
195
- ```
196
-
197
- 查看服务实时日志
198
-
199
- ```shell
200
- pm2 logs step-free-api
201
- ```
202
-
203
- 重启服务
204
-
205
- ```shell
206
- pm2 reload step-free-api
207
- ```
208
-
209
- 停止服务
210
-
211
- ```shell
212
- pm2 stop step-free-api
213
- ```
214
-
215
- ## 接口列表
216
-
217
- 目前支持与openai兼容的 `/v1/chat/completions` 接口,可自行使用与openai或其他兼容的客户端接入接口,或者使用 [dify](https://dify.ai/) 等线上服务接入使用。
218
-
219
- ### 对话补全
220
-
221
- 对话补全接口,与openai的 [chat-completions-api](https://platform.openai.com/docs/guides/text-generation/chat-completions-api) 兼容。
222
-
223
- **POST /v1/chat/completions**
224
-
225
- header 需要设置 Authorization 头部:
226
-
227
- ```
228
- Authorization: Bearer [refresh_token]
229
- ```
230
-
231
- 请求数据:
232
- ```json
233
- {
234
- // 模型名称随意填写
235
- "model": "step",
236
- "messages": [
237
- {
238
- "role": "user",
239
- "content": "你是谁?"
240
- }
241
- ],
242
- // 如果使用SSE流请设置为true,默认false
243
- "stream": false
244
- }
245
- ```
246
-
247
- 响应数据:
248
- ```json
249
- {
250
- "id": "85466015488159744",
251
- "model": "step",
252
- "object": "chat.completion",
253
- "choices": [
254
- {
255
- "index": 0,
256
- "message": {
257
- "role": "assistant",
258
- "content": "我是跃问(StepChat),一个由阶跃星辰(StepFun)开发的多模态大模型。我可以回答您的问题,提供信息和帮助,同时支持多种模态的交互,如文字、图像等。如果您有任何问题或需要帮助,请随时向我提问。"
259
- },
260
- "finish_reason": "stop"
261
- }
262
- ],
263
- "usage": {
264
- "prompt_tokens": 1,
265
- "completion_tokens": 1,
266
- "total_tokens": 2
267
- },
268
- "created": 1711829974
269
- }
270
- ```
271
-
272
- ### 文档解读
273
-
274
- 提供一个可访问的文件URL或者BASE64_URL进行解析。
275
-
276
- **POST /v1/chat/completions**
277
-
278
- header 需要设置 Authorization 头部:
279
-
280
- ```
281
- Authorization: Bearer [refresh_token]
282
- ```
283
-
284
- 请求数据:
285
- ```json
286
- {
287
- // 模型名称随意填写
288
- "model": "step",
289
- "messages": [
290
- {
291
- "role": "user",
292
- "content": [
293
- {
294
- "type": "file",
295
- "file_url": {
296
- "url": "https://mj101-1317487292.cos.ap-shanghai.myqcloud.com/ai/test.pdf"
297
- }
298
- },
299
- {
300
- "type": "text",
301
- "text": "文档里说了什么?"
302
- }
303
- ]
304
- }
305
- ]
306
- }
307
- ```
308
-
309
- 响应数据:
310
- ```json
311
- {
312
- "id": "85774360661086208",
313
- "model": "step",
314
- "object": "chat.completion",
315
- "choices": [
316
- {
317
- "index": 0,
318
- "message": {
319
- "role": "assistant",
320
- "content": "这是一个关于爱情魔法的文档。它包含了四个部分:\n\n1. **PMG 4.1390 – 1495**:这是一个使用面包和咒语来吸引心仪女性的仪式。仪式中需要将面包分成七个小块,并在特定地点进行咒语的念诵和投掷。\n2. **PMG 4.1342 – 57**:这是一个召唤恶魔来使一个名叫Tereous的女性受到折磨,直到她与一个名叫Didymos的人相爱并结合的咒语。\n3. **PGM 4.1265 – 74**:这是关于如何赢得一个美丽的女人的咒语。它涉及到连续三天保持纯洁,向女神阿佛洛狄特(Aphrodite)供奉乳香,并在心中默念她的神秘名字。\n4. **PGM 4.1496 – 1**:这是一个使用没药来吸引一个特定女性的咒语。这个咒语需要在煤上焚烧没药的同时念诵,目的是让这个女性心中只想着施咒者,并最终与施咒者相爱。"
321
- },
322
- "finish_reason": "stop"
323
- }
324
- ],
325
- "usage": {
326
- "prompt_tokens": 1,
327
- "completion_tokens": 1,
328
- "total_tokens": 2
329
- },
330
- "created": 1711903489
331
- }
332
- ```
333
-
334
- ### 图像解析
335
-
336
- 提供一个可访问的图像URL或者BASE64_URL进行解析。
337
-
338
- 此格式兼容 [gpt-4-vision-preview](https://platform.openai.com/docs/guides/vision) API格式,您也可以用这个格式传送文档进行解析。
339
-
340
- **POST /v1/chat/completions**
341
-
342
- header 需要设置 Authorization 头部:
343
-
344
- ```
345
- Authorization: Bearer [refresh_token]
346
- ```
347
-
348
- 请求数据:
349
- ```json
350
- {
351
- // 模型名称随意填写
352
- "model": "step",
353
- "messages": [
354
- {
355
- "role": "user",
356
- "content": [
357
- {
358
- "type": "image_url",
359
- "image_url": {
360
- "url": "https://k.sinaimg.cn/n/sinakd20111/106/w1024h682/20240327/babd-2ce15fdcfbd6ddbdc5ab588c29b3d3d9.jpg/w700d1q75cms.jpg"
361
- }
362
- },
363
- {
364
- "type": "text",
365
- "text": "图像描述了什么?"
366
- }
367
- ]
368
- }
369
- ]
370
- }
371
- ```
372
-
373
- 响应数据:
374
- ```json
375
- {
376
- "id": "85773574417829888",
377
- "model": "step",
378
- "object": "chat.completion",
379
- "choices": [
380
- {
381
- "index": 0,
382
- "message": {
383
- "role": "assistant",
384
- "content": "这张图片展示了一个活动现场,似乎是某种新产品或技术的发布会。图片中央有一个大屏幕,上面写着“创新技术及产品首发”,屏幕上还展示了一些公司的标志或名称,如“RWKV”、“财跃星辰”、“阶跃星辰”、“商汤”和“零方科技”。在屏幕下方的舞台上,有几位穿着正装的人士正在进行互动,可能是在进行产品发布或演示。整个场景给人一种正式且科技感十足的印象。"
385
- },
386
- "finish_reason": "stop"
387
- }
388
- ],
389
- "usage": {
390
- "prompt_tokens": 1,
391
- "completion_tokens": 1,
392
- "total_tokens": 2
393
- },
394
- "created": 1711903302
395
- }
396
- ```
397
-
398
- ### refresh_token存活检测
399
-
400
- 检测refresh_token是否存活,如果存活live未true,否则为false,请不要频繁(小于10分钟)调用此接口。
401
-
402
- **POST /token/check**
403
-
404
- 请求数据:
405
- ```json
406
- {
407
- "token": "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9..."
408
- }
409
- ```
410
-
411
- 响应数据:
412
- ```json
413
- {
414
- "live": true
415
- }
416
- ```
417
-
418
- ## 注意事项
419
-
420
- ### Nginx反代优化
421
-
422
- 如果您正在使用Nginx反向代理step-free-api,请添加以下配置项优化流的输出效果,优化体验感。
423
-
424
- ```nginx
425
- # 关闭代理缓冲。当设置为off时,Nginx会立即将客户端请求发送到后端服务器,并立即将从后端服务器接收到的响应发送回客户端。
426
- proxy_buffering off;
427
- # 启用分块传输编码。分块传输编码允许服务器为动态生成的内容分块发送数据,而不需要预先知道内容的大小。
428
- chunked_transfer_encoding on;
429
- # 开启TCP_NOPUSH,这告诉Nginx在数据包发送到客户端之前,尽可能地发送数据。这通常在sendfile使用时配合使用,可以提高网络效率。
430
- tcp_nopush on;
431
- # 开启TCP_NODELAY,这告诉Nginx不延迟发送数据,立即发送小数据包。在某些情况下,这可以减少网络的延迟。
432
- tcp_nodelay on;
433
- # 设置保持连接的超时时间,这里设置为120秒。如果在这段时间内,客户端和服务器之间没有进一步的通信,连接将被关闭。
434
- keepalive_timeout 120;
435
- ```
436
-
437
- ### Token统计
438
-
439
- 由于推理侧不在step-free-api,因此token不可统计,将以固定数字返回!!!!!
440
-
441
- ## Star History
442
-
443
- [![Star History Chart](https://api.star-history.com/svg?repos=LLM-Red-Team/step-free-api&type=Date)](https://star-history.com/#LLM-Red-Team/step-free-api&Date)
 
1
+ ---
2
+ license: apache-2.0
3
+ title: step-free-api
4
+ sdk: docker
5
+ emoji: 🚀
6
+ colorFrom: yellow
7
+ colorTo: blue
8
+ pinned: false
9
+ ---