Kimi K2.7 Code API 2026:Moonshot 新 coding 模型、基准测试、定价与 CodeFast
Moonshot AI 已将 Kimi K2.7 Code 作为开源模型和 API 发布。本文介绍 256K context、preserve_thinking、MCP 基准、官方定价,以及 CodeFast 当前提供的余额制 K2.7 Code 访问。
· CodeFast Team
什么是 Kimi K2.7 Code?
Moonshot AI(Kimi)于 2026 年 6 月 12 日上午发布 Kimi K2.7 Code,同时提供开源与 API。该模型是基于 Kimi K2.6 构建的 coding 导向 agentic 模型,针对长时间软件工程工作流、tool calling、MCP 集成和端到端 coding 任务优化,而非通用聊天。它在 HuggingFace 上以 `moonshotai/Kimi-K2.7-Code` 发布,并可通过 platform.moonshot.ai 的官方 API 以 `kimi-k2.7-code` 模型 ID 访问。
公告核心有三点:(1) 相较 K2.6,在 coding 与 agent 基准上实现两位数提升;(2) thinking token 使用约降低 30%——更少 overthinking、更高效 reasoning;(3) 在长 horizon coding 任务中提升 instruction following 与端到端成功率。Moonshot 还表示 6x High-Speed Mode 即将推出。
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
2026 年 6 月 12 日 Kimi K2.7 Code 技术摘要
2026 年 6 月 12 日发布公告要点
- 开源:模型权重与代码仓库以 Modified MIT 许可证在 HuggingFace 发布。
- 官方 API:通过 platform.moonshot.ai 与 kimi.com/code 以 `kimi-k2.7-code` 模型 ID 访问。
- 相较 K2.6 的基准提升:Kimi Code Bench v2 +21.8%、Program Bench +11.0%、MLS Bench Lite +31.5%。
- 推理效率:相较 K2.6,thinking token 使用约降低 30%。
- 即将推出:6x High-Speed Mode,更快推理模式。
架构与技术规格
Kimi K2.7 Code 与 K2.5/K2.6 共享相同核心架构,意味着现有部署指南可直接复用。它以 MoE(Mixture-of-Experts)运行,总参数 1T、每 token 激活 32B。提供 256K context window,61 层(1 dense)、384 experts(每 token 选 8 个)、MLA(Multi-head Latent Attention)与 160K vocabulary。还支持 native INT4 quantization——对 self-hosting 是重要的成本优势。
多模态方面,MoonViT vision encoder(400M 参数)支持 text、image 与 video input。video input 目前在官方 API 中可用;在第三方 vLLM/SGLang 部署中仍为实验性。Thinking mode 为强制且不可关闭;instant mode 不支持。
基准测试结果:coding 与 agentic 性能
在 Moonshot 官方评估中,K2.7 Code 相较 K2.6 在所有 coding 与 agentic 基准类别上均有提升。与 GPT-5.5、Claude Opus 4.8 等闭源模型相比仍有落后领域,但在开源生态的 coding 导向模型中已是最强候选之一。
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%
官方基准对比(Moonshot AI,2026 年 6 月)
- Kimi Code Bench v2:覆盖 10+ 编程语言、production tech stack 与真实软件工程任务的 in-house 基准。
- Program Bench:仅凭编译二进制与文档从零重建程序——200 个任务、248,000+ fuzz 测试。
- MCP Mark Verified:在 Notion、GitHub、Filesystem、Postgres 与 Playwright 环境中的 MCP tool-use 评估。
Kimi K2.7 Code vs Kimi K2.6:有何变化?
K2.7 Code 是从 K2.6 通用多模态 agent 模型向 coding 专用变体的转变。保留相同 1T MoE 架构与 256K context,但训练与推理优化面向 coding workflow。最显著差异:thinking token 效率、preserve_thinking 强制,以及 MCP/agent 基准的跃升。
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 对比摘要
核心特性:preserve_thinking、interleaved thinking 与 multimodal
K2.7 Code 最关键的 coding 特性是强制 `preserve_thinking` 模式。该模式在多轮交互中保留完整 reasoning 内容,并提升 coding agent 场景表现。不可关闭且默认开启。Interleaved Thinking 与 Multi-Step Tool Call 设计与 K2 Thinking 相同——模型可交错执行 thinking 与 tool calls。
- Preserve thinking:上一轮 reasoning_content 保存在 assistant 消息中;下一轮模型使用该上下文。
- Interleaved thinking:thinking 与 tool call 步骤交错;在长 agent 流程中更连贯推进。
- Multimodal input:结合截图、设计 mockup、视频 demo 或文档图像进行 coding 决策。
- 官方 API 支持 ToolCalls、JSON Mode、Partial Mode 与自动 context caching。
官方 API 定价
Kimi K2.7 Code 官方定价与 K2.6 同级:input $0.95/1M tokens(cache miss)、$0.19/1M tokens(cache hit)、output $4.00/1M tokens。Context window 为 262,144 tokens。作为 coding model,thinking tokens 也按 output 计费——因此 thinking token 降低 30% 直接转化为成本节省。
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
官方 Kimi K2.7 Code API 价格表
如何使用官方 API
K2.7 Code 使用 OpenAI SDK 兼容 API 格式。因 thinking mode 强制开启,响应包含 `reasoning` 字段。建议 temperature 1.0、top_p 0.95。使用 preserve thinking 时需在 assistant 消息中加入 `reasoning_content`,否则多轮 agent 流程会丢失上下文。
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 示例
Kimi Code CLI:推荐的 agent 框架
Moonshot 明确表示 K2.7 Code 在 Kimi Code CLI 下表现最佳。可通过 kimi.com/code 访问,该 CLI 提供针对 preserve_thinking、interleaved tool calls 与长 horizon coding 任务优化的 agent harness。若使用 Cursor、Windsurf 或自有 IDE 集成,也可通过 OpenAI-compatible endpoint 使用;但官方推荐 Kimi Code CLI。
开源与 self-hosting
K2.7 Code 模型权重以 Safetensors 格式在 HuggingFace 发布(1.1T params,BF16/F32/I32)。代码仓库与模型权重均可在 Modified MIT 许可证下使用。部署推荐 vLLM、SGLang 或 KTransformers;K2.5/K2.6 部署指南可直接套用。需要 transformers >=4.57.1, <5.0.0。Native INT4 quantization 可降低推理成本。
- HuggingFace:moonshotai/Kimi-K2.7-Code
- GitHub:moonshotai/kimi-k2(模型家族仓库)
- 部署指南:HuggingFace 仓库中的 docs/deploy_guidance.md
CodeFast 上的 Kimi K2.7 Code:当前访问方式
Kimi K2.7 Code 现已在 CodeFast 以余额制 API 套餐提供。可选择 50 TRY 到 5000 TRY 余额,并使用 chat/completions 或 Messages 兼容格式。模型 ID 为 `kimi-k2.7-code`;input、output、cache write 和 cache read 均按每 1M token $0.108 的 CodeFast 固定价格扣费。
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 — 当前端点
适合谁使用?
理解 K2.7 Code 的正确框架不是通用聊天机器人,而是产出技术工作的 coding agent。它面向长 refactor、多文件 migration、MCP 类 tool orchestration、从 binary 重建程序,以及含多模态输入的技术决策流程。短分类或简单 rewrite 任务可能更适合更轻量模型。
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
实用选择逻辑
结论:Kimi K2.7 Code 引领 2026 coding agent 浪潮
Kimi K2.7 Code 具备开放权重、preserve_thinking、较强 MCP tool-use 表现,并专注长时间编码任务。CodeFast 的余额制套餐让 OpenAI 与 Anthropic 兼容客户端可按可选预算和透明 token 价格使用该模型。当前价格、模型 ID 和端点请以套餐页面为准。