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 NameContext WindowProtocol
kimi-k3Up to 1M tokensOpenAI Chat Completions

Pricing

Billing is based on the token usage returned with the response:

TypeCredits / 1M tokensPrice / 1M tokens
Input600 credits$3.00
Output3000 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

FieldTypeRequiredDescription
modelstringYesMust be kimi-k3
messagesarrayYesConversation messages in chronological order
streambooleanNoStreaming is enabled by default; set to false for one JSON response
temperaturenumberNoSampling temperature, when supported
top_pnumberNoNucleus sampling value, when supported
max_tokensintegerNoMaximum generated tokens, when supported
stopstring or arrayNoStop sequence or sequences, when supported
toolsarrayNoOpenAI-compatible function definitions, passed through to the model service
tool_choicestring or objectNoTool selection policy, passed through to the model service
response_formatobjectNoStructured-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
}
FieldDescription
choices[].message.contentAssistant response text
choices[].finish_reasonWhy generation stopped, such as stop, length, or tool_calls
usage.prompt_tokensInput tokens used for billing
usage.completion_tokensOutput tokens used for billing
usage.total_tokensTotal tokens reported by the model service
credits_consumedCredits 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.