SuperAPI AI Directory

KIMI(Moonshot api)

Multimodal models are now released! Supports multimodal understanding and processing.

Open website

About this tool

Purpose

Kimi (Moonshot API) provides the ability to create chat completions: send messages to the Kimi model and get replies, supporting streaming output, tool calls, and visual input. It is suitable for developers to integrate chat generation, tool calling, and multimodal understanding capabilities via the API.

Main Capabilities

  • Multimodal input: Supports visual input, including base64 encoding (data:image/png;base64,... or data:video/mp4;base64,...) as well as file references (ms://<file_id>).
  • Streaming output: Controls whether the response is returned in streaming mode via the stream parameter; the default is false.
  • Tool calling: The message list can insert a {"role": "system", "tools": [...]} message at any position in the conversation to dynamically load tools. This dynamic tool message does not contain the content field and only affects subsequent conversation turns.tool_choice Controls whether to call tools:auto(default, the model decides on its own),none(do not call),required(force call); you can also pass a specific function object to force calling a specified tool.
  • Structured output:response_format defaults to {"type": "text"} plain text;{"type": "json_object"} forces output of a valid JSON Object;{"type": "json_schema", "json_schema": {...}} outputs structured data according to a given JSON Schema (Structured Output).
  • Thinking mode: Kimi K3 always enables Thinking and enables Preserved Thinking. The reasoning effort supports low、high and max, with the default being max. You can use "prefix continuation" to force the model to begin in a specific format (such as JSON's {, a code block's ````python),在角色扮演中保持角色名称前缀(配合 name字段),或在finish_reason="length"`, use the same prefix to continue the truncated content.
  • Context caching (Cache Write): The cache is isolated at the organization (org) granularity, and organizations do not share it. After a request with the same prefix hits the cache during the cache validity period, the cache validity period is refreshed according to the original TTL; the hit portion is charged only the cache read fee, and no longer charged the cache write fee. Cache writes are billed separately by TTL. Manual cache clearing is not supported; cached prefixes automatically expire after at least 5 minutes of inactivity. Explicit cache breakpoints are not currently supported:content appears in prompt_cache_breakpoint , the request will be rejected (HTTP 400).
  • Request signing: You can carry a client-generated random nonce (UUID v4 recommended). Once carried, request signing is enabled, and the Kimi API will return Msh-Request-Timestamp and Msh-Request-Signaturein the response headers, which can be used to prove after the fact that the request was indeed processed by the Kimi API. Only one non-empty Header value is allowed; if the value is invalid, the request is executed as usual, but the above response headers are not returned.
  • Token probability information: Whenlogprobs is set to true , the response message 's logprobs field returns the log probability of each output Token;top_logprobs(0-20) specifies the number of top candidate Tokens to return for each Token position, and each candidate Token is accompanied by its log probability. When using this parameter, you must set logprobs to true.
  • Predicted Output: When most of the model response can be known in advance (for example, regenerating a file with only a few modifications), it can significantly reduce response latency.
  • Token length control:max_completion_tokens Controls the maximum number of Tokens generated by chat completion. The default value varies by model. For Kimi K3, the default is 131072, and the maximum can be set to 1048576. If the maximum Token count is reached before completion, finish_reason is "length", otherwise it is "stop". This value is the expected Token length of the return, not the total length of input plus output; if input plus max_completion_tokens exceeds the model context window, it will return invalid_request_error。max_tokens is deprecated, please use max_completion_tokens.
  • Stop words: Stop output when there is an exact match; the matched word itself will not be output; a maximum of 5 strings are allowed, each no more than 32 bytes.
  • Cache hit optimization field: Used to cache responses to similar requests to optimize the cache hit rate. For Coding Agent, this is usually the session id or task id representing a single session, and should remain unchanged when exiting and resuming the session. For Kimi Code Plan, this field is required to improve the cache hit rate; for other multi-turn conversation Agents, it is also recommended.
  • User identifier:user is a stable identifier for detecting users who may violate usage policies. It should be a string that uniquely identifies each user. It is recommended to hash the username or email to avoid sending identifiable information.

Usage

  • Authentication:Authorization The request header requires a Bearer token, using MOONSHOT_API_KEY as the token. This is a server-side secret; please generate it on the API key page.
  • Request signature nonce example:"7d929748-0ae6-41c2-ab5d-a186498ad721".
  • Message structure: In addition to standard messages, the Kimi K3 conversation message list can also insert {"role": "system", "tools": [...]} messages at any conversation position to dynamically load tools; this dynamic tool message does not contain the content field, and only affects subsequent conversation. Kimi K3 conversation messages support both standard messages and system messages that do not contain content, declaring dynamic tools via tools .
  • Context cache write option: When not passed, cache writing is enabled by default (5m tier), and the system automatically writes the request prefix to the 5m tier cache.
  • Response type:chat.completion; the Unix timestamp when the completion was created.
  • Documentation index file: The complete documentation index can be obtained at /docs/llms.txt . Use this file to discover all available pages before further exploration.

Applicable scenarios

  • Applications that integrate chat completion, streaming output, and tool calling via API.
  • Multimodal understanding scenarios that require visual input (images/videos).
  • Data processing scenarios that require structured output (JSON Object or JSON Schema).
  • Multi-turn conversation Agents that require context caching to optimize cost and latency.
  • Engineering scenarios that require request signature verification, Token probability analysis, or Predicted Output latency reduction.

Limitations

  • Manual cache clearing is not supported; cached prefixes automatically expire after at least 5 minutes of inactivity.
  • Explicit cache breakpoints are not currently supported:content appears in prompt_cache_breakpoint , the request will be rejected (HTTP 400).
  • The cache is isolated at the organization level; caches are not shared between organizations.
  • top_logprobs The prerequisite for use is that logprobs is set to true.
  • Stop words allow a maximum of 5 strings, each no more than 32 bytes.
  • If input plus max_completion_tokens exceeds the model context window, it will return invalid_request_error.
  • The request signature header allows only one non-empty value; when the value is invalid, the request is executed as usual but the signature response header is not returned.
  • Other information such as fees, pricing, and platform support scope is not fully covered in the materials; see the product pricing page for details.