Kimi K2.7 Code API 2026: Moonshot's New Coding Model, Benchmarks, Pricing, and CodeFast
Moonshot AI released Kimi K2.7 Code as both open source and an API. This guide covers its 256K context, preserve_thinking, MCP benchmarks, official pricing, and the current balance-based K2.7 Code access available through CodeFast.
· CodeFast Team
What is Kimi K2.7 Code?
Moonshot AI (Kimi) announced Kimi K2.7 Code on the morning of June 12, 2026 as both open source and API. The model is a coding-focused agentic model built on Kimi K2.6, optimized for long-horizon software engineering workflows, tool calling, MCP integrations, and end-to-end coding tasks rather than general chat. It was released on HuggingFace as `moonshotai/Kimi-K2.7-Code` and is available through the official API as `kimi-k2.7-code` on platform.moonshot.ai.
The announcement centers on three messages: (1) double-digit gains over K2.6 on coding and agent benchmarks, (2) roughly 30% lower thinking token usage — less overthinking, more efficient reasoning, and (3) improved instruction following and end-to-end success on long-horizon coding tasks. Moonshot also noted that a 6x High-Speed Mode is coming soon.
Kimi K2.7 Code snapshot - June 12, 2026
Model ID (API): kimi-k2.7-code
HuggingFace: moonshotai/Kimi-K2.7-Code
License: Modified MIT
Architecture: Mixture-of-Experts (MoE)
Total parameters: 1T | Activated: 32B
Layers: 61 (1 dense) | Experts: 384 (8 selected per token)
Context length: 256K (262,144 tokens in API)
Vision encoder: MoonViT (400M params)
Inputs: text, image, video
Modes: thinking (forced), preserve_thinking (forced)
Instant mode: not supported
Recommended: temperature 1.0, top_p 0.95
Inference engines: vLLM, SGLang, KTransformers
June 12, 2026 Kimi K2.7 Code technical snapshot
June 12, 2026 announcement highlights
- Open source: model weights and code repository released on HuggingFace under the Modified MIT License.
- Official API: access via `kimi-k2.7-code` model ID on platform.moonshot.ai and kimi.com/code.
- Benchmark gains over K2.6: Kimi Code Bench v2 +21.8%, Program Bench +11.0%, MLS Bench Lite +31.5%.
- Reasoning efficiency: roughly 30% lower thinking token usage compared with K2.6.
- Coming soon: 6x High-Speed Mode for faster inference.
Architecture and technical specs
Kimi K2.7 Code shares the same core architecture as K2.5/K2.6, meaning existing deployment guides can be reused directly. It runs as a Mixture-of-Experts (MoE) model with 1 trillion total parameters and 32 billion activated parameters per token. It offers a 256K context window with 61 layers (1 dense), 384 experts (8 selected per token), MLA (Multi-head Latent Attention), and a 160K vocabulary. Native INT4 quantization is also supported — an important cost advantage for self-hosting.
On the multimodal side, the MoonViT vision encoder (400M parameters) supports text, image, and video input. Video input is supported on the official API today; on third-party vLLM/SGLang deployments, video remains experimental. Thinking mode is mandatory and cannot be disabled; instant mode is not supported.
Benchmark results: coding and agentic performance
In Moonshot's official evaluations, K2.7 Code advances over K2.6 across all coding and agentic benchmark categories. Compared with closed models like GPT-5.5 and Claude Opus 4.8, there are still areas where it trails, but it is among the strongest candidates in the open-source ecosystem for coding-focused models.
Benchmark comparison - June 2026
K2.6 K2.7 Code GPT-5.5 Opus 4.8
--- Coding ---
Kimi Code Bench v2 50.9 62.0 69.0 67.4
Program Bench 48.3 53.6 69.1 63.8
MLS Bench Lite 26.7 35.1 35.5 42.8
--- Agentic ---
Kimi Claw 24/7 Bench 42.9 46.9 52.8 50.4
MCP Atlas 69.4 76.0 79.4 81.3
MCP Mark Verified 72.8 81.1 92.9 76.4
K2.7 Code vs K2.6 gains:
Kimi Code Bench v2: +21.8% | Program Bench: +11.0% | MLS Bench Lite: +31.5%
MCP Atlas: +9.5% | MCP Mark Verified: +11.4% | Kimi Claw 24/7: +9.3%
Official benchmark comparison (Moonshot AI, June 2026)
- Kimi Code Bench v2: in-house benchmark covering 10+ programming languages, production tech stacks, and real-world software engineering tasks.
- Program Bench: rebuilding programs from scratch using only a compiled binary and documentation — 200 tasks, 248,000+ fuzz tests.
- MCP Mark Verified: MCP tool-use evaluation across Notion, GitHub, Filesystem, Postgres, and Playwright environments.
Kimi K2.7 Code vs Kimi K2.6: what changed?
K2.7 Code is a shift from K2.6's general-purpose multimodal agent model to a coding-specialized variant. The same 1T MoE architecture and 256K context are preserved, but training and inference optimizations are directed at coding workflows. The most visible differences: thinking token efficiency, mandatory preserve_thinking, and the jump in MCP/agent benchmarks.
K2.7 Code vs K2.6 - June 12, 2026
Feature K2.6 K2.7 Code
Model ID kimi-k2.6 kimi-k2.7-code
Focus general multimodal coding-focused agentic
Thinking mode optional forced (always on)
Preserve thinking optional forced (always on)
Instant mode supported not supported
Thinking token usage baseline ~30% lower
Open source weights yes yes (new release)
Kimi Code CLI supported optimized (recommended)
Official input price $0.95 / 1M tokens $0.95 / 1M tokens
Official output price $4.00 / 1M tokens $4.00 / 1M tokens
K2.7 Code vs K2.6 comparison snapshot
Key features: preserve_thinking, interleaved thinking, and multimodal
K2.7 Code's most critical coding feature is mandatory `preserve_thinking` mode. This mode retains full reasoning content across multi-turn interactions and improves performance in coding agent scenarios. It cannot be disabled and is on by default. The Interleaved Thinking and Multi-Step Tool Call design is the same as K2 Thinking — the model can interleave thinking and tool calls.
- Preserve thinking: prior turn reasoning_content is stored in the assistant message; the model uses this context in the next turn.
- Interleaved thinking: thinking and tool call steps are interleaved for more coherent progress in long agent flows.
- Multimodal input: coding decisions with screenshots, design mockups, video demos, or documentation images.
- ToolCalls, JSON Mode, Partial Mode, and automatic context caching are supported on the official API.
Official API pricing
Kimi K2.7 Code official pricing matches K2.6: input $0.95/1M tokens (cache miss), $0.19/1M tokens (cache hit), output $4.00/1M tokens. Context window is 262,144 tokens. As a coding model, thinking tokens are also billed at output pricing — so the 30% thinking token reduction translates directly into cost savings.
Kimi K2.7 Code API pricing - June 12, 2026
Model: kimi-k2.7-code
Input (cache hit): $0.19 / 1M tokens
Input (cache miss): $0.95 / 1M tokens
Output: $4.00 / 1M tokens
Context window: 262,144 tokens
API base URL: https://api.moonshot.ai/v1
Platform: https://platform.moonshot.ai
Kimi Code CLI: https://www.kimi.com/code
Official Kimi K2.7 Code API pricing table
How to use the official API
K2.7 Code works with the OpenAI SDK-compatible API format. Because thinking mode is mandatory, the response includes a `reasoning` field. Temperature 1.0 and top_p 0.95 are recommended. For preserve thinking usage, add `reasoning_content` to the assistant message; otherwise multi-turn agent flows lose context.
import openai
client = openai.OpenAI(
api_key="your_moonshot_api_key",
base_url="https://api.moonshot.ai/v1"
)
response = client.chat.completions.create(
model="kimi-k2.7-code",
messages=[
{"role": "system", "content": "You are Kimi, a coding AI assistant."},
{"role": "user", "content": "Refactor this module to use async/await."}
],
max_tokens=4096,
temperature=1.0,
top_p=0.95
)
print(response.choices[0].message.reasoning) # thinking content
print(response.choices[0].message.content) # final answer
Kimi K2.7 Code OpenAI SDK example
Kimi Code CLI: the recommended agent framework
Moonshot explicitly states that K2.7 Code performs best with Kimi Code CLI. Available at kimi.com/code, this CLI provides an agent harness optimized for preserve_thinking, interleaved tool calls, and long-horizon coding tasks. If you use Cursor, Windsurf, or your own IDE integration, it also works through OpenAI-compatible endpoints; but the official recommendation is Kimi Code CLI.
Open source and self-hosting
K2.7 Code model weights were released on HuggingFace in Safetensors format (1.1T params, BF16/F32/I32). Both the code repository and model weights are usable under the Modified MIT License. vLLM, SGLang, or KTransformers are recommended for deployment; the K2.5/K2.6 deployment guide applies directly. Requires transformers >=4.57.1, <5.0.0. Native INT4 quantization can reduce inference cost.
- HuggingFace: moonshotai/Kimi-K2.7-Code
- GitHub: moonshotai/kimi-k2 (model family repository)
- Deployment guide: docs/deploy_guidance.md in the HuggingFace repo
Kimi K2.7 Code on CodeFast: current access
Kimi K2.7 Code is now available on CodeFast as a balance-based API package. Choose a balance from 50 TRY to 5000 TRY and use either chat/completions or Messages-compatible formats. The model ID is `kimi-k2.7-code`; input, output, cache-write, and cache-read tokens are deducted at the fixed CodeFast rate of $0.108 per 1M tokens.
Provider: CodeFast Kimi K2.7 Code API
OpenAI-compatible Base URL: https://api.codefast.app/kimi-k2-7-code-api/v1
Anthropic messages endpoint: https://api.codefast.app/kimi-k2-7-code-api/v1/messages
Model: kimi-k2.7-code
Balance: selectable from 50 TRY to 5000 TRY
CodeFast rate: $0.108 per 1M input, output, cache-write, or cache-read tokens
CodeFast Kimi K2.7 Code API — current endpoints
Who should use it?
The right frame for K2.7 Code is not a generic chat bot but a coding agent that produces technical work. It is designed for long refactors, multi-file migrations, MCP-based tool orchestration, rebuilding programs from binaries, and technical decision processes with multimodal input. For short classification or simple rewrite tasks, lighter models may be more economical.
Choose Kimi K2.7 Code when:
- The task spans many files, steps, or MCP tool calls
- You need preserve_thinking across multi-turn agent flows
- The prompt includes screenshots, video, or design context
- You want an open-source coding model with strong MCP benchmarks
- Token efficiency matters (30% lower thinking tokens vs K2.6)
Choose a lighter or free model when:
- The task is short classification or simple rewriting
- Instant, non-thinking responses matter more than long-horizon reasoning
- You want to prototype through the free NVIDIA API package first
- General chat is the primary use case
Practical selection logic
Conclusion: Kimi K2.7 Code leads the 2026 coding agent wave
Kimi K2.7 Code is a strong agent model for long coding tasks, with open weights, preserve_thinking, and improved MCP tool-use performance. CodeFast's balance-based package makes it available to OpenAI- and Anthropic-compatible clients with a selectable budget and transparent token pricing. Use the package page as the source of truth for current rates, model ID, and endpoints.