Kimi
Kimi Anthropic Messages
Call Moonshot Kimi K2 series models via the Anthropic Messages compatible endpoint, supporting streaming, thinking, and tool calling.
POST
v1/messagesAuthorizations
x-api-keystringheaderrequired
sk-pat-YourAccessToken
anthropic-versionstringheaderrequired
API version, currently 2023-06-01
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 Anthropic Messages API format — existing Claude SDK code works unchanged; just set model to kimi-k2.6 / kimi-k2.5.
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 thinking in multi-turn context: When building conversation history, only pass back the previous turn's
textblock — do not includethinkingblocks inmessages, otherwise a parameter error will be returned. - system goes in the top-level field: The Anthropic endpoint follows the official
user/assistantconversation structure, with system messages passed via the top-levelsystemfield.
cURL
curl https://api.hai.network/compatible-preview/anthropic/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: sk-pat-YOUR_ACCESS_TOKEN" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "kimi-k2.5",
"stream": true,
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Describe spring in Hangzhou in one paragraph"
}
]
}'