K2.7 Code should be integrated with “always think + retain reasoning_content + automatic tool calling”; use the official fixed sampling values and avoid carrying over older models' disabled-thinking or custom-temperature configurations.
Suitable tasks: Multi-turn code Agents, long-context repository changes, visual/video input combined with tool calls, and complex debugging.
Unsuitable tasks: Interfaces that must disable thinking, depend on arbitrary temperature/top_p/n values, or require multiple candidate results.
Applicable model versions: kimi-k2.7-code; the high-speed variant is kimi-k2.7-code-highspeed.
Applicable client, Agent, or API: Kimi API's OpenAI-compatible interface, Kimi Code, and self-built Agents that support tool calling.
Recommended reasoning mode and parameters: Keep the defaults; thinking must be enabled, with temperature=1.0, top_p=0.95, n=1, and default max_tokens=32768; use only auto or none for tool_choice.
Task: [Code or repository task to complete]
Context: [Repository structure, relevant files, constraints, known reproduction steps]
Plan: First inspect the current state and list a short plan, then implement in stages.
Tools: Call tools only when they can advance the task; after each tool result, check the result and do not repeat ineffective calls.
Constraints: Do not modify unrelated files; retain reasoning_content; when a failure occurs, explain the cause and next step first.
Verification: Run focused tests at each stage, then summarize the changes, test results, and remaining risks.Point the OpenAI SDK at the Kimi API and set the model to kimi-k2.7-code.
In the first turn, provide the task, repository context, tool boundaries, and acceptance criteria.
When sending a tool call, retain the previous assistant's reasoning_content together with the tool call in the context.
Do not pass thinking: {type: "disabled"} or non-fixed sampling parameters; establish a baseline with the default configuration first.
Enable automatic caching for repeated context, and evaluate cost by input-cache hits, output tokens, tool-call rounds, and final test results.
Official documentation: The model supports 256K context, has thinking enabled by default, and returns an error if thinking is disabled.
Official fixed parameters: temperature 1.0, top_p 0.95, n 1, presence/frequency penalty 0; other values cause an error.
Multi-turn tool calls must retain the current turn's reasoning_content, otherwise an error is returned.
The official documentation lists API prices of $0.19/M for cache-hit input, $0.95/M for cache-miss input, and $4.00/M for output.
The parameter constraints come from the current Kimi API documentation; third-party hosts may provide different compatibility layers.
“Retain reasoning content” is an interface-context requirement, not a requirement to output the internal chain of thought as a user-visible artifact.
Long-horizon coding performance still depends on the harness's tool definitions, context compression, and test quality.
The official documentation explicitly states: “Kimi K2.7 Code does not support non-thinking mode.”
The official recommendation is to use the default parameters rather than configure these models' sampling fields manually.
Kimi K2.7 Code