# Kimi K2.7 Code API — pricing & specs

Kimi K2.7 Code accepts text, images and video for coding and tool workflows. Thinking stays enabled; this standard tier has its own price. On KeepRouter, Kimi K2.7 Code costs $0.9700 per 1M input tokens and $4.03 per 1M output tokens, billed pay-as-you-go with no monthly fee; actual request cost depends on measured token usage. Call it through a compatible KeepRouter endpoint supported by its active route, with the model id `kimi-k2.7-code`.

| Spec | Value |
|---|---|
| Maker | Moonshot AI |
| Modality | Text, vision, video |
| Context window | 262,144 tokens |
| Input price | $0.9700 per 1M tokens |
| Output price | $4.03 per 1M tokens |
| Cached input | $0.2000 per 1M tokens |
| Capabilities | Video input, Vision (image input), Chat completions, Streaming where supported, Tool calling where supported |
| Endpoint | POST /v1/chat/completions or POST /v1/messages (compatible chat routes) |
| Model id | `kimi-k2.7-code` |

## Call it via compatible chat endpoint

Use POST /v1/chat/completions or, on compatible chat routes, POST /v1/messages; streaming and tool support depend on the model's active route.

### cURL

```bash
curl https://keeprouter.com/v1/chat/completions \
  -H "Authorization: Bearer $KEEPROUTER_KEY" -H "Content-Type: application/json" \
  -d '{"model":"kimi-k2.7-code","messages":[{"role":"user","content":"Hello"}]}'
```

### Python

```python
import os
from openai import OpenAI
client = OpenAI(base_url="https://keeprouter.com/v1", api_key=os.environ["KEEPROUTER_KEY"])
r = client.chat.completions.create(model="kimi-k2.7-code", messages=[{"role":"user","content":"Hello"}])
```

### JavaScript

```js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://keeprouter.com/v1", apiKey: process.env.KEEPROUTER_KEY });
const r = await client.chat.completions.create({ model: "kimi-k2.7-code", messages: [{ role: "user", content: "Hello" }] });
```

## Estimate API costs

At the current KeepRouter customer price, an example workload of 1,000 total input tokens, no cached input, and 500 output tokens per request costs approximately $0.002985 per request. At 100 requests per day, that is $8.96 over 30 days. This is a usage estimate, excluding processing fees, taxes, retries and application infrastructure. Actual usage, cache hits and supported generation durations need their own checks.

[Adjust quantities in the API cost calculator](/tools/api-cost-calculator?model=kimi-k2.7-code).

## Model identity and official sources

Sources checked 2026-10-03.

### Model limits and thinking

Moonshot AI documents 262,144 context tokens and text, image and video input. Thinking remains enabled for this model; disabling it is not a supported mode. Leave enough output budget for reasoning and the final answer.

[Moonshot AI · exact model guide](https://platform.kimi.ai/docs/guide/kimi-k2-7-code-quickstart)

### Published prices and cache accounting

Use this page's live USD input, output and cached-input prices. Cached tokens are part of total prompt usage: subtract them from ordinary input before applying the separate cache rate. Standard Code and High-Speed are separate pricing IDs; do not substitute one ID's rates for the other.

[Moonshot AI · cache accounting](https://platform.kimi.com/docs/guide/context-caching) · [KeepRouter · model prices](https://keeprouter.com/models)

### Text request verified

On October 3, 2026, a bounded text request for this exact ID returned HTTP 200, text and final token usage through KeepRouter Chat Completions. This small check does not verify media input, long-context capacity, cache hits or every tool workflow.

[KeepRouter · Chat Completions reference](https://keeprouter.com/api/docs)

## How to evaluate Kimi K2.7 Code

Kimi K2.7 Code is listed on KeepRouter as text, vision, video under the exact id `kimi-k2.7-code`. Use /v1/chat/completions for the listed route; a maker's upstream features do not automatically apply to this gateway endpoint. The published context window is 262,144 tokens. These are limits, not a recommended request size.

**First workload:** Start with a text question plus one representative image, then repeat the same question with text only. Compare answer quality, latency and billed input/output tokens.

**Before production:** For agent use, test tool calls and structured output on this exact model route before production; an OpenAI-compatible chat endpoint alone does not prove either feature.

### Agent setup paths

### OpenCode

OpenCode documents a custom OpenAI-compatible provider. Set baseURL to https://keeprouter.com/v1 and list `kimi-k2.7-code` as a model; validate tool behavior on the exact route. [Official setup](https://opencode.ai/docs/providers).

```json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "keeprouter": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "KeepRouter",
      "options": {
        "baseURL": "https://keeprouter.com/v1",
        "apiKey": "{env:KEEPROUTER_API_KEY}"
      },
      "models": {
        "kimi-k2.7-code": {
          "name": "Kimi K2.7 Code"
        }
      }
    }
  }
}
```

### Continue

Continue documents provider: openai with a custom apiBase. Set apiBase to https://keeprouter.com/v1 and model to `kimi-k2.7-code`; validate the selected feature and endpoint. [Official setup](https://docs.continue.dev/customize/model-providers/top-level/openai).

```yaml
name: KeepRouter
version: 0.0.1
schema: v1
models:
  - name: Kimi K2.7 Code
    provider: openai
    model: kimi-k2.7-code
    apiBase: https://keeprouter.com/v1
    apiKey: <YOUR_KEEPROUTER_API_KEY>
```


These are documented configuration paths; model-specific tool, streaming and multimodal behavior still needs a real request test.

## Public model usage evidence

No public, exact-variant usage figure has been verified for this KeepRouter model id. Missing data is not zero usage; family-level or maker-wide traffic is not presented as this model's traffic.

## Published examples and cases

No exact-model customer case has been verified for this entry. The workload above is an evaluation recipe, not a claim of a public deployment.

## Source and verification boundary

[Official Kimi K2.7 Code documentation](https://platform.kimi.ai/docs/guide/kimi-k2-7-code-quickstart). KeepRouter's live catalog is authoritative for the customer price and enabled endpoint shown here; the maker remains authoritative for upstream model capabilities and limits.

## Pricing and implementation guides

- [Calculate your API workload cost](https://keeprouter.com/tools/api-cost-calculator)
- [KeepRouter API keys: move from free to paid models](https://keeprouter.com/blog/keeprouter-api-key-free-to-paid)

## Guides

- [Call Kimi K2.7 Code with the OpenAI SDK](https://keeprouter.com/use-cases/openai-sdk.md)

## Related models

- [Kimi K2.7 Code (High-Speed)](https://keeprouter.com/models/kimi-k2.7-code-highspeed.md) by Moonshot AI — $1.94 per 1M input tokens and $8.06 per 1M output tokens
- [Kimi K2.6](https://keeprouter.com/models/kimi-k2.6.md) by Moonshot AI — $0.9700 per 1M input tokens and $4.03 per 1M output tokens
- [Kimi K3](https://keeprouter.com/models/kimi-k3.md) by Moonshot AI — $5.97 per 1M input tokens and $14.92 per 1M output tokens
- [Grok 4.7](https://keeprouter.com/models/grok-4.7.md) by xAI — $4.00 per 1M input tokens and $12.00 per 1M output tokens
- [Magistral Medium](https://keeprouter.com/models/magistral-medium-latest.md) by Mistral AI — $2.00 per 1M input tokens and $5.00 per 1M output tokens
- [Grok 4.3](https://keeprouter.com/models/grok-4.3.md) by xAI — $1.25 per 1M input tokens and $2.50 per 1M output tokens

## More

- [All models & pricing](https://keeprouter.com/models.md)
- [Quickstart](https://keeprouter.com/docs/quickstart.md)
- [Get an API key](https://keeprouter.com/login?returnTo=%2Fconsole%2Fkeys%3Fmodel%3Dkimi-k2.7-code)

_Catalog facts and prices last changed 2026-10-03._
_Page content reviewed 2026-09-28._
