TokenRa
中文Get API Key

Text model · Moonshot AI

Kimi K3 API

Kimi K3 is Moonshot AI's open-weight multimodal reasoning model, released on July 16, 2026, with a 1M-token context window, according to Moonshot. Thinking is always on and reasoning_effort sets its depth.

Model ID
kimi-k3
Context
1M tokens
Input
Text, image
Output
Text with reasoning

Capabilities

Capabilities & endpoints

Chat generation through three API formats. Each was called successfully on tokenra.io on 2026-10-23; pick one to switch the code examples.

POSThttps://tokenra.io/v1/chat/completionsTested
OpenAI SDK with base_url="https://tokenra.io/v1". Auth: Authorization: Bearer. Recommended.
POSThttps://tokenra.io/v1/responsesTested
OpenAI Responses API, same SDK and key. Text answer in output_text.
POSThttps://tokenra.io/v1/messagesTested
Anthropic SDK or Claude Code with base URL https://tokenra.io. Auth: x-api-key (or Bearer) plus anthropic-version.

Model IDs

Model IDNotes
kimi-k3Main ID. Everything on this page was tested with it.
kimi-k3-50offDiscounted ID on a separate channel. Differences measured: top_p other than 0.95 or a non-zero penalty returns HTTP 400, max_tokens and max_completion_tokens are ignored, and usage has no reasoning or cached token details.

Request

Request parameters

Fields for POST /v1/chat/completions. Everything listed was accepted by the model in testing.

ParameterTypeRequiredDescription
modelstringYesThe model ID to call, for example kimi-k3.
messagesarrayYesConversation messages in order (system, user, assistant, tool). For multi-turn chat, send the earlier turns back in this array. content can be a string or an array of text and image_url parts.
streambooleanNoReturn the answer as server-sent events. Default false.
stream_optionsobjectNoWith {"include_usage": true}, the last chunk carries usage and an empty choices array.
max_tokensintegerNoUpper limit for generated tokens. Reasoning tokens count toward it: if it is too low the model can spend it all on reasoning and return no text (finish_reason: "length").
max_completion_tokensintegerNoUpper limit for all generated tokens, reasoning included. If it is too low the answer can be empty (finish_reason: "length").
temperaturenumberNoSampling temperature.
response_formatobjectNo{"type": "json_object"} returns a JSON object. {"type": "json_schema", "json_schema": {...}} returns JSON that matches your schema (tested with strict: true).
toolsarrayNoFunction tools the model may call (type: "function").
tool_choicestring / objectNoauto, none, required, or a specific function.
parallel_tool_callsbooleanNoAllow several tool calls in one response.
reasoning_effortstringNoThinking depth: low, high or max. The vendor default is max.
userstringNoYour own end-user identifier for auditing or abuse handling. It is not part of the conversation.
Not supported by this model
  • Moonshot fixes top_p at 0.95 and both penalties at 0, so leave them out. kimi-k3 accepted other values in testing; kimi-k3-50off rejects them with HTTP 400, for example top_p must be 0.95.

Other formats

FormatRequired fieldsAnswer location
OpenAI Responsesmodel, inputoutput_text
Anthropic Messagesmodel, max_tokens, messagescontent[] blocks of type text

Response

Response format

Example response
{
  "id": "chatcmpl-1792766122484",
  "object": "chat.completion",
  "created": 1792766122,
  "model": "kimi-k3",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "An API gateway is the single entry point that receives client requests and routes them to the right backend service. It also handles shared concerns such as authentication, rate limiting and logging.",
        "reasoning_content": "The user wants two sentences about API gateways..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 26,
    "completion_tokens": 58,
    "total_tokens": 84,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 21
    }
  }
}
FieldTypeDescription
idstringCompletion ID. Include it when you contact support.
objectstringchat.completion, or chat.completion.chunk when streaming.
createdintegerUnix timestamp in seconds.
modelstringThe model that produced the answer.
choices[].message.contentstringThe answer text.
choices[].message.reasoning_contentstringThe model's reasoning, returned separately from the answer.
choices[].message.tool_callsarrayTool calls requested by the model, when tools were sent.
choices[].finish_reasonstringstop, length or tool_calls.
usageobjectprompt_tokens, completion_tokens, total_tokens, plus prompt_tokens_details.cached_tokens and completion_tokens_details.reasoning_tokens.

With stream: true the answer arrives as data: lines of chat.completion.chunk objects and ends with data: [DONE].

Errors

Errors & limits

Common errors

HTTPerror.codeMeaningWhat to do
401—Missing, wrong or deleted API key. The message is Invalid token.Check the Authorization: Bearer header and the key in the console.
400—The body is not valid JSON.Fix the JSON and send Content-Type: application/json.
500invalid_requestA required field is missing, for example messages.Add the field named in the message. Retrying will not help.
403insufficient_user_quotaYour balance or plan quota is used up.Top up in the console, then retry.
503model_not_foundUnknown model ID, or no channel serves it for your group.Check the ID in the model list or with GET /v1/models.
429—Too many requests.Back off exponentially and retry.
5xx—The upstream provider failed or timed out.Retry a few times; keep the request id if it persists.

Limits and notes

  • Image input was tested with an image_url part that points to a public HTTPS image.
  • Reasoning is returned in reasoning_content, separate from the answer in content. Keep it out of what you show users unless you want to display it.
  • A few requests in testing took about two minutes before the first byte. Use a client timeout of at least 180 seconds, or stream.