Kimi 2.7 API
Moonshot AI 驱动的 Kimi 2.7 LLM 模型完整 API 参考。
模型变体
此 API 支持两种模型变体:
快速对比
Kimi 2.7 Text to Text
接口端点
POST /api/v1/chat/completions
请求参数
必需
消息支持
可选
请求示例
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'kimi-2.7-text-to-text',
messages: [
{
role: 'user',
content: 'Write a concise Java beginner tutorial outline.'
}
],
stream: true,
max_tokens: 2000,
top_p: 0.9,
top_k: 50
})
});
Kimi 2.7 Image to Text
接口端点
POST /api/v1/chat/completions
请求参数
必需
消息支持
可选
请求示例
const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'text/event-stream',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'kimi-2.7-image-to-text',
messages: [
{
role: 'user',
content: [
{ type: 'text', text: 'What is roughly shown in this image?' },
{
type: 'image_url',
image_url: {
url: 'https://example.com/sample-image.jpg'
}
}
]
}
],
stream: true,
max_tokens: 300
})
});
响应格式
Kimi 2.7 LLM 模型返回与 OpenAI 兼容的补全响应。使用 stream: true 时,响应为服务器发送事件(SSE);使用 stream: false 时,响应为单个 JSON 对象。
最佳实践
- 使用简洁的系统指令来定义特定任务行为。
- 对于图像理解,请在
messages[].content 中将清晰问题与图像附件内容搭配使用。
- 仅在需要更严格或更多样的输出时调整
top_p 和 top_k。