mirror of
https://github.com/LLM-Red-Team/kimi-free-api.git
synced 2025-10-14 22:34:40 +00:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2aa6465a36 | ||
![]() |
09250f208a | ||
![]() |
a2d5ab9390 | ||
![]() |
fe584180b1 | ||
![]() |
c1c601b498 | ||
![]() |
b9caca3289 | ||
![]() |
2b32fc66f4 | ||
![]() |
bffd5a24a3 | ||
![]() |
95f8c4e3e3 | ||
![]() |
0632d8111e | ||
![]() |
f1aa2e822c | ||
![]() |
53436b5f21 |
@@ -15,15 +15,17 @@
|
||||
|
||||
与ChatGPT接口完全兼容。
|
||||
|
||||
还有以下五个free-api欢迎关注:
|
||||
还有以下六个free-api欢迎关注:
|
||||
|
||||
阶跃星辰 (跃问StepChat) 接口转API [step-free-api](https://github.com/LLM-Red-Team/step-free-api)
|
||||
|
||||
阿里通义 (Qwen) 接口转API [qwen-free-api](https://github.com/LLM-Red-Team/qwen-free-api)
|
||||
|
||||
ZhipuAI (智谱清言) 接口转API [glm-free-api](https://github.com/LLM-Red-Team/glm-free-api)
|
||||
智谱AI (智谱清言) 接口转API [glm-free-api](https://github.com/LLM-Red-Team/glm-free-api)
|
||||
|
||||
秘塔AI (metaso) 接口转API [metaso-free-api](https://github.com/LLM-Red-Team/metaso-free-api)
|
||||
秘塔AI (Metaso) 接口转API [metaso-free-api](https://github.com/LLM-Red-Team/metaso-free-api)
|
||||
|
||||
讯飞星火(Spark)接口转API [spark-free-api](https://github.com/LLM-Red-Team/spark-free-api)
|
||||
|
||||
聆心智能 (Emohaa) 接口转API [emohaa-free-api](https://github.com/LLM-Red-Team/emohaa-free-api)
|
||||
|
||||
@@ -48,6 +50,7 @@ ZhipuAI (智谱清言) 接口转API [glm-free-api](https://github.com/LLM-Red-Te
|
||||
* [注意事项](#注意事项)
|
||||
* [Nginx反代优化](#Nginx反代优化)
|
||||
* [Token统计](#Token统计)
|
||||
* [Star History](#star-history)
|
||||
|
||||
## 免责声明
|
||||
|
||||
|
24
README_EN.md
24
README_EN.md
@@ -12,17 +12,19 @@ Supports high-speed streaming output, multi-turn dialogues, internet search, lon
|
||||
|
||||
Fully compatible with the ChatGPT interface.
|
||||
|
||||
Also, the following four free APIs are available for your attention:
|
||||
Also, the following six free APIs are available for your attention:
|
||||
|
||||
Step to the Stars (StepChat) API to API [step-free-api](https://github.com/LLM-Red-Team/step-free-api)
|
||||
StepFun (StepChat) API to API [step-free-api](https://github.com/LLM-Red-Team/step-free-api)
|
||||
|
||||
Ali Tongyi (Qwen) API to API [qwen-free-api](https://github.com/LLM-Red-Team/qwen-free-api)
|
||||
|
||||
ZhipuAI (Wisdom Map Clear Words) API to API [glm-free-api](https://github.com/LLM-Red-Team/glm-free-api)
|
||||
ZhipuAI (ChatGLM) API to API [glm-free-api](https://github.com/LLM-Red-Team/glm-free-api)
|
||||
|
||||
MetaAI (metaso) 接口转API [metaso-free-api](https://github.com/LLM-Red-Team/metaso-free-api)
|
||||
MetaAI (metaso) API to API [metaso-free-api](https://github.com/LLM-Red-Team/metaso-free-api)
|
||||
|
||||
Listening Intelligence (Emohaa) API to API [emohaa-free-api](https://github.com/LLM-Red-Team/emohaa-free-api)
|
||||
Iflytek Spark (Spark) API to API [spark-free-api](https://github.com/LLM-Red-Team/spark-free-api)
|
||||
|
||||
Lingxin Intelligence (Emohaa) API to API [emohaa-free-api](https://github.com/LLM-Red-Team/emohaa-free-api)
|
||||
|
||||
## Table of Contents
|
||||
|
||||
@@ -33,6 +35,7 @@ Listening Intelligence (Emohaa) API to API [emohaa-free-api](https://github.com/
|
||||
* [Multiple account access](#Multi-Account-Access)
|
||||
* [Docker Deployment](#Docker-Deployment)
|
||||
* [Docker-compose deployment](#Docker-compose-deployment)
|
||||
* [Zeabur Deployment](#Zeabur-Deployment)
|
||||
* [Native Deployment](#Native-deployment)
|
||||
* [Interface List](#Interface-List)
|
||||
* [Conversation completion](#conversation-completion)
|
||||
@@ -42,7 +45,8 @@ Listening Intelligence (Emohaa) API to API [emohaa-free-api](https://github.com/
|
||||
* [Precautions](#Precautions)
|
||||
* [Nginx anti-generation optimization](#Nginx-anti-generation-optimization)
|
||||
* [Token statistics](#Token-statistics)
|
||||
|
||||
* [Star History](#star-history)
|
||||
|
||||
## Disclaimer
|
||||
|
||||
**This organization and individuals do not accept any financial donations and transactions. This project is purely for research, communication, and learning purposes!**
|
||||
@@ -149,6 +153,10 @@ services:
|
||||
- TZ=Asia/Shanghai
|
||||
```
|
||||
|
||||
## Zeabur Deployment
|
||||
|
||||
[](https://zeabur.com/templates/GRFYBP)
|
||||
|
||||
## Native deployment
|
||||
|
||||
Please prepare a server with a public IP and open port 8000.
|
||||
@@ -197,10 +205,6 @@ Out of service
|
||||
pm2 stop kimi-free-api
|
||||
```
|
||||
|
||||
## Zeabur Deployment
|
||||
|
||||
[](https://zeabur.com/templates/GRFYBP)
|
||||
|
||||
## interface list
|
||||
|
||||
Currently, the `/v1/chat/completions` interface compatible with openai is supported. You can use the client access interface compatible with openai or other clients, or use online services such as [dify](https://dify.ai/) Access and use.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kimi-free-api",
|
||||
"version": "0.0.28",
|
||||
"version": "0.0.30",
|
||||
"description": "Kimi Free API Server",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
@@ -609,35 +609,49 @@ async function uploadFile(fileUrl: string, refreshToken: string) {
|
||||
});
|
||||
checkResult(result, refreshToken);
|
||||
|
||||
// 获取文件上传结果
|
||||
result = await axios.post('https://kimi.moonshot.cn/api/file', {
|
||||
type: 'file',
|
||||
name: filename,
|
||||
object_name: objectName,
|
||||
timeout: 15000
|
||||
}, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Referer: `https://kimi.moonshot.cn/`,
|
||||
'X-Traffic-Id': userId,
|
||||
...FAKE_HEADERS
|
||||
}
|
||||
});
|
||||
const { id: fileId } = checkResult(result, refreshToken);
|
||||
let fileId, status, startTime = Date.now();
|
||||
while (status != 'initialized') {
|
||||
if (Date.now() - startTime > 30000)
|
||||
throw new Error('文件等待处理超时');
|
||||
// 获取文件上传结果
|
||||
result = await axios.post('https://kimi.moonshot.cn/api/file', {
|
||||
type: 'file',
|
||||
name: filename,
|
||||
object_name: objectName,
|
||||
timeout: 15000
|
||||
}, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Referer: `https://kimi.moonshot.cn/`,
|
||||
'X-Traffic-Id': userId,
|
||||
...FAKE_HEADERS
|
||||
}
|
||||
});
|
||||
({ id: fileId, status } = checkResult(result, refreshToken));
|
||||
}
|
||||
|
||||
// 处理文件转换
|
||||
result = await axios.post('https://kimi.moonshot.cn/api/file/parse_process', {
|
||||
ids: [fileId],
|
||||
timeout: 120000
|
||||
}, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Referer: `https://kimi.moonshot.cn/`,
|
||||
'X-Traffic-Id': userId,
|
||||
...FAKE_HEADERS
|
||||
}
|
||||
});
|
||||
checkResult(result, refreshToken);
|
||||
startTime = Date.now();
|
||||
let parseFinish = false;
|
||||
while (!parseFinish) {
|
||||
if (Date.now() - startTime > 30000)
|
||||
throw new Error('文件等待处理超时');
|
||||
// 处理文件转换
|
||||
parseFinish = await new Promise(resolve => {
|
||||
axios.post('https://kimi.moonshot.cn/api/file/parse_process', {
|
||||
ids: [fileId],
|
||||
timeout: 120000
|
||||
}, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${accessToken}`,
|
||||
Referer: `https://kimi.moonshot.cn/`,
|
||||
'X-Traffic-Id': userId,
|
||||
...FAKE_HEADERS
|
||||
}
|
||||
})
|
||||
.then(() => resolve(true))
|
||||
.catch(() => resolve(false));
|
||||
});
|
||||
}
|
||||
|
||||
return fileId;
|
||||
}
|
||||
|
Reference in New Issue
Block a user