A long tinted tray holding one purple-topped block and one outlined block, with empty space left in the tray, suggesting a codebase loaded into a long context window with room to spare.

Once your code repeats from turn to turn and bills at the cached rate, what the model writes decides the bill. In our worked example, a cached turn that rewrites files costs three times as much as a cached narrow edit.

How much of my repository fits in Kimi K2.7 Code's context, and what does one agent turn cost? We answer both with measured token counts and our list prices.

A code-specialised Kimi with a European region

Kimi K2.7 Code is an open-weight coding model from Moonshot AI, released on 12 June 2026. Moonshot built it on Kimi K2.6 for long software tasks. Moonshot's model card says it uses about 30% fewer thinking tokens than K2.6.

The model is a mixture of experts (MoE): each token runs through only part of the network. It has 1 trillion parameters, 32 billion active per token, under a modified MIT licence.

Lyceum is a sovereign European AI inference provider for open-source models. Our serverless models run in Paris and Finland, and the Kimi K2.7 Code model page lists its processing region as EU-hosted. We don't keep your prompts or outputs, and we never use them for training.

You call it through our OpenAI-compatible API. Only the base URL and the model ID change in your client:

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["LYCEUM_API_KEY"],
    base_url="https://api.lyceum.technology/openai/v1",
)
resp = client.chat.completions.create(
    model="moonshotai/kimi-k2.7-code",
    messages=[{"role": "user", "content": "Explain what this function does: ..."}],
    max_tokens=8000,
)
print(resp.choices[0].message.content)

What 256K of context holds in source code

A context window is the amount of text a model handles in one request. It covers the prompt and the reply together, as the vLLM documentation defines context length. For Kimi K2.7 Code it is 256K tokens, which Moonshot's tests run as 262,144 tokens.

Token counts depend on the tokenizer, the tool that cuts text into tokens. So we counted real code with the tokenizer file Moonshot publishes for this model, on 23 October 2026.

Codebase (Python files only)FilesLinesKimi tokensTokens per lineShare of 256K
Flask 3.0.3, `src/flask`249,02473,0118.0927.9%
Requests 2.32.3, `src/requests`185,64241,7237.4015.9%
Both packages together4214,666114,7347.8243.8%

At 7.4 to 8.1 tokens per line, a full window holds about 32,000 to 35,000 lines of Python. That is more than three times the Flask package. So a codebase the size of Flask fits in one prompt, with room left for instructions and the reply.

A horizontal bar for the 262,144-token window of Kimi K2.7 Code. Flask 3.0.3's source takes 73,011 tokens (27.9%), highlighted, and Requests 2.32.3 takes 41,723 more. A dashed bracket at the right end shows that a reply of up to 131,072 tokens still fits after both packages.
Flask's Python source takes 28% of Kimi K2.7 Code's 256K window in our count, and a full-length reply still fits after Flask and Requests together.

The reply needs room too, since one request can write up to 131,072 tokens. Other languages give other counts, so measure a sample of your own code.

Exact per-token pricing for input and output

We bill Kimi K2.7 Code per token, in US dollars, with no base fee. Rates from its model page, read on 23 October 2026:

Kimi K2.7 Code, USD per 1M tokensPrice
Input$1.25
Cached input$0.31
Output$4.50

Cached input is the part of a prompt whose start matches a recent request. We keep recent prompt starts in GPU memory until newer requests replace them. What stays there is the model's KV cache (key-value cache): its record of every token it has read. That record is large for each request, so reusing it saves real work. Prompt caching means billing a repeated start at the lower rate. It is automatic and best effort.

One request costs the sum of three parts:

cost = (fresh input tokens × 1.25 + cached input tokens × 0.31 + output tokens × 4.50) / 1,000,000

Why the output ratio decides agentic cost

A coding agent is a program that calls the model again and again. Every turn, it sends the instructions, your code and the conversation so far. On Kimi K2.7 Code, one output token costs as much as 3.6 fresh input tokens, or 14.5 cached ones.

Our worked example is hypothetical. An agent holds the Flask package (73,011 tokens) plus 3,000 tokens of instructions at the start of every prompt. Each turn adds 1,000 tokens of new text. One task needs a narrow edit with 3,000 output tokens. Another rewrites whole files and writes 20,000.

Calculated example, list prices of 23 October 2026Output tokensCost per turn, nothing cachedCost per turn, code cached20-turn session
Narrow edit3,000$0.1098$0.0383$0.84
Long rewrite20,000$0.1863$0.1148$2.37

The session column prices turn 1 without the cache and 19 turns with it. With the code cached, output is 35% of the narrow turn's cost and 78% of the rewrite's. The example favours caching: it assumes every later turn hits the cache and the prompt never grows. Real sessions grow, so turns cost a little more.

Stacked horizontal bars for four calculated agent turns, split into input and output cost. Narrow edit: $0.1098 with nothing cached, $0.0383 with the code cached. Long rewrite: $0.1863 with nothing cached, $0.1148 with the code cached, where output ($0.0900, highlighted) is 78% of the turn.
In this calculated example at our 23 October 2026 list prices, output is 78% of a cached rewrite turn and 35% of a cached narrow edit.

Thinking counts as output too. Reasoning is always on for Kimi K2.7 Code, and the reasoning trace (the text the model writes before its answer) bills at $4.50. Moonshot's lower thinking-token count helps here, but it is Moonshot's own figure.

Long outputs also take time. Our status checks over the seven days to 23 October 2026 show a median of 110 output tokens per second on short requests. At that speed, 3,000 tokens take about 27 seconds and 20,000 take about three minutes. A request may run for up to 300 seconds, so stream long outputs. Live latency is on our status page.

Where a general model still does better

Specialisation is not the same as winning everywhere. Moonshot's own model card, read on 23 October 2026, compares Kimi K2.7 Code with K2.6 and two closed models. All figures below are vendor-reported, not our measurements.

Benchmark (Moonshot's model card)Kimi K2.6Kimi K2.7 CodeGPT-5.5Claude Opus 4.8
Kimi Code Bench v250.962.069.067.4
Program Bench48.353.669.163.8
MCP Atlas (tool use)69.476.079.481.3

The card shows a clear gain over K2.6, and both closed models ahead on most rows. We would use Kimi K2.7 Code where cost per edit and EU processing matter, and keep a stronger model for the hardest planning steps.

Context size is the other limit. A repository larger than 256K tokens needs a model with a longer window. Kimi K3 reads up to 1M tokens, and our Kimi K3 API guide covers its price.

What this model's region claim covers

The EU-hosted label comes from Kimi K2.7 Code's own model page. Each model in our catalogue has its own processing region, so check the page of every model you plan to call. The label does not carry over to other Kimi models.

Processing in Europe is one part of a data protection review, not the whole of it. A request leaves only a usage record of organisation, user, model, token counts and time, never the prompt or the response.

Testing it on your own repository first

Pick 20 to 30 closed tasks from your own repository, such as merged pull requests with their tests. Run the agent on each and score two things: did the change apply, and did the tests pass? Our guide to testing open coding models on multi-file agentic edits sets up that harness.

Log the token usage of every run while you test. The cached share shows up in `usage.prompt_tokens_details.cached_tokens`, and the field is missing when the cache missed. The token counts give you a real cost per task. Our article on what coding agents cost per token in production explains how to budget from them.

Start with the model page, take its code sample and run your first task set.

Sources

  1. kimi.com
  2. huggingface.co
  3. docs.vllm.ai
  4. github.com
  5. github.com
  6. arxiv.org