Responses

Create a model response

Creates a model response. Provide text or image inputs to generate text or JSON outputs. Have the model call the function tools you define. When stream is true, the response is delivered as a stream of SSE events.

post/v1/responses

Request

  • Base URL: https://api.moonshot.ai
  • URL: https://api.moonshot.ai/v1/responses
  • 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

modelstring required

ID of the model to use. This endpoint currently supports kimi-k3.

instructionsstring

Top-level system instructions, applied ahead of every input item.

streamboolean

When true, the response is delivered as a stream of SSE events.

max_output_tokensinteger

Maximum number of tokens to generate for this response. For kimi-k3 it defaults to 131072 and can be set up to 1048576. This refers to the length of tokens you expect us to return, not the total length of input plus output. When the limit is reached, status is incomplete and incomplete_details.reason is max_output_tokens.

tool_choice'auto'

Controls tool-calling behavior. With auto, the model decides whether to call a tool.

includestring[]

Additional fields to return. Only effective when the web_search tool is used. web_search_call.action.sources returns the web pages the search hit; web_search_call.results returns image search results.

prompt_cache_keystring

Context cache identifier. Reusing the same value across a session improves cache hit rate.

safety_identifierstring

A stable identifier used to help detect users of your application that may be violating usage policies. The ID should be a string that uniquely identifies each user. It is recommended to hash the username or email address to avoid sending any identifying information

Response

The response was created

idstring

Unique identifier of the response.

object'response'
created_atinteger

Unix timestamp of when the response was created.

completed_atinteger nullable

Unix timestamp of when the response finished. Present when status is completed or incomplete; null when status is in_progress or failed.

status'in_progress' | 'completed' | 'incomplete' | 'failed'

Response status. The opening snapshot of a stream is in_progress.

modelstring

Model that produced the response.

instructionsstring nullable
reasoningobject nullable
textobject nullable
tool_choice'auto'

Controls tool-calling behavior. With auto, the model decides whether to call a tool.

max_output_tokensinteger nullable
temperaturenumber nullable
top_pnumber nullable
metadataobject nullable
parallel_tool_callsboolean
service_tierstring nullable
storeboolean

Always false.

backgroundboolean nullable

Always false.

previous_response_idstring nullable

Always null.

conversationobject nullable

Always null.

Example response

{
  "id": "resp_68f0c1c2d3e4f5a6b7c8d9e0",
  "output": [
    {
      "id": "rs_68f0c1c2d3e4f5a6b7c8d9e0"
    }
  ]
}

Changes

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