This document describes how to call the model inference service directly provided by Moonshot AI on the Alibaba Cloud Model Studio platform.
Activate the service
- Go to the Model Studio console, search for Kimi, find the Kimi model card, and click Activate Now.
- In the pop-up window, confirm the activation and authorization.
Getting started
Prerequisites
- You have obtained an API key and configured the API key as an environment variable.
- If you call the service using a software development kit (SDK), you must install the SDK.
- kimi/kimi-k2.7-code-highspeed and kimi/kimi-k2.7-code are identical in functionality, with a 5~6x speed improvement.
- kimi/kimi-k3, kimi/kimi-k2.7-code-highspeed, and kimi/kimi-k2.7-code are thinking-only models (
enable_thinkingis always true and cannot be set to false). - For kimi/kimi-k2.6, you can use the
enable_thinkingparameter to control the thinking mode, which is enabled by default:
- Thinking mode (
reasoning_effort: "max"): The model outputs a detailed inference process (reasoning_content). - Non-thinking mode (
enable_thinking: falseor if the parameter is omitted): The model directly outputs the result without the inference process.
preserve_thinking parameter to pass the thinking process in multi-turn conversations. For more information, see Multi-turn conversation.
The following example shows how to call the kimi/kimi-k3 model in thinking mode to perform text generation.
- OpenAI compatible
reasoning_effort is not a standard OpenAI parameter. For the OpenAI Python SDK, you can pass it in the extra_body parameter. For the Node.js SDK, you can pass it as a top-level parameter.- Python
- Node.js
- HTTP
Response
Multimodal call examples
In addition to plain text conversations, kimi/kimi-k3, kimi/kimi-k2.7-code-highspeed, kimi/kimi-k2.7-code, and kimi/kimi-k2.6 have powerful multimodal understanding capabilities. This section describes how to use the model to understand image and video content.
Image understanding
The image understanding feature allows the Kimi model to recognize and analyze image content. You can provide one or more images. For more information about limitations on image files, see Image limitations.
- OpenAI compatible
- Python
- Node.js
- HTTP
Video understanding
For more information about limitations on video files, see Video limitations.
- OpenAI compatible
- Python
- Node.js
- HTTP
File limitations
- Image files
- Video files
- Image resolution: The recommended image resolution is 4K (4096 × 2160) or lower.
- Supported image formats: PNG, JPEG, WEBP, and GIF.
- Image size and quantity: There is no limit on the size or quantity of images, but you must ensure that the total size of the text and images in the request does not exceed 100 MB.
Other features
| Model | Multi-turn conversation | Function Calling | Partial mode | Web search | Context Cache | Structured output |
|---|---|---|---|---|---|---|
| kimi/kimi-k3 | Supported | Supported | Supported | Not supported | Supported | Supported |
| kimi/kimi-k2.7-code-highspeed | ||||||
| kimi/kimi-k2.7-code | ||||||
| kimi/kimi-k2.6 |
-
The preceding models support context cache (implicit cache, enabled by default):
- For kimi/kimi-k3, input tokens that hit the cache are billed at 10% of the standard input price.
- For kimi/kimi-k2.7-code-highspeed and kimi/kimi-k2.7-code, input tokens that hit the cache are billed at 20.0% of the standard input price.
- For kimi/kimi-k2.6, input tokens that hit the cache are billed at 16.9% of the standard input price.
Parameter default values
| Parameter | kimi/kimi-k3 | kimi/kimi-k2.7-code-highspeed | kimi/kimi-k2.7-code | kimi/kimi-k2.6 |
|---|---|---|---|---|
stream_options | The only supported value is true. | The only supported value is true. | The only supported value is true. | The only supported value is true. |
temperature | 1 | 1.0 | 1.0 | Thinking mode: 1.0Non-thinking mode: 0.6 |
top_p | 0.95 | 0.95 | 0.95 | Thinking mode/Non-thinking mode: 0.95 |
repetition_penalty | 0.0 | 0.0 | 0.0 | Thinking mode/Non-thinking mode: 0.0 |
presence_penalty | - | 0.0 | 0.0 | Thinking mode/Non-thinking mode: 0.0 |
tool_choice | auto / none / required | auto | auto | Thinking mode/Non-thinking mode: auto |
top_k | - | - | - | - |
preserve_thinking | Disabled by default | Enabled by default | Enabled by default | Disabled by default |
-
The
stream_optionsparameter supports only the valuetrue. The values for thetemperature,top_p,repetition_penalty, andpresence_penaltyparameters cannot be modified. -
kimi/kimi-k3 supports the
reasoning_effortparameter. The only supported value ismax. -
In thinking mode, when using Kimi models for tool calling: you must keep the
reasoning_contentfield in each assistant message; for thetool_choiceparameter,kimi-k3supportsauto/none/required(three options); other models do not supportrequiredand will return an error if it is passed.kimi-k3supports dynamic tool loading. For details, see: https://platform.kimi.com/docs/guide/use-dynamic-tool-loading. - A hyphen (-) indicates that the parameter has no default value and cannot be set.
Model list and billing
kimi/kimi-k3, kimi/kimi-k2.7-code-highspeed, and kimi/kimi-k2.7-code are thinking-only models (enable_thinking is always true and cannot be set to false). kimi/kimi-k2.6 is a hybrid thinking model. You can use the enable_thinking parameter to enable or disable the thinking mode. Note: The thinking_budget parameter cannot be used to limit the length of the chain-of-thought for any of these models.
For more information about model context length and pricing, see the Alibaba Cloud Model Studio console.
Billing is based on the number of input and output tokens for the model.
In thinking mode, the chain-of-thought is billed as output tokens.