Kimi K2.7 Code
Kimi K2.7 Code is Moonshot AI's coding-focused agentic model with stronger coding and agent performance than Kimi K2.6, less overthinking, and a context window of 262.1K tokens, available through AI Gateway via moonshotai, deepinfra, fireworks, baseten.
import { streamText } from 'ai'
const result = streamText({ model: 'moonshotai/kimi-k2.7-code', prompt: 'Why is the sky blue?'})Playground
Try out Kimi K2.7 Code by Moonshot AI. Usage is billed to your team at API rates. Free users (those who haven't made a payment) get $5 of credits every 30 days.
Ask Kimi K2.7 Code anything to try it out.
Providers
Route requests across multiple providers. Copy a provider slug to set your preference. Visit the docs for more info. Using a provider means you agree to their terms, listed under Legal.
| Provider |
|---|
P50 throughput on live AI Gateway traffic, in tokens per second (TPS). Visit the docs for more info.
P50 time to first token (TTFT) on live AI Gateway traffic, in milliseconds. View the docs for more info.
Direct request success rate on AI Gateway and per-provider. Visit the docs for more info.
More models by Moonshot AI
| Model |
|---|
About Kimi K2.7 Code
Kimi K2.7 Code, released on June 12, 2026, is Moonshot AI's coding-focused successor to Kimi K2.6. Kimi K2.7 Code is a Mixture-of-Experts model with one trillion total parameters and 32 billion active per forward pass, published under a Modified MIT license. Moonshot AI tunes this release for three things: stronger coding and agent performance, more efficient reasoning, and better instruction following across long-horizon coding sessions.
The efficiency shift is concrete. Kimi K2.7 Code spends roughly 30% fewer thinking tokens than Kimi K2.6 on average, which Moonshot AI frames as less overthinking. On Moonshot AI's own benchmark suite, Kimi K2.7 Code scores 62.0 on Kimi Code Bench V2 against 50.9 for Kimi K2.6, and 81.1 on MCP Mark Verified against 72.8. Treat those as vendor-reported numbers; they come from internal benchmarks without third-party verification at release.
Long-horizon execution is the other documented gain. Moonshot AI reports improved success on sequences exceeding 4,000 tool calls and runs lasting over 12 hours of continuous execution. The improvements generalize across Rust, Go, and Python, and across task types like frontend work, DevOps, and performance optimization. Reasoning stays on for every request: Kimi K2.7 Code always thinks before answering, and that mode can't be disabled.
Input is natively multimodal. Kimi K2.7 Code accepts images in formats like PNG, JPEG, WebP, and GIF, plus video in MP4, MOV, AVI, and others, with temporal analysis for video understanding. A coding agent can read a screenshot of a broken layout or a screen recording of a bug without a separate vision model in the pipeline.
Access Kimi K2.7 Code through AI Gateway by setting the model string to moonshotai/kimi-k2.7-code. Use the AI SDK or any supported interface like Chat Completions, Responses, or Messages, and AI Gateway routes across moonshotai, deepinfra, fireworks, baseten with automatic failover. If you want faster serving of the same weights, kimi-k2.7-code-highspeed runs this model on a higher-throughput tier.
Kimi K2.7 Code supports a context window of 262.1K tokens and completions up to 32.8K tokens per request. Pricing through AI Gateway is $0.74 per million input tokens and $3.5 per million output tokens, with cached input at $0.15 per million tokens.
What To Consider When Choosing a Provider
- Configuration: Kimi K2.7 Code always reasons before answering, and thinking mode can't be switched off. Budget output tokens for reasoning traces on top of the code Kimi K2.7 Code writes, and note the completion cap of 32.8K tokens per request. If deliberation never helps your workload, a non-thinking Kimi K2 variant avoids the reasoning overhead entirely.
- Zero Data Retention: AI Gateway supports Zero Data Retention for this model via direct gateway requests (BYOK is not included). To configure this, check the documentation.
- Authentication: AI Gateway authenticates requests using an API key or OIDC token. You do not need to manage provider credentials directly.
When to Use Kimi K2.7 Code
Best For
- Long-horizon coding agents: Sessions that chain thousands of tool calls and keep executing for hours without losing the task thread
- Token-efficient reasoning: Coding workloads that benefit from thinking but paid too much reasoning overhead on earlier variants
- Multi-language engineering: Refactors, DevOps automation, and performance work across Rust, Go, and Python codebases
- Visual debugging inputs: Screenshots and screen recordings that feed directly into the coding loop without a separate vision model
Consider Alternatives When
- Faster serving of the same weights: Kimi K2.7 Code High Speed runs the identical model on a higher-throughput tier for latency-sensitive agents
- Optional thinking mode: A non-thinking Kimi K2 variant skips the always-on reasoning when deliberation adds cost without quality
- Work beyond code: Kimi K2.6 covers broader design-with-code and general multimodal workflows
- Visible reasoning traces: Kimi K2 Thinking emits full chain-of-thought for products that surface deliberation to users
Conclusion
Kimi K2.7 Code narrows the Kimi line's focus to agentic coding and spends its reasoning budget more carefully than Kimi K2.6 did. For coding agents that run long, call many tools, and need thinking without the overthinking tax, it's the variant to reach for.