Skip to main content

Kuma kimi-k3

POST 

/v1/chat/completions

Call Kimi K3 through the OpenAI-compatible Chat Completions API. Covers text chat, multimodal (image + text) understanding, and streaming.

Kimi K3 is Moonshot's next-generation model, with long-context understanding, multi-turn chat, and multimodal image understanding. This system forwards requests upstream with the OpenAI-compatible protocol, so you can use the official OpenAI SDK.

Use an API token issued by this system. Do not send upstream channel keys (such as a DashScope API Key) directly to the upstream endpoint.

The model name is always kimi-k3. Image inputs must be publicly reachable URLs. top_p must be in the (0, 1) range; values outside that range are normalized automatically.

Request​

Message format​

Plain-text message: content is a string.

{"role": "user", "content": "Who are you"}

Multimodal message: content is an array that can mix image_url and text. Do not serialize the array into a string and put that string in content.

{
"role": "user",
"content": [
{"type": "image_url", "image_url": {"url": "https://example.com/image.jpg"}},
{"type": "text", "text": "What is this"}
]
}

Request examples​

Text chat (streaming)​

curl -X POST "$BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k3",
"messages": [
{"role": "user", "content": "Who are you"}
],
"stream": true
}'

Multimodal understanding (image + text)​

curl -X POST "$BASE_URL/v1/chat/completions" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k3",
"messages": [
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {"url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"}
},
{"type": "text", "text": "What is this"}
]
}
]
}'

Python​

from openai import OpenAI

client = OpenAI(
base_url="https://open-api.fancyai.com/v1",
api_key="sk-your-system-token",
)

stream = client.chat.completions.create(
model="kimi-k3",
messages=[{"role": "user", "content": "Who are you"}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta
if delta.content:
print(delta.content, end="", flush=True)

resp = client.chat.completions.create(
model="kimi-k3",
messages=[
{
"role": "user",
"content": [
{
"type": "image_url",
"image_url": {
"url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/dog_and_girl.jpeg"
},
},
{"type": "text", "text": "What is this"},
],
}
],
)
print(resp.choices[0].message.content)

Responses​

Successfully generated a response

Streaming response (SSE)​

After you set "stream": true, the response is pushed as data: events until data: [DONE].

data: {"id":"chatcmpl-xxxxxxxx","object":"chat.completion.chunk","created":1737000000,"model":"kimi-k3","choices":[{"index":0,"delta":{"role":"assistant","content":"I"},"finish_reason":null}]}

data: {"id":"chatcmpl-xxxxxxxx","object":"chat.completion.chunk","created":1737000000,"model":"kimi-k3","choices":[{"index":0,"delta":{"content":" am"},"finish_reason":null}]}

data: {"id":"chatcmpl-xxxxxxxx","object":"chat.completion.chunk","created":1737000000,"model":"kimi-k3","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]

Billing​

  • Charged by actual token usage: prompt_tokens (input) and completion_tokens (output) are billed at their respective rates.
  • In multimodal requests, images are converted to input tokens and counted in prompt_tokens.
  • Streaming and non-streaming requests use the same billing rules.
  • Exact rates are shown on the in-system model pricing / billing rules page.

FAQ​

Q: Can I call the upstream DashScope API Key directly? A: No. Clients must use a token issued by this system and send requests to this system's BASE_URL. Upstream channel keys are only for system-to-upstream auth and must not be exposed or used by clients.

Q: Which input modalities are supported? A: Plain text, and mixed multimodal input of a public image URL plus text. Images must be publicly reachable URLs.

Q: How do I use streaming? A: Set "stream": true in the request body. The response is returned as SSE chunks until data: [DONE].

Q: I get InvalidParameter / top_p errors. What should I do? A: top_p must be in (0, 1). Values outside that range are normalized automatically. If the error persists, check that other parameters follow the OpenAI-compatible protocol.

Q: I get 401 / 403? A: Confirm you are using a token issued by this system, and that the token has permission to call kimi-k3 with enough quota.