← All articles

Kimi K2.7-Code Is Now Available on TheRouter.ai

Moonshot AI's Kimi K2.7-Code brings a 256K-token context window, ~1T MoE architecture, and +21.8% coding benchmark gains over K2.6 — now accessible via a single API key on TheRouter.ai at $0.95/M input.

· TheRouter

Moonshot AI released Kimi K2.7-Code on June 12, 2026. It's a coding-focused MoE model with roughly one trillion total parameters (32 billion active), a 256,144-token context window, and measurably better benchmark scores than its predecessor — including a 30% reduction in reasoning token consumption that translates directly to lower per-task cost. It's available now on TheRouter.ai under the model ID moonshot/kimi-k2.7-code.

What Is Kimi K2.7-Code?

K2.7-Code is the third generation of Moonshot's coding-specialized Kimi K2 series. Like its predecessors, it uses a Mixture-of-Experts architecture: the full parameter count is ~1 trillion, but only 32 billion are active per forward pass. This gives the model frontier-level coding intelligence at inference costs closer to a mid-sized dense model.

Key specifications:

PropertyValue
ArchitectureMoE (~1T total / 32B active parameters)
Context window256,144 tokens
Release dateJune 12, 2026
LicenseModified MIT (open weights)
Weightsmoonshotai/Kimi-K2.7-Code on Hugging Face
AccessMoonshot direct API, TheRouter.ai

The 256K context window is a practical fit for large agentic coding workflows — reading an entire codebase, processing long tool call chains, or running multi-step software engineering tasks without chunking.

Benchmark Comparison: K2.5 → K2.6 → K2.7

The generation-over-generation gains are consistent across all three standard Kimi coding benchmarks:

BenchmarkKimi K2.5Kimi K2.6Kimi K2.7-CodeΔ K2.6 → K2.7
Kimi Code Bench v2—baseline+21.8%+21.8%
Program Bench—baseline+11.0%+11.0%
MLS Bench Lite—baseline+31.5%+31.5%

The MLS Bench Lite jump (+31.5%) is the most notable: this benchmark evaluates long-horizon software engineering tasks, which maps directly to agentic use cases where a model must plan and execute multi-file changes across many steps.

Token Efficiency: 30% Fewer Reasoning Tokens

Beyond raw benchmark scores, K2.7-Code produces approximately 30% fewer reasoning tokens than K2.6 to reach the same output quality. In practice, this means:

  • Lower per-task cost without sacrificing correctness — particularly valuable for agentic pipelines that iterate many times before producing a final diff.
  • Faster time-to-first-token on complex reasoning steps, since the model reaches its answer with less intermediate chain-of-thought.
  • More context budget available for actual code, tests, and tool results rather than internal reasoning traces.

If you've been routing coding tasks to K2.6 primarily for cost reasons, K2.7-Code's combination of higher accuracy and lower token overhead makes a compelling case to upgrade.

Practical Coding Use Cases

K2.7-Code is designed for the class of tasks where context length and sustained reasoning quality matter most:

Long-horizon agentic software engineering — multi-step tasks where the model must read existing code, plan changes across multiple files, write implementations, run tests, observe failures, and iterate. The 256K window lets the agent keep the full context (codebase, tool outputs, conversation history) in a single pass.

Large codebase comprehension — loading an entire module tree, a full test suite, or a large API spec and reasoning about it holistically before generating a response.

Code review with full context — ingesting a complete diff plus the surrounding codebase to produce a thorough, context-aware review rather than reviewing snippets in isolation.

Automated test generation — understanding the full implementation of a module before writing test cases, catching edge cases that isolated snippet-based test generation misses.

Migration and refactoring at scale — planning and executing multi-file refactors with awareness of the entire dependency graph.

Pricing on TheRouter.ai

Token typePrice per 1M tokens
Input$0.95
Output$4.00
Cache hit$0.19

The cache hit price at $0.19/M is significant for agentic workloads. When repeated agentic steps reference the same codebase prefix, prompt caching turns that fixed context cost into a 80% discount on subsequent reads — the 32B active parameter architecture keeps output generation costs reasonable even at long context lengths.

Quick Start via TheRouter.ai

TheRouter.ai provides a single OpenAI-compatible endpoint for all models. Swap in moonshot/kimi-k2.7-code with your existing API key — no additional setup required.

from openai import OpenAI

client = OpenAI(
    api_key="your-therouter-api-key",
    base_url="https://api.therouter.ai/v1",
)

response = client.chat.completions.create(
    model="moonshot/kimi-k2.7-code",
    messages=[
        {
            "role": "system",
            "content": (
                "You are an expert software engineer. "
                "Analyze the provided code, identify issues, and implement fixes."
            ),
        },
        {
            "role": "user",
            "content": "Review the following Python module and refactor it to use async/await throughout:\n\n[paste your code here]",
        },
    ],
    max_tokens=4096,
)

print(response.choices[0].message.content)

For agentic coding pipelines with long context, the 256K window means you can load the full codebase directly:

import pathlib

codebase = {}
for path in pathlib.Path("./src").rglob("*.py"):
    codebase[str(path)] = path.read_text()

context = "\n\n".join(
    f"# {filepath}\n```python\n{content}\n```"
    for filepath, content in codebase.items()
)

response = client.chat.completions.create(
    model="moonshot/kimi-k2.7-code",
    messages=[
        {"role": "system", "content": "You are a senior software architect."},
        {
            "role": "user",
            "content": f"Here is the complete codebase:\n\n{context}\n\nIdentify all circular dependencies and propose a restructuring plan.",
        },
    ],
    max_tokens=8192,
)

When to Use K2.7-Code vs Other Coding Models

K2.7-Code isn't the only capable coding model on TheRouter.ai. Here's how to think about the tradeoff:

Choose K2.7-Code when:

  • You need 256K+ context for large agentic tasks
  • You're already using K2.6 and want a cost/quality upgrade
  • Your workload is long-horizon software engineering (multi-file, multi-step)
  • You want open weights (run locally with the Hugging Face release)

Consider alternatives when:

  • You need the absolute lowest latency for short autocomplete tasks — a smaller, faster model may serve better
  • Your task is primarily instruction-following or non-coding reasoning — generalist models may outperform a coding-specialized one
  • You need vision or multimodal input — K2.7-Code is text-only

K2.7-Code slots into the same tier as other frontier coding specialists. It's a strong default for any Moonshot-based coding pipeline, and the 30% reasoning token reduction makes it unambiguously cheaper to run than K2.6 for equivalent work.


Kimi K2.7-Code is available now. Model ID: moonshot/kimi-k2.7-code. Full API reference is at api.therouter.ai.

Help & contact