HAI Gateway Docs

Kimi

Kimi Chat Completions

Call Moonshot Kimi K2 series models via the OpenAI-compatible endpoint, supporting streaming, long context, tool calling, and thinking.

POSTv1/chat/completions

Authorizations

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

ModelContextRecommended for
kimi-k2.61M tokensFlagship — strong reasoning + tool calling, best for long documents / code / agent workloads
kimi-k2.5256K tokensGeneral — 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/completions or 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 a thinking block in the content array.
  • Do not pass reasoning in multi-turn context: When building conversation history, only pass back the previous turn's content (OpenAI) or text block (Anthropic) — do not include reasoning_content / thinking blocks in messages, otherwise a parameter error will be returned.
  • developer role not supported: The OpenAI compatible endpoint only accepts system / user / assistant roles.
  • 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:Default
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
200:Default
{
  "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
  }
}