mirror of
https://github.com/LLM-Red-Team/kimi-free-api.git
synced 2025-10-14 22:34:40 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
eef674eac8 | ||
![]() |
e530317486 |
30
README.md
30
README.md
@@ -74,10 +74,14 @@ https://udify.app/chat/Po0F6BMJ15q5vu2P
|
||||
|
||||
从 [kimi.moonshot.cn](https://kimi.moonshot.cn) 获取refresh_token
|
||||
|
||||
进入kimi随便发起一个对话,然后F12打开开发者工具,从Application > Local Storage中找到refresh_token的值,这将作为Authorization的Bearer Token值:`Authorization: Bearer TOKEN`
|
||||
进入kimi随便发起一个对话,然后F12打开开发者工具,从Application > Local Storage中找到`refresh_token`的值,这将作为Authorization的Bearer Token值:`Authorization: Bearer TOKEN`
|
||||
|
||||

|
||||
|
||||
如果你看到的`refresh_token`是一个数组,请使用`.`拼接起来再使用。
|
||||
|
||||

|
||||
|
||||
### 多账号接入
|
||||
|
||||
目前kimi限制普通账号每3小时内只能进行30轮长文本的问答,你可以通过提供多个账号的refresh_token并使用`,`拼接提供:
|
||||
@@ -227,9 +231,9 @@ Authorization: Bearer [refresh_token]
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"prompt_tokens": 0,
|
||||
"completion_tokens": 0,
|
||||
"total_tokens": 0
|
||||
"prompt_tokens": 1,
|
||||
"completion_tokens": 1,
|
||||
"total_tokens": 2
|
||||
},
|
||||
"created": 1710152062
|
||||
}
|
||||
@@ -289,9 +293,9 @@ Authorization: Bearer [refresh_token]
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"prompt_tokens": 0,
|
||||
"completion_tokens": 0,
|
||||
"total_tokens": 0
|
||||
"prompt_tokens": 1,
|
||||
"completion_tokens": 1,
|
||||
"total_tokens": 2
|
||||
},
|
||||
"created": 100920
|
||||
}
|
||||
@@ -353,9 +357,9 @@ Authorization: Bearer [refresh_token]
|
||||
}
|
||||
],
|
||||
"usage": {
|
||||
"prompt_tokens": 0,
|
||||
"completion_tokens": 0,
|
||||
"total_tokens": 0
|
||||
"prompt_tokens": 1,
|
||||
"completion_tokens": 1,
|
||||
"total_tokens": 2
|
||||
},
|
||||
"created": 1710123627
|
||||
}
|
||||
@@ -378,4 +382,8 @@ tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
# 设置保持连接的超时时间,这里设置为120秒。如果在这段时间内,客户端和服务器之间没有进一步的通信,连接将被关闭。
|
||||
keepalive_timeout 120;
|
||||
```
|
||||
```
|
||||
|
||||
### Token统计
|
||||
|
||||
由于推理侧不再kimi-free-api,因此token不可统计,将以固定数字返回。
|
BIN
doc/example-8.jpg
Normal file
BIN
doc/example-8.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kimi-free-api",
|
||||
"version": "0.0.13",
|
||||
"version": "0.0.14",
|
||||
"description": "Kimi Free API Server",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
@@ -506,7 +506,7 @@ function checkResult(result: AxiosResponse, refreshToken: string) {
|
||||
*/
|
||||
async function receiveStream(convId: string, stream: any) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 第一条消息初始化
|
||||
// 消息初始化
|
||||
const data = {
|
||||
id: convId,
|
||||
model: MODEL_NAME,
|
||||
@@ -514,7 +514,7 @@ async function receiveStream(convId: string, stream: any) {
|
||||
choices: [
|
||||
{ index: 0, message: { role: 'assistant', content: '' }, finish_reason: 'stop' }
|
||||
],
|
||||
usage: { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 },
|
||||
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
|
||||
created: util.unixTimestamp()
|
||||
};
|
||||
let refContent = '';
|
||||
@@ -612,7 +612,7 @@ function createTransStream(convId: string, stream: any, endCallback?: Function)
|
||||
} : {}, finish_reason: 'stop'
|
||||
}
|
||||
],
|
||||
usage: { prompt_tokens: 0, completion_tokens: 0, total_tokens: 0 },
|
||||
usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 },
|
||||
created
|
||||
})}\n\n`;
|
||||
!transStream.closed && transStream.write(data);
|
||||
|
Reference in New Issue
Block a user