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.
moonshotai/kimi-k31M context, supports image inputmoonshotai/kimi-k2.6256K context, supports image inputmoonshotai/kimi-k2.7-codeFor codingKimi 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
Python
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
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.
Web search
Add web_search to tools on the Responses API, and the model searches on its own and attaches cited sources to its answer:
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.
outputcontainsreasoning,web_search_call, andmessageitems in that order, and the cited sources are in theannotationsof themessagecontent. - 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:
https://api.ofox.ai/anthropicmoonshotai/kimi-k2.7-codeWhen 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_urlcontent blocks; see Vision for the format. response_formatsupportsjson_schemaandjson_object; tool calling uses the standardtoolsparameter. 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
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.