Kimi 2.7 API
Complete API reference for Kimi 2.7 LLM models powered by Moonshot AI.
Model Variants
This API supports two model variants:
Quick Comparison
Kimi 2.7 Text to Text
Endpoint
POST /api/v1/chat/completions
Request Parameters
Required
Message Support
Optional
Example Request
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
Endpoint
POST /api/v1/chat/completions
Request Parameters
Required
Message Support
Optional
Example Request
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 models return OpenAI-compatible completion responses. With stream: true, the response is Server-Sent Events; with stream: false, the response is a single JSON object.
Best Practices
- Use concise system instructions for task-specific behavior.
- For image understanding, pair a clear question with image attachment content in
messages[].content.
- Tune
top_p and top_k only when you need stricter or more varied output.