mirror of
https://github.com/LLM-Red-Team/kimi-free-api.git
synced 2025-10-15 14:50:37 +00:00
Compare commits
29 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2aa6465a36 | ||
![]() |
09250f208a | ||
![]() |
a2d5ab9390 | ||
![]() |
fe584180b1 | ||
![]() |
c1c601b498 | ||
![]() |
b9caca3289 | ||
![]() |
2b32fc66f4 | ||
![]() |
bffd5a24a3 | ||
![]() |
95f8c4e3e3 | ||
![]() |
0632d8111e | ||
![]() |
f1aa2e822c | ||
![]() |
53436b5f21 | ||
![]() |
e8284288c9 | ||
![]() |
04db70bec5 | ||
![]() |
f7c1fa7be3 | ||
![]() |
b9d479b9f6 | ||
![]() |
c9c26fdd31 | ||
![]() |
43e14b6e3e | ||
![]() |
65a3fed83b | ||
![]() |
4a225853af | ||
![]() |
6b343f4094 | ||
![]() |
e8c6622e83 | ||
![]() |
ae6dc4a79f | ||
![]() |
bdb8ced5ce | ||
![]() |
a0c1bba3c9 | ||
![]() |
c6da81a53e | ||
![]() |
77d42d9484 | ||
![]() |
d73a9bc95d | ||
![]() |
65f45697e8 |
17
README.md
17
README.md
@@ -6,7 +6,7 @@
|
|||||||
<span>[ 中文 | <a href="README_EN.md">English</a> ]</span>
|
<span>[ 中文 | <a href="README_EN.md">English</a> ]</span>
|
||||||
|
|
||||||
|
|
||||||

|
[](LICENSE)
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
@@ -15,15 +15,17 @@
|
|||||||
|
|
||||||
与ChatGPT接口完全兼容。
|
与ChatGPT接口完全兼容。
|
||||||
|
|
||||||
还有以下五个free-api欢迎关注:
|
还有以下六个free-api欢迎关注:
|
||||||
|
|
||||||
阶跃星辰 (跃问StepChat) 接口转API [step-free-api](https://github.com/LLM-Red-Team/step-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)
|
阿里通义 (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)
|
聆心智能 (Emohaa) 接口转API [emohaa-free-api](https://github.com/LLM-Red-Team/emohaa-free-api)
|
||||||
|
|
||||||
@@ -38,6 +40,7 @@ ZhipuAI (智谱清言) 接口转API [glm-free-api](https://github.com/LLM-Red-Te
|
|||||||
* [Docker-compose部署](#Docker-compose部署)
|
* [Docker-compose部署](#Docker-compose部署)
|
||||||
* [Render部署](#Render部署)
|
* [Render部署](#Render部署)
|
||||||
* [Vercel部署](#Vercel部署)
|
* [Vercel部署](#Vercel部署)
|
||||||
|
* [Zeabur部署](#Zeabur部署)
|
||||||
* [原生部署](#原生部署)
|
* [原生部署](#原生部署)
|
||||||
* [接口列表](#接口列表)
|
* [接口列表](#接口列表)
|
||||||
* [对话补全](#对话补全)
|
* [对话补全](#对话补全)
|
||||||
@@ -46,9 +49,13 @@ ZhipuAI (智谱清言) 接口转API [glm-free-api](https://github.com/LLM-Red-Te
|
|||||||
* [refresh_token存活检测](#refresh_token存活检测)
|
* [refresh_token存活检测](#refresh_token存活检测)
|
||||||
* [注意事项](#注意事项)
|
* [注意事项](#注意事项)
|
||||||
* [Nginx反代优化](#Nginx反代优化)
|
* [Nginx反代优化](#Nginx反代优化)
|
||||||
|
* [Token统计](#Token统计)
|
||||||
|
* [Star History](#star-history)
|
||||||
|
|
||||||
## 免责声明
|
## 免责声明
|
||||||
|
|
||||||
|
**逆向API是不稳定的,建议前往MoonshotAI官方 https://platform.moonshot.cn/ 付费使用API,避免封禁的风险。**
|
||||||
|
|
||||||
**本组织和个人不接受任何资金捐助和交易,此项目是纯粹研究交流学习性质!**
|
**本组织和个人不接受任何资金捐助和交易,此项目是纯粹研究交流学习性质!**
|
||||||
|
|
||||||
**仅限自用,禁止对外提供服务或商用,避免对官方造成服务压力,否则风险自担!**
|
**仅限自用,禁止对外提供服务或商用,避免对官方造成服务压力,否则风险自担!**
|
||||||
@@ -425,7 +432,7 @@ Authorization: Bearer [refresh_token]
|
|||||||
|
|
||||||
### refresh_token存活检测
|
### refresh_token存活检测
|
||||||
|
|
||||||
检测refresh_token是否存活,如果存活live未true,否则为false,请不要频繁(小于10分钟)调用此接口。
|
检测refresh_token是否存活,如果存活live为true,否则为false,请不要频繁(小于10分钟)调用此接口。
|
||||||
|
|
||||||
**POST /token/check**
|
**POST /token/check**
|
||||||
|
|
||||||
|
60
README_EN.md
60
README_EN.md
@@ -1,6 +1,9 @@
|
|||||||
# KIMI AI Free Service
|
# KIMI AI Free Service
|
||||||
|
|
||||||

|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
[](LICENSE)
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
@@ -9,36 +12,41 @@ Supports high-speed streaming output, multi-turn dialogues, internet search, lon
|
|||||||
|
|
||||||
Fully compatible with the ChatGPT interface.
|
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)
|
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
|
## Table of Contents
|
||||||
|
|
||||||
* [Disclaimer](#disclaimer)
|
* [Disclaimer](#disclaimer)
|
||||||
*[Online experience](#在线experience)
|
* [Online experience](#Online-Experience)
|
||||||
* [Effect Example](#EffectExample)
|
* [Effect Examples](#Effect-Examples)
|
||||||
* [Access preparation](#access preparation)
|
* [Access preparation](#Access-Preparation)
|
||||||
* [Multiple account access](#multiple account access)
|
* [Multiple account access](#Multi-Account-Access)
|
||||||
* [Docker Deployment](#DockerDeployment)
|
* [Docker Deployment](#Docker-Deployment)
|
||||||
* [Docker-compose deployment](#Docker-compose deployment)
|
* [Docker-compose deployment](#Docker-compose-deployment)
|
||||||
* [Native Deployment](#nativedeployment)
|
* [Zeabur Deployment](#Zeabur-Deployment)
|
||||||
* [Interface List](#Interface List)
|
* [Native Deployment](#Native-deployment)
|
||||||
* [Dialogue completion](#dialogue completion)
|
* [Interface List](#Interface-List)
|
||||||
* [Document Interpretation](#document interpretation)
|
* [Conversation completion](#conversation-completion)
|
||||||
* [Image analysis](#imageanalysis)
|
* [Document Interpretation](#document-interpretation)
|
||||||
* [refresh_token survival detection](#refresh_token survival detection)
|
* [Image analysis](#image-analysis)
|
||||||
* [Note](# NOTE)
|
* [refresh_token survival detection](#refresh_token-survival-detection)
|
||||||
* [Nginx anti-generation optimization](#Nginx anti-generation optimization)
|
* [Precautions](#Precautions)
|
||||||
|
* [Nginx anti-generation optimization](#Nginx-anti-generation-optimization)
|
||||||
|
* [Token statistics](#Token-statistics)
|
||||||
|
* [Star History](#star-history)
|
||||||
|
|
||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
**This organization and individuals do not accept any financial donations and transactions. This project is purely for research, communication, and learning purposes!**
|
**This organization and individuals do not accept any financial donations and transactions. This project is purely for research, communication, and learning purposes!**
|
||||||
@@ -145,6 +153,10 @@ services:
|
|||||||
- TZ=Asia/Shanghai
|
- TZ=Asia/Shanghai
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Zeabur Deployment
|
||||||
|
|
||||||
|
[](https://zeabur.com/templates/GRFYBP)
|
||||||
|
|
||||||
## Native deployment
|
## Native deployment
|
||||||
|
|
||||||
Please prepare a server with a public IP and open port 8000.
|
Please prepare a server with a public IP and open port 8000.
|
||||||
@@ -193,10 +205,6 @@ Out of service
|
|||||||
pm2 stop kimi-free-api
|
pm2 stop kimi-free-api
|
||||||
```
|
```
|
||||||
|
|
||||||
## Zeabur Deployment
|
|
||||||
|
|
||||||
[](https://zeabur.com/templates/GRFYBP)
|
|
||||||
|
|
||||||
## interface list
|
## 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.
|
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.
|
||||||
@@ -431,4 +439,4 @@ Since the inference side is not in kimi-free-api, the token cannot be counted an
|
|||||||
|
|
||||||
## Star History
|
## Star History
|
||||||
|
|
||||||
[](https://star-history.com/ #LLM-Red-Team/kimi-free-api&Date)
|
[](https://star-history.com/#LLM-Red-Team/kimi-free-api&Date)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "kimi-free-api",
|
"name": "kimi-free-api",
|
||||||
"version": "0.0.28",
|
"version": "0.0.30",
|
||||||
"description": "Kimi Free API Server",
|
"description": "Kimi Free API Server",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@@ -609,35 +609,49 @@ async function uploadFile(fileUrl: string, refreshToken: string) {
|
|||||||
});
|
});
|
||||||
checkResult(result, refreshToken);
|
checkResult(result, refreshToken);
|
||||||
|
|
||||||
// 获取文件上传结果
|
let fileId, status, startTime = Date.now();
|
||||||
result = await axios.post('https://kimi.moonshot.cn/api/file', {
|
while (status != 'initialized') {
|
||||||
type: 'file',
|
if (Date.now() - startTime > 30000)
|
||||||
name: filename,
|
throw new Error('文件等待处理超时');
|
||||||
object_name: objectName,
|
// 获取文件上传结果
|
||||||
timeout: 15000
|
result = await axios.post('https://kimi.moonshot.cn/api/file', {
|
||||||
}, {
|
type: 'file',
|
||||||
headers: {
|
name: filename,
|
||||||
Authorization: `Bearer ${accessToken}`,
|
object_name: objectName,
|
||||||
Referer: `https://kimi.moonshot.cn/`,
|
timeout: 15000
|
||||||
'X-Traffic-Id': userId,
|
}, {
|
||||||
...FAKE_HEADERS
|
headers: {
|
||||||
}
|
Authorization: `Bearer ${accessToken}`,
|
||||||
});
|
Referer: `https://kimi.moonshot.cn/`,
|
||||||
const { id: fileId } = checkResult(result, refreshToken);
|
'X-Traffic-Id': userId,
|
||||||
|
...FAKE_HEADERS
|
||||||
|
}
|
||||||
|
});
|
||||||
|
({ id: fileId, status } = checkResult(result, refreshToken));
|
||||||
|
}
|
||||||
|
|
||||||
// 处理文件转换
|
startTime = Date.now();
|
||||||
result = await axios.post('https://kimi.moonshot.cn/api/file/parse_process', {
|
let parseFinish = false;
|
||||||
ids: [fileId],
|
while (!parseFinish) {
|
||||||
timeout: 120000
|
if (Date.now() - startTime > 30000)
|
||||||
}, {
|
throw new Error('文件等待处理超时');
|
||||||
headers: {
|
// 处理文件转换
|
||||||
Authorization: `Bearer ${accessToken}`,
|
parseFinish = await new Promise(resolve => {
|
||||||
Referer: `https://kimi.moonshot.cn/`,
|
axios.post('https://kimi.moonshot.cn/api/file/parse_process', {
|
||||||
'X-Traffic-Id': userId,
|
ids: [fileId],
|
||||||
...FAKE_HEADERS
|
timeout: 120000
|
||||||
}
|
}, {
|
||||||
});
|
headers: {
|
||||||
checkResult(result, refreshToken);
|
Authorization: `Bearer ${accessToken}`,
|
||||||
|
Referer: `https://kimi.moonshot.cn/`,
|
||||||
|
'X-Traffic-Id': userId,
|
||||||
|
...FAKE_HEADERS
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(() => resolve(true))
|
||||||
|
.catch(() => resolve(false));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return fileId;
|
return fileId;
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ import Response from '@/lib/response/Response.ts';
|
|||||||
import chat from "./chat.ts";
|
import chat from "./chat.ts";
|
||||||
import ping from "./ping.ts";
|
import ping from "./ping.ts";
|
||||||
import token from './token.ts';
|
import token from './token.ts';
|
||||||
|
import models from './models.ts';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
@@ -21,5 +22,6 @@ export default [
|
|||||||
},
|
},
|
||||||
chat,
|
chat,
|
||||||
ping,
|
ping,
|
||||||
token
|
token,
|
||||||
|
models
|
||||||
];
|
];
|
41
src/api/routes/models.ts
Normal file
41
src/api/routes/models.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
|
||||||
|
prefix: '/v1',
|
||||||
|
|
||||||
|
get: {
|
||||||
|
'/models': async () => {
|
||||||
|
return {
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"id": "moonshot-v1",
|
||||||
|
"object": "model",
|
||||||
|
"owned_by": "kimi-free-api"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "moonshot-v1-8k",
|
||||||
|
"object": "model",
|
||||||
|
"owned_by": "kimi-free-api"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "moonshot-v1-32k",
|
||||||
|
"object": "model",
|
||||||
|
"owned_by": "kimi-free-api"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "moonshot-v1-128k",
|
||||||
|
"object": "model",
|
||||||
|
"owned_by": "kimi-free-api"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "moonshot-v1-vision",
|
||||||
|
"object": "model",
|
||||||
|
"owned_by": "kimi-free-api"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user