Moonshot's Kimi K2.7 Code generates code with up to 256K context.
Model ID: kimi-k2.7-code · Type: chat · Provider: Moonshot
Endpoints: /v1/chat/completions · /v1/messages · /v1/responses
| Input (per 1M tokens) | $0.57 USD |
| Output (per 1M tokens) | $2.4 USD |
| Cache read (per 1M tokens) | $0.114 USD |
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["ROUTER_API_KEY"], base_url="https://api.router.ai/v1")
resp = client.chat.completions.create(
model="kimi-k2.7-code",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)Kimi K2.7 Code (`kimi-k2.7-code`) is billed per usage at $0.57/1M in · $2.4/1M out, in USD. Current pricing is always listed at https://www.token123.io/models/kimi-k2.7-code.
Send a request to https://api.router.ai/v1/chat/completions with the header `Authorization: Bearer <your API key>` and `"model": "kimi-k2.7-code"`. The API is OpenAI-compatible, so any OpenAI SDK works by changing base_url to https://api.router.ai/v1 — no other code change.
Kimi K2.7 Code can be called on: /v1/chat/completions; /v1/messages; /v1/responses.
Kimi K2.7 Code accepts up to 262,144 input tokens and can return up to 32,768 output tokens. Requests exceeding the input limit are rejected before reaching the model.
Kimi K2.7 Code supports: function_calling, prompt_caching, reasoning.
Kimi K2.7 Code is a chat model from Moonshot, available through the token123 gateway with the same API key as every other model.
Call it through the token123 OpenAI-compatible endpoint (API base: https://api.router.ai/v1). AI agents can browse the catalog and call any text model through MCP (https://mcp.router.ai/mcp); for image, video and other modalities use the API above.