Kimi K2.7 Code API

Kimi K2.7 Code is Moonshot's trillion-parameter agentic coding model with 256K context, always-on reasoning, and text, image, and video inputs.

Moonshot AIText Generation256K contextProprietary EndpointNew

About Kimi K2.7 Code

Kimi K2.7 Code is Moonshot's trillion-parameter agentic coding model with 256K context, always-on reasoning, and text, image, and video inputs.

Supports text, image, and video inputs, function calling, JSON mode structured output, and built-in web search billed at $0.015 per invoked call. Thinking is always on and reasoning tokens are billed as output tokens. Temperature and other sampling overrides are ignored because the model service uses fixed sampling settings. Multi-step function calling must replay the assistant message with its reasoning_content field intact. Explicit cache controls, batches, and fine-tuning are not supported.

reasoningfunction callingstructured outputmultimodalagentic codingweb search

Kimi K2.7 Code specs

Model ID
kimi-k2-7-code
Provider
Moonshot AI
Category
Text Generation
Context window
256K tokens
Max output
131,072 tokens
Input
text, image, video
Output
text
Endpoints
POST /v1/chat/completions
POST /v1/responses
POST /v1/messages

Kimi K2.7 Code API pricing

Live pay-as-you-go rates from the EmpirioLabs catalog. You are billed only for what you use, with no monthly minimum.

Type
Spec
Rate
Input
per 1M prompt tokens
$0.95
Output
per 1M generated tokens
$4.00
Web search
per call when invoked
$0.015
Compare on the full pricing page

How to call the Kimi K2.7 Code API

Kimi K2.7 Code serves the OpenAI-compatible Chat Completions API. Point any OpenAI SDK at https://api.empiriolabs.ai/v1 with your EmpirioLabs API key and use the model id kimi-k2-7-code. Get an API key from the EmpirioLabs dashboard.

cURL
curl https://api.empiriolabs.ai/v1/chat/completions \
  -H "Authorization: Bearer $EMPIRIOLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k2-7-code",
    "messages": [
      {"role": "user", "content": "Write a haiku about the ocean."}
    ]
  }'
Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.empiriolabs.ai/v1",
    api_key="YOUR_EMPIRIOLABS_API_KEY",
)

response = client.chat.completions.create(
    model="kimi-k2-7-code",
    messages=[{"role": "user", "content": "Write a haiku about the ocean."}],
)
print(response.choices[0].message.content)
Full Kimi K2.7 Code API reference

Kimi K2.7 Code API parameters

Request parameters supported by the Kimi K2.7 Code API on EmpirioLabs. Defaults apply when a field is omitted.

ParameterTypeDefaultRange / valuesDescription
max_tokensnumber163841 to 131072Maximum output tokens. Reasoning tokens count toward this limit.
stopstring--Up to 4 strings where the model will stop generating further tokens.
response_formatobject--OpenAI-compatible JSON mode or JSON schema response format.
tool_web_searchbooleanfalse-Search the web for real-time information. Adds $0.015 to the request cost for each invoked web search call.

Good to know

Supports text, image, and video inputs with 256K context, function calling, JSON mode structured output, and built-in web search at $0.015 per invoked call. Thinking is always on and cannot be disabled; reasoning tokens are billed as output tokens. Temperature and other sampling overrides are ignored because the model service uses fixed sampling settings. Multi-step function calling through the API must replay the assistant message with its reasoning_content field intact.

Kimi K2.7 Code API: common questions

How much does the Kimi K2.7 Code API cost?

On EmpirioLabs, Kimi K2.7 Code is billed pay as you go: Input $0.95 per 1M prompt tokens; Output $4.00 per 1M generated tokens; Web search $0.015 per call when invoked. The live rate card on this page always matches what the API charges.

What is the context window of Kimi K2.7 Code?

Kimi K2.7 Code supports a 256K-token context window with up to 131,072 output tokens per response.

Is the Kimi K2.7 Code API OpenAI-compatible?

Yes. Kimi K2.7 Code serves the OpenAI-compatible Chat Completions API, so existing OpenAI SDKs work by pointing base_url at https://api.empiriolabs.ai/v1 and setting the model id to kimi-k2-7-code.

Can I try Kimi K2.7 Code in the browser before integrating?

Yes. The EmpirioLabs playground runs Kimi K2.7 Code in the browser with the same parameters the API exposes, so you can test prompts before writing code.

How do I get a Kimi K2.7 Code API key?

Create an EmpirioLabs account, then generate a key under API Keys in the dashboard. Billing is pay-as-you-go credits, so you only pay for the requests you make.

Ready to use better endpoints?

Explore our models, or contact us about business inquiries, custom deployments, or anything else.