Moonshot AI · kimi-k2.7-code
Kimi K2.7 Code API
Kimi's coding agent model. It follows instructions more reliably over long context and completes more coding tasks. On AnyAIGC it costs about 40% of the official price.
kimi-k2.7-code input $0.3847 per 1M tokens, output $1.5980 per 1M tokens, about half the price of K3.1 Pro. Works with the OpenAI-compatible API and in Claude Code.
- Model ID kimi-k2.7-code
- Context 256K tokens
- Input $0.3847 / 1M
- Concurrency Unlimited
- Business Self-service invoices
K2.6, further trained for coding
Moonshot AI calls Kimi K2.7 Code its strongest coding model so far. It is further trained from K2.6, follows instructions more reliably over long context, completes more coding tasks, and uses about 30% fewer thinking tokens than K2.6.
The architecture matches K2.6: MoE with 1T total and 32B active parameters, 8 of 384 experts per token, 256K context, and text and image input. K2.7 Code always thinks and supports interleaved thinking with multi-step tool calls, which suits coding agents.
On AnyAIGC, kimi-k2.7-code runs on the OpenAI-compatible /v1/chat/completions endpoint and works directly in Claude Code, with unlimited concurrency.
- Context window
- 262,144256K tokens
- Total parameters
- 1T32B active, MoE
- Input
- Text, imagesNative multimodal
- Thinking
- Always onNo non-thinking mode
- Recommended
- temperature 1.0top_p 0.95
- Weights
- OpenModified MIT license
What Kimi K2.7 Code can do
- 01
Higher coding success
Moonshot reports Kimi Code Bench v2 up from 50.9 on K2.6 to 62.0, and Program Bench up from 48.3 to 53.6.
- 02
Instruction following at length
Sticks to complex instructions across a 256K context and is less likely to drift in long sessions.
- 03
Fewer thinking tokens
Moonshot says it uses about 30% fewer thinking tokens than K2.6, so the same task costs less output.
- 04
Interleaved thinking with tools
Thinks between every tool call, which fits the run-tests, read-errors, fix-code loop. MCP Mark Verified 81.1.
- 05
Code from images
Accepts image input, so it can write and fix code from design files, screenshots or error screens.
- 06
Built for volume
Input $0.3847 and cache hit $0.0770 per 1M tokens. AnyAIGC does not cap concurrency, so many agents can run at once.
Kimi K2.7 Code API pricing
Pay per token at fixed rates, with no subscription or monthly fee. Input, output and cache hits all cost about 40% of Moonshot's official USD prices.
- Per tokenInput, output and cache priced separately
- About 60% offvs Moonshot official USD prices
- Unlimited concurrencyOn by default for every user
- USDOne balance for 300+ models
| Item | Model | AnyAIGC | Moonshot official | Savings |
|---|---|---|---|---|
| Inputper 1M tokens | kimi-k2.7-code | $0.3847 | $0.95 | 60% |
| Outputper 1M tokens, incl. thinking | kimi-k2.7-code | $1.5980 | $4.00 | 60% |
| Cache hitper 1M tokens | kimi-k2.7-code | $0.0770 | $0.19 | 59% |
Prices are in USD and billed on the tokens you actually use. Output includes thinking tokens, and repeated prompt prefixes are billed at the cache-hit rate automatically. Official prices come from the Kimi platform pricing page (USD). The table shows the lowest price in the model catalog; see the AnyAIGC model catalog for live pricing.
Cost examples
Estimates for common workloads. The struck-through figure is the same usage at Moonshot official prices.
-
50 coding agent turns
Each turn: 40K cache-hit tokens + 4,000 input + 2,000 output
$0.391
Official
$0.970 -
Review 100 PRs
Each PR: 20K input tokens + 2,000 output
$1.09
Official
$2.70 -
1M input + 1M output
1M input tokens + 1M output tokens
$1.98
Official
$4.95
Where it beats K2.6
K2.7 Code vs K2.6 scores published by Moonshot AI. It improves on every coding and tool-use task listed.
Kimi Code Bench v2 · coding
| Benchmark | K2.7 Code | K2.6 |
|---|---|---|
| Kimi Code Bench v2Coding | 62.0 | 50.9 |
| Program BenchCoding | 53.6 | 48.3 |
| MLS Bench LiteML engineering | 35.1 | 26.7 |
| Kimi Claw 24/7Long-running agent | 46.9 | 42.9 |
| MCP AtlasTool use | 76.0 | 69.4 |
| MCP Mark VerifiedTool use | 81.1 | 72.8 |
Source: the Kimi K2.7 Code model card on Hugging Face.
Kimi K2.7 Code vs K2.6 vs K3
Use K2.7 Code for coding, K2.6 when thinking should be off, and K3.1 Pro for large repos and the hardest tasks.
| Spec | K2.7 Code | K2.6 | K3.1 Pro |
|---|---|---|---|
| Role | Coding agent | General multimodal agent | Latest flagship |
| Context | 256K | 256K | 1M |
| Thinking | Always on | On or off | Always on |
| AnyAIGC inputper 1M tokens | $0.3847 | $0.3847 | $0.8100 |
| AnyAIGC outputper 1M tokens | $1.5980 | $1.5980 | $4.0500 |
| Cache hitper 1M tokens | $0.0770 | $0.0651 | $0.0810 |
Specs come from Moonshot AI's public materials. Prices are current AnyAIGC prices; see the model catalog for live pricing. More on the Kimi K3.1 Pro API.
Where Kimi K2.7 Code fits
- 01 · Claude Code
A coding partner in your terminal
Switch Claude Code to K2.7 Code to read code, fix bugs and write tests at about half the price of K3.1 Pro.
- 02 · CI
Auto-fix and code review
Review PRs, fix failing tests and write change summaries inside your pipeline. AnyAIGC does not cap concurrency, so large parallel batches work.
- 03 · Front end
Design files to components
Upload a design or page screenshot, generate React, Vue or plain HTML/CSS components, then iterate against the render.
- 04 · ML engineering
Experiment scripts and data work
About 31% higher than K2.6 on MLS Bench Lite. Good for training scripts, data cleaning and evaluation code.
Connect to the Kimi K2.7 Code API in three steps
- Sign up and add credit: create an account at anyaigc.ai. Top up from $1; your balance works across every model on the platform.
- Create an API key: create a key in the console, copy the value that starts with
sk-, and store it in theANYAIGC_API_KEYenvironment variable. - Send a request: call
POST https://anyaigc.ai/v1/chat/completionswithmodelset tokimi-k2.7-codeand anAuthorization: Bearerheader. With the OpenAI SDK, just setbase_urltohttps://anyaigc.ai/v1.
curl https://anyaigc.ai/v1/chat/completions \
-H "Authorization: Bearer $ANYAIGC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kimi-k2.7-code",
"messages": [
{"role": "user", "content": "Write an LRU cache in Python with unit tests."}
]
}'
import os
from openai import OpenAI
client = OpenAI(
base_url="https://anyaigc.ai/v1",
api_key=os.environ["ANYAIGC_API_KEY"],
)
resp = client.chat.completions.create(
model="kimi-k2.7-code",
messages=[
{"role": "system", "content": "You are a senior backend engineer. Answer with runnable code."},
{"role": "user", "content": "Write an HTTP client in Go with timeouts and retries."},
],
)
msg = resp.choices[0].message
print(getattr(msg, "reasoning_content", None)) # reasoning trace, if any
print(msg.content)
print(resp.usage)
import json
import os
from openai import OpenAI
client = OpenAI(base_url="https://anyaigc.ai/v1", api_key=os.environ["ANYAIGC_API_KEY"])
tools = [{
"type": "function",
"function": {
"name": "run_tests",
"description": "Run the unit tests at a path in the repo and return the failing cases",
"parameters": {
"type": "object",
"properties": {"path": {"type": "string", "description": "Test file or directory"}},
"required": ["path"],
},
},
}]
messages = [{"role": "user", "content": "Run tests/test_api.py and tell me which cases fail."}]
resp = client.chat.completions.create(model="kimi-k2.7-code", messages=messages, tools=tools)
msg = resp.choices[0].message
# In multi-turn and tool calls, send the full assistant message (incl. reasoning_content and tool_calls) back unchanged
messages.append(msg.model_dump(exclude_none=True))
for call in msg.tool_calls or []:
args = json.loads(call.function.arguments)
result = {"path": args["path"], "failed": ["test_login_timeout"]} # replace with the real result
messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(result)})
final = client.chat.completions.create(model="kimi-k2.7-code", messages=messages, tools=tools)
print(final.choices[0].message.content)
import os
from openai import OpenAI
client = OpenAI(base_url="https://anyaigc.ai/v1", api_key=os.environ["ANYAIGC_API_KEY"])
stream = client.chat.completions.create(
model="kimi-k2.7-code",
messages=[{"role": "user", "content": "Explain this regex: ^(?=.*\\d)(?=.*[a-z]).{8,}$"}],
stream=True,
)
for chunk in stream:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
# reasoning_content deltas arrive first, then the final answer in content
reasoning = getattr(delta, "reasoning_content", None)
if reasoning:
print(reasoning, end="", flush=True)
if delta.content:
print(delta.content, end="", flush=True)
print()
Tip: K2.7 Code always thinks, and the reasoning comes back in reasoning_content. Moonshot recommends temperature=1.0 and top_p=0.95. In multi-turn chats and tool calls, send the full assistant message from the API (including reasoning_content and tool_calls) back in the next request unchanged.
See the Chat Completions reference for every parameter. Replace the model name in the docs examples with the Kimi model ID you want.
Use Kimi K2.7 Code in Claude Code
Switch Claude Code to Kimi K2.7 Code. It is trained for coding and costs about half as much as K3.1 Pro.
- Install Claude Code: use the official installer (for example
npm install -g @anthropic-ai/claude-code). - Add the config: edit
~/.claude/settings.json, add the env block below, and replaceANTHROPIC_AUTH_TOKENwith the key you created on AnyAIGC. - Start coding: run
claudein your project folder. Type/modelto confirm the current model iskimi-k2.7-code.
{
"env": {
"ANTHROPIC_BASE_URL": "https://anyaigc.ai",
"ANTHROPIC_AUTH_TOKEN": "sk-your-API-key",
"ANTHROPIC_MODEL": "kimi-k2.7-code",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k2.7-code",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k2.7-code",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2.7-code",
"API_TIMEOUT_MS": "300000"
}
}
For large repos: K2.7 Code has a 256K context. If a project is too big to read in one go, switch the model in the config to kimi-k3.1-pro (1M context).
For the full walkthrough and common errors, see the Claude Code setup guide. Swap the model name in the guide for kimi-k2.7-code.
Kimi K2.7 Code API for teams and enterprises
Teams can top up, issue invoices themselves, and work with a dedicated support and technical contact.
- Invoices
Issue them yourself
Issue an invoice in the console for the amount you actually topped up, whenever you need one.
- Dedicated support
Account and technical contacts
Work with a dedicated support contact and technical engineer for onboarding, migration and troubleshooting.
- WeChat Pay
- Alipay
- USDT
- Credit card
Why teams trust AnyAIGC
Trial credit, top-ups, refunds, data handling and billing, spelled out up front.
5M free tokens to start
New accounts get trial credit, so you can test before you top up.
Top up from $1, refundable
Top up from $1. Unused balance can be refunded with no fee.
Official channels, real models
Requests go to official model channels, never cheaper or reverse-engineered substitutes.
No retention, no training
Unless the law requires it, your prompts and outputs are not persistently stored or used for training. See the privacy policy.
Transparent billing, spend caps
See tokens and cost for every request in the console, and set a quota on each API key.
24/7 support
Contact support any time about integration, billing or incidents.
Other Kimi models
One API key calls every Kimi model below. Pick by task difficulty and budget.
- Kimi overviewK3.1 Pro, K3, K2.7 Code and K2.6 pricing compared
- LatestKimi K3.1 ProFirst K3.1 series model, 1M context · input $0.8100 / 1M
- Kimi K32.8T-parameter open weights, 1M context · input $1.2150 / 1M
- CodingKimi K2.7 CodeCoding-tuned K2.6, always thinks · input $0.3847 / 1M
- Kimi K2.6General multimodal agent, thinking optional · input $0.3847 / 1M
Kimi K2.7 Code API FAQ
How much does the Kimi K2.7 Code API cost?
On AnyAIGC, kimi-k2.7-code is billed per token: input $0.3847 per 1M tokens, output $1.5980 per 1M tokens, cache hit $0.0770 per 1M tokens. Moonshot's official USD prices are input $0.95, output $4.00 and cache hit $0.19, so AnyAIGC is about 40% of official. Output includes thinking tokens. See the model catalog for live pricing.
What is the Kimi K2.7 Code model ID, and how large is the context?
The model ID is kimi-k2.7-code. Moonshot lists a 262,144-token (256K) context window, with text and image input.
How is Kimi K2.7 Code different from K2.6?
K2.7 Code is further trained from K2.6 with a focus on coding, on the same architecture (1T total, 32B active parameters). Moonshot says it follows instructions more reliably over long context, completes more coding tasks, and uses about 30% fewer thinking tokens than K2.6; Kimi Code Bench v2 goes from 50.9 to 62.0. K2.7 Code only runs in thinking mode, while K2.6 can turn thinking off. Both have the same input and output prices on AnyAIGC.
Can I turn off thinking in Kimi K2.7 Code?
No. Moonshot says K2.7 Code always runs with thinking and preserve thinking on, and does not support non-thinking mode. For fast, non-thinking responses, use kimi-k2.6. Moonshot recommends temperature=1.0 and top_p=0.95.
Does Kimi K2.7 Code support tool calls?
Yes. K2.7 Code supports interleaved thinking and multi-step tool calls, which suits coding agents. In multi-turn chats and tool calls, send the full assistant message (including reasoning_content and tool_calls) back in the next request unchanged.
Can I use Kimi K2.7 Code in Claude Code?
Yes. In the env block of ~/.claude/settings.json, set ANTHROPIC_BASE_URL to https://anyaigc.ai, ANTHROPIC_AUTH_TOKEN to your API key, and ANTHROPIC_MODEL to kimi-k2.7-code. Then run claude.
Kimi K2.7 Code or Kimi K3.1 Pro: which should I use?
K2.7 Code is a 1T-parameter coding model with 256K context at $0.3847 input and $1.5980 output on AnyAIGC, suited to everyday coding and high-volume agent calls. Kimi K3.1 Pro is the newest 3T-class model with 1M context at $0.8100 input and $4.0500 output, suited to large repos and the hardest tasks. Both use the same key.
Are there concurrency or rate limits?
AnyAIGC does not cap concurrency for kimi-k2.7-code, and every user gets this by default. That suits batch jobs, CI pipelines and parallel agents. Moonshot's own platform limits concurrency, RPM, TPM and TPD by top-up tier; those tiers do not apply when you call through AnyAIGC.
How do I get a Kimi K2.7 Code API key?
Sign up at anyaigc.ai, add credit, and create a key in the console. The same key works for every Kimi model and 300+ other models on the platform, so you do not need a separate Moonshot platform account.
Can I get an invoice from AnyAIGC?
Yes. You can issue invoices yourself in the console, for the amount you actually topped up.
Which payment methods are supported?
You can top up with WeChat Pay, Alipay, USDT or a credit card. Your balance is in USD and works across every model on the platform. Invoices can be issued in the console for the amount you topped up.
Is there free trial credit for new users?
Yes. New accounts get 5 million tokens of trial credit, so you can test before deciding to top up. Top-ups start at $1.
Can I get a refund on my balance?
Yes. Unused balance can be refunded with no fee. Contact support to start a refund.
Are these the real models? Is my data safe?
Requests go to official model channels, never cheaper or reverse-engineered substitutes. Unless the law requires it, we do not persistently store your prompts or outputs or use them for training, and the console shows tokens and cost for every request.
Will my data be used for training?
No. Except where required by law, AnyAIGC does not persistently store your prompts or outputs and does not use them to train models. Requests are encrypted over HTTPS. See the AnyAIGC Privacy Policy. The model's own data policy is governed by Moonshot AI's official terms.
Run Kimi K2.7 Code at about 40% of the official price
Sign up, create an API key, and you can use kimi-k2.7-code in your code or Claude Code within minutes.