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) | Files | Lines | Kimi tokens | Tokens per line | Share of 256K |
|---|---|---|---|---|---|
| Flask 3.0.3, `src/flask` | 24 | 9,024 | 73,011 | 8.09 | 27.9% |
| Requests 2.32.3, `src/requests` | 18 | 5,642 | 41,723 | 7.40 | 15.9% |
| Both packages together | 42 | 14,666 | 114,734 | 7.82 | 43.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.
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 tokens | Price |
|---|---|
| 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,000Why 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 2026 | Output tokens | Cost per turn, nothing cached | Cost per turn, code cached | 20-turn session |
|---|---|---|---|---|
| Narrow edit | 3,000 | $0.1098 | $0.0383 | $0.84 |
| Long rewrite | 20,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.
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.6 | Kimi K2.7 Code | GPT-5.5 | Claude Opus 4.8 |
|---|---|---|---|---|
| Kimi Code Bench v2 | 50.9 | 62.0 | 69.0 | 67.4 |
| Program Bench | 48.3 | 53.6 | 69.1 | 63.8 |
| MCP Atlas (tool use) | 69.4 | 76.0 | 79.4 | 81.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.