Kimi K3
Kimi K3 is available through the OpenAI-compatible /v1/chat/completions endpoint. The integration supports text conversations, streaming and non-streaming responses, multi-turn messages, and pass-through of compatible Chat Completions fields.
Model
| Model Name | Context Window | Protocol |
|---|---|---|
kimi-k3 | Up to 1M tokens | OpenAI Chat Completions |
Pricing
Billing is based on the token usage returned with the response:
| Type | Credits / 1M tokens | Price / 1M tokens |
|---|---|---|
| Input | 600 credits | $3.00 |
| Output | 3000 credits | $15.00 |
The billing formula is:
credits = prompt_tokens × 600 / 1,000,000
+ completion_tokens × 3000 / 1,000,000
The final charge is rounded to two decimal places. Failed requests are not charged.
Endpoint
POST https://api.aivideoapi.ai/v1/chat/completions
Create a Chat Completion
Set stream to false when you want one JSON response:
curl -X POST https://api.aivideoapi.ai/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k3",
"messages": [
{ "role": "user", "content": "Hello, who are you?" }
],
"stream": false
}'
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Must be kimi-k3 |
messages | array | Yes | Conversation messages in chronological order |
stream | boolean | No | Streaming is enabled by default; set to false for one JSON response |
temperature | number | No | Sampling temperature, when supported |
top_p | number | No | Nucleus sampling value, when supported |
max_tokens | integer | No | Maximum generated tokens, when supported |
stop | string or array | No | Stop sequence or sequences, when supported |
tools | array | No | OpenAI-compatible function definitions, passed through to the model service |
tool_choice | string or object | No | Tool selection policy, passed through to the model service |
response_format | object | No | Structured-output configuration, when supported |
Compatible extension fields are forwarded unchanged. Availability and accepted values for optional fields depend on the currently deployed model service.
Message Roles
Each message uses a standard Chat Completions role:
{
"messages": [
{ "role": "system", "content": "You are a concise assistant." },
{ "role": "user", "content": "Explain recursion in one sentence." },
{ "role": "assistant", "content": "Recursion solves a problem by applying the same method to a smaller version of it." },
{ "role": "user", "content": "Give me a short code example." }
]
}
Non-Streaming Response
{
"id": "chatcmpl-example",
"object": "chat.completion",
"created": 1788278400,
"model": "kimi-k3",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I am Kimi K3, an AI assistant ready to help with questions and tasks."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 23,
"completion_tokens": 60,
"total_tokens": 83
},
"credits_consumed": 0.19
}
| Field | Description |
|---|---|
choices[].message.content | Assistant response text |
choices[].finish_reason | Why generation stopped, such as stop, length, or tool_calls |
usage.prompt_tokens | Input tokens used for billing |
usage.completion_tokens | Output tokens used for billing |
usage.total_tokens | Total tokens reported by the model service |
credits_consumed | Credits charged by this platform |
Streaming
Streaming is the default when stream is omitted. You can also enable it explicitly:
curl -N -X POST https://api.aivideoapi.ai/v1/chat/completions \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k3",
"messages": [
{ "role": "user", "content": "Write a two-line welcome message." }
],
"stream": true
}'
The response uses Server-Sent Events:
data: {"id":"chatcmpl-example","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"Welcome"},"finish_reason":null}]}
data: {"id":"chatcmpl-example","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":18,"completion_tokens":12,"total_tokens":30}}
data: [DONE]
The platform requests usage in the final stream chunk automatically. Keep reading until [DONE] so the full response and final usage event are received.
OpenAI SDK
Python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AI_VIDEO_API_KEY"],
base_url="https://api.aivideoapi.ai/v1",
)
response = client.chat.completions.create(
model="kimi-k3",
messages=[{"role": "user", "content": "Hello, who are you?"}],
stream=False,
)
print(response.choices[0].message.content)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AI_VIDEO_API_KEY,
baseURL: "https://api.aivideoapi.ai/v1",
});
const response = await client.chat.completions.create({
model: "kimi-k3",
messages: [{ role: "user", content: "Hello, who are you?" }],
stream: false,
});
console.log(response.choices[0].message.content);
Usage and Error Handling
- Successful non-streaming responses must include
usage; otherwise the request fails without a charge. - If an upstream or network error happens before a response is delivered, no credits are charged.
- If a fully delivered stream omits usage, the platform does not estimate a charge; it completes at zero credits and records an internal billing anomaly.
- Public error responses contain a stable error code and a safe message without internal service details.