Kimi
Kimi Chat Completions
Call Moonshot Kimi K2 series models via the OpenAI-compatible endpoint, supporting streaming, long context, tool calling, and thinking.
POST
v1/chat/completionsAuthorizations
Authorizationstringheaderrequired
OpenAI compatible endpoint: Bearer sk-pat-YourAccessToken
Use your HAI Gateway personal access token (starting with sk-pat-). No separate Moonshot / Kimi API key is required.
Base URL
Body Parameters
The request body follows the OpenAI Chat Completions API format. For detailed parameter descriptions, refer to the Moonshot official documentation.
Supported Models
| Model | Context | Recommended for |
|---|---|---|
kimi-k2.6 | 1M tokens | Flagship — strong reasoning + tool calling, best for long documents / code / agent workloads |
kimi-k2.5 | 256K tokens | General — faster and cheaper, suited for everyday chat and shorter contexts |
Kimi Notes
- Only Chat Completion endpoints are supported: Kimi does not support the OpenAI Responses (
/v1/responses) endpoint. Please use/v1/chat/completionsor Anthropic/v1/messages. - Thinking field location: On the OpenAI endpoint, the reasoning chain is in
choices[].message.reasoning_content; on the Anthropic endpoint, it appears as athinkingblock in thecontentarray. - Do not pass reasoning in multi-turn context: When building conversation history, only pass back the previous turn's
content(OpenAI) ortextblock (Anthropic) — do not includereasoning_content/thinkingblocks inmessages, otherwise a parameter error will be returned. - developer role not supported: The OpenAI compatible endpoint only accepts
system/user/assistantroles. - Long-context billing: Kimi bills on actual prompt + completion tokens. For requests above 200K tokens we recommend enabling streaming to reduce time-to-first-token.
cURL
curl https://api.hai.network/compatible-preview/openai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-pat-YOUR_ACCESS_TOKEN" \
-d '{
"model": "kimi-k2.5",
"messages": [
{
"role": "user",
"content": "Hello, introduce Kimi in one sentence"
}
]
}'200
{
"id": "chatcmpl-...",
"object": "chat.completion",
"model": "kimi-k2.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I am Kimi, a long-context large language model developed by Moonshot AI."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 16,
"completion_tokens": 22,
"total_tokens": 38
}
}