Kimi K2.7 Code
AvailableKimi K2.7 Code is Moonshot AI’s coding model, built on Kimi K2.6.
Good for Coding agents · Hard reasoning · Images and screenshots
Is it right for you?
It is older than our current Kimi K3. Moonshot lists a 256K context window and input of text, images and video. Thinking is always on and cannot be turned off. Moonshot says it uses about 30% fewer thinking tokens than K2.6 and scores higher on its coding benchmarks. Pick it for long coding sessions if you tested it. For general writing and analysis, Moonshot recommends K2.6.
Best for
- Long coding sessions: refactors, multi-file features and long debugging.
- Coding agents that also read screenshots or video.
- Teams that want fewer thinking tokens than K2.6 on code tasks.
Not ideal for
- Quick answers: thinking cannot be turned off, so every reply includes thinking tokens.
- General writing and analysis: Moonshot recommends K2.6 for those.
- Strict tool control: with thinking on,
tool_choiceaccepts onlyautoornone.
What it costs
Prepaid, per token, no subscription. Set your traffic to see your bill.
30 days, at today's prices. You're billed on actual tokens.
- Per request
- $0.007366
- Coding session
- $0.39
- Per day
- $14.73
- Suggested key budget
- $510.00
- Alert at 80%
- $408.00
A coding session is 30 requests of 20,000 input tokens, 80% from cache, and 1,000 output tokens each: the same session as the "Per session" column above. Thinking tokens are billed as output, so reasoning raises the cost.
One price all day: this model has no peak pricing in our catalogue.
Capabilities
What Kimi K2.7 Code can do, as Moonshot AI lists it.
| Capability | Support |
|---|---|
| Tool calling | Yes, including multi-step calls |
| Parallel tool calls | Not listed |
| Reasoning | Always on: non-thinking mode is not supported |
| Reasoning effort | Not listed |
| Image input | Yes: images and video; images must be base64 |
| JSON output | Not mentioned |
| Streaming | Yes |
| Prompt caching | — |
Get started
Create a key in the console, export it as YUNSHU_API_KEY, then use one of these.
export ANTHROPIC_BASE_URL=https://api.yunshurouter.com
export ANTHROPIC_AUTH_TOKEN=$YUNSHU_API_KEY
export ANTHROPIC_MODEL=kimi-k2.7-codecurl https://api.yunshurouter.com/v1/chat/completions \
-H "Authorization: Bearer $YUNSHU_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k2.7-code",
"messages": [{"role": "user", "content": "Write a Python function that reverses a string."}]
}'curl https://api.yunshurouter.com/v1/messages \
-H "x-api-key: $YUNSHU_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k2.7-code",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Write a Python function that reverses a string."}]
}'import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.yunshurouter.com/v1",
api_key=os.environ["YUNSHU_API_KEY"],
)
response = client.chat.completions.create(
model="kimi-k2.7-code",
messages=[{"role": "user", "content": "Write a Python function that reverses a string."}],
)
print(response.choices[0].message.content)import os
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.yunshurouter.com", # no /v1: the SDK adds it
api_key=os.environ["YUNSHU_API_KEY"],
)
message = client.messages.create(
model="kimi-k2.7-code",
max_tokens=1024,
messages=[{"role": "user", "content": "Write a Python function that reverses a string."}],
)
print(message.content[0].text)Full steps for each tool: integration guides →
Questions
What is Kimi K2.7 Code?
Kimi K2.7 Code is a coding model from Moonshot AI. It is built on Kimi K2.6 and made for long-horizon coding and agent tasks.
Does Kimi K2.7 Code support tool calling?
Yes. Tool calling works in both the OpenAI format (tools) and the Anthropic format (tools with input_schema). Moonshot supports multi-step calls, and with thinking on, tool_choice accepts only auto or none.
Does Kimi K2.7 Code support reasoning?
Yes, and it is always on. Moonshot does not support a non-thinking mode for this model.
Should I use Kimi K2.7 Code or Kimi K3?
Use Kimi K3 for new work, because it is the current model. Moonshot’s pages do not compare the two. K2.7 Code is the coding-focused model from the K2 line.