Chat

Create Chat Completion

Creates a completion for the chat message. Supports standard chat, Partial Mode, and Tool Use (Function Calling).

post/v1/chat/completions

Request

  • Base URL: https://api.moonshot.ai
  • URL: https://api.moonshot.ai/v1/chat/completions
  • Auth: HTTP bearer

Headers

X-Msh-Request-Noncestring
Example:7d929748-0ae6-41c2-ab5d-a186498ad721

A client-generated random nonce (a UUID v4 is recommended). Sending it enables Request Signature: the Kimi API returns Msh-Request-Timestamp and Msh-Request-Signature in the response headers, which can later be used to prove that the request was handled by the Kimi API. Exactly one non-empty header value is allowed; if the value is invalid, the request proceeds normally but the headers above are not returned. See Verify Request Signature.

Request body

OR
OR

Example request

{
  "messages": [
    {
      "role": "user"
    }
  ]
}

Response

Chat completion response

idstring

Unique identifier for the completion

objectstring

Object type

createdinteger

Unix timestamp of when the completion was created

modelstring

Model used for the completion

Example response

{
  "object": "chat.completion"
}

Changes

No recorded changes to this operation across all 1 revision of this API.