Skip to Content
ModelsKimi

Kimi family

Moonshot AI’s Kimi models, including Kimi K3, K2.6, and the coding-focused K2.7 Code. Called through the OpenAI-compatible API; the Anthropic native API is also supported, so they can be used in Claude Code.

Common tasks

Models

For the full model list and live prices, see the models page . Model IDs have the prefix moonshotai/, which can be omitted.

Common model IDs (copy them exactly)
Kimi K3moonshotai/kimi-k31M context, supports image input
Kimi K2.6moonshotai/kimi-k2.6256K context, supports image input
Kimi K2.7 Codemoonshotai/kimi-k2.7-codeFor coding

Kimi models are provided by Moonshot AI directly (moonshot), and some models also have providers such as Azure AI Foundry and Alibaba Cloud Model Studio; the provider is selected automatically by default. To specify one, see Provider routing.

Examples

kimi_basic.py
import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.chat.completions.create( model="moonshotai/kimi-k3", messages=[{"role": "user", "content": "Explain idempotency in one sentence."}], extra_body={"thinking": {"type": "disabled"}}, ) print(resp.choices[0].message.content)

Thinking mode

Key pointKimi has thinking on by default. When you do not need it, set the thinking type to disabled (except for K2.7 Code HighSpeed).
ModelDefaultTurning off thinking
Kimi K3, K2.6, K2.7 CodeOn"thinking": {"type": "disabled"}
Kimi K2.7 Code HighSpeedOnNot supported; passing disabled returns 400

Measured on the same math problem: Kimi K3 took about 30 seconds by default and about 3 seconds with thinking off; K2.6 used about 11,000 thinking tokens and took about 4.5 minutes by default, and about 40 seconds with thinking off. Thinking tokens are billed at the output rate, and their count is in usage.completion_tokens_details.reasoning_tokens.

Reading thinking content: in streaming responses it is in delta.reasoning_content; in non-streaming responses it is in message.reasoning_details, where you concatenate the text of each item in order.

Add web_search to tools on the Responses API, and the model searches on its own and attaches cited sources to its answer:

kimi_web_search.py
import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.responses.create( model="moonshotai/kimi-k3", tools=[{"type": "web_search"}], input="What is the latest stable version of Python?", ) print(resp.output_text) for item in resp.output: if item.type == "message": for part in item.content: for a in getattr(part, "annotations", None) or []: print("Source:", a.title, a.url)
  • Supported by Kimi K3 and K2.6 in our tests. output contains reasoning, web_search_call, and message items in that order, and the cited sources are in the annotations of the message content.
  • Searches are billed per call; for rates, see the model page .

Use in Claude Code

Kimi models support the Anthropic native API at https://api.ofox.ai/anthropic:

Claude Code configuration values
ANTHROPIC_BASE_URLhttps://api.ofox.ai/anthropic
ANTHROPIC_AUTH_TOKENPaste your OfoxAI API key
ANTHROPIC_MODELmoonshotai/kimi-k2.7-code

When called through the Anthropic API, thinking content is returned as thinking blocks. For the full Claude Code setup steps, see Claude Code setup.

Image input and structured output

  • Kimi K3 and K2.6 support image input using standard image_url content blocks; see Vision for the format.
  • response_format supports json_schema and json_object; tool calling uses the standard tools parameter. See Structured output for the format.
  • Repeated request prefixes are cached automatically; the hit count is in usage.prompt_tokens_details.cached_tokens.

Common errors

HTTP · typeError messageCauseFix
400 invalid_request_errorinvalid thinking: only type=enabled is allowed for this modelK2.7 Code HighSpeed does not support turning off thinkingRemove the thinking parameter, or switch to K2.7 Code
429 rate_limit_errorRate limit reached for the requested model. Please retry after a short delay.Too many requestsRetry later; see Rate limits
404 model_not_foundModel 'moonshotai/kimi-k9' not foundModel ID misspelled, or the moonshot/ prefix was usedThe prefix is moonshotai/; copy the model ID from this page
Request timeout—Thinking is on by default, and complex questions take longerTurn off thinking, use streaming, or set the client timeout to 600 seconds or more

For other general errors, see Error handling.

Official docs

FAQ

How do I write Kimi model IDs?

The standard form is moonshotai/kimi-k3; you can also omit the prefix and write kimi-k3. Writing moonshot/kimi-k3 returns 404.

How do I turn off thinking for Kimi?

Pass "thinking": {"type": "disabled"}; with the OpenAI SDK, put it in extra_body. K2.7 Code HighSpeed does not support turning it off, and passing it returns 400.

Can Kimi search the web?

Yes. Use the Responses API and add {"type": "web_search"} to tools; the answer will include cited sources. Supported by Kimi K3 and K2.6 in our tests.

Can Claude Code use Kimi?

Yes. Set ANTHROPIC_BASE_URL to https://api.ofox.ai/anthropic and set the model to moonshotai/kimi-k2.7-code or moonshotai/kimi-k3.

Why is Kimi K2.6 so slow?

K2.6 has thinking on by default, and complex questions may use more than ten thousand thinking tokens and take several minutes. Turn thinking off when you do not need it, or switch to Kimi K3.

Last updated on