curl --request POST \
--url https://direct.evolink.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kimi-k3.1-pro",
"input": "用一句话解释什么是上下文缓存。"
}
'{
"id": "resp_6adc72aab1f2eaaebe6b869e",
"object": "response",
"created_at": 1792832171,
"status": "completed",
"incomplete_details": {
"reason": "max_output_tokens"
},
"model": "kimi-k3.1-pro",
"output": [
{
"type": "message",
"id": "msg_6adc72aab1f2eaaebe6b869f",
"summary": [
{
"type": "summary_text",
"text": "<string>"
}
],
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "上下文缓存会保存请求中重复出现的前缀内容,后续请求命中时可以更快、更省地处理。"
}
],
"status": "completed"
}
],
"usage": {
"input_tokens": 24,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 96,
"output_tokens_details": {
"reasoning_tokens": 62
},
"total_tokens": 120
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}Responses 接口
Kimi 全模型接口 - Responses 快速开始
使用 model 与 input 调用 Kimi,支持 kimi-k3.1-pro、kimi-k3.1-pro-highspeed 与 kimi-k3。设置 max_output_tokens 时建议从 1024 起,为思考和正文预留空间。
更多示例与模型差异见完整参数页。
POST
/
v1
/
responses
curl --request POST \
--url https://direct.evolink.ai/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "kimi-k3.1-pro",
"input": "用一句话解释什么是上下文缓存。"
}
'{
"id": "resp_6adc72aab1f2eaaebe6b869e",
"object": "response",
"created_at": 1792832171,
"status": "completed",
"incomplete_details": {
"reason": "max_output_tokens"
},
"model": "kimi-k3.1-pro",
"output": [
{
"type": "message",
"id": "msg_6adc72aab1f2eaaebe6b869f",
"summary": [
{
"type": "summary_text",
"text": "<string>"
}
],
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "上下文缓存会保存请求中重复出现的前缀内容,后续请求命中时可以更快、更省地处理。"
}
],
"status": "completed"
}
],
"usage": {
"input_tokens": 24,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 96,
"output_tokens_details": {
"reasoning_tokens": 62
},
"total_tokens": 120
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>"
}
}BaseURL 说明:默认 BaseURL 为
https://direct.evolink.ai,对文本模型支持更好,支持长连接;https://api.evolink.ai 是多模态主力地址,对文本模型作为备用地址使用。POST /v1/responses,通过 model 选择 kimi-k3.1-pro、kimi-k3.1-pro-highspeed 或 kimi-k3。最少需要 model 和 input。
参数名称与 Chat Completions 不同:输入使用
input,输出上限使用 max_output_tokens,思考强度使用 reasoning.effort。读取正文
响应的output 可能同时包含推理、正文和工具调用。遍历 type="message" 中的 output_text 内容块,不要假设第一项就是正文。
假设已将响应 JSON 解析为 response,可以这样提取文本:
text = "".join(
part["text"]
for item in response.get("output", [])
if item.get("type") == "message"
for part in item.get("content", [])
if part.get("type") == "output_text"
)
print(text)
为思考预留输出预算:
max_output_tokens 包含思考与正文。若 status="incomplete" 且 incomplete_details.reason="max_output_tokens",请调高上限;预算耗尽时可能只有推理项,没有正文。授权
##所有接口均需要使用 Bearer Token 进行认证##
获取 API Key:
访问 API Key 管理页面 获取您的 API Key
使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求体
application/json
要调用的模型:
| 模型 ID | 定位 |
|---|---|
kimi-k3.1-pro | 最新一代模型(推荐) |
kimi-k3.1-pro-highspeed | 与 Pro 参数相同,生成速度更快 |
kimi-k3 | 上一代模型 |
三个模型的上下文窗口均为 1,048,576 tokens,均始终开启思考。
可用选项:
kimi-k3.1-pro, kimi-k3.1-pro-highspeed, kimi-k3 本次请求的输入。传字符串等价于一条 user 消息;传数组时按顺序给出历史消息。
最大生成 Token 数,包含思考与最终回答;默认 131072,最大 1048576。
必填范围:
1 <= x <= 1048576推理相关配置。
Show child attributes
Show child attributes
为 true 时以 SSE 事件流返回响应。
响应
响应创建成功;流式请求返回 SSE 事件流
响应 ID。
示例:
"resp_6adc72aab1f2eaaebe6b869e"
可用选项:
response 示例:
"response"
创建时间,Unix 时间戳(秒)。
示例:
1792832171
响应状态。incomplete 通常表示达到 max_output_tokens 上限。
可用选项:
completed, incomplete, failed 示例:
"completed"
status 为 incomplete 时给出原因。
Show child attributes
Show child attributes
本次调用的模型。
示例:
"kimi-k3.1-pro"
输出项数组,通常先是 reasoning,再是 message。
Show child attributes
Show child attributes
Show child attributes
Show child attributes