Developer Tools
12 min min read
AI Observer

Kimi Code Guide: How to Use Kimi K2.7 with Claude Code, Cline, and RooCode

If you are interested in Kimi K2.7, the most useful entry point is not ordinary chat. It is Kimi Code.

Kimi Code is Moonshot AI's developer workflow for coding tasks. It brings Kimi K2.7 Code into the terminal, IDE, CLI tools, and agentic programming environments. The official Kimi Code page shows the CLI powered by K2.7 Code, and the Kimi API documentation lists kimi-k2.7-code as the model ID for developers.

This guide explains how to use Kimi K2.7 and Kimi Code in practical developer setups.

What Is Kimi Code?

Kimi Code is the developer-facing coding workflow for Kimi.

It can be understood in three layers:

LayerRole
Kimi K2.7 CodeThe model for code generation, reasoning, long-context understanding, and agent tasks
Kimi CodeThe terminal, IDE, and CLI workflow powered by Kimi K2.7 Code
Claude Code, Cline, RooCodeThird-party coding tools that can connect to kimi-k2.7-code through Kimi API

So when people search "how to use Kimi Code", they are usually asking how to move Kimi K2.7 Code from a web answer into a real software project.

Quick Start with Kimi Code

The official installation command is:

curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash

After installation, use Kimi Code in your terminal to understand projects, generate code, explain errors, add tests, or run development tasks.

Good first tasks include:

  • explain the structure of a new repository;
  • find where a bug is likely to happen;
  • write unit tests for a function;
  • convert a component into a responsive layout;
  • analyze an error log and suggest a fix.

Do not start with "refactor the whole project." Begin with a small, well-bounded task so you can evaluate both quality and cost.

The Kimi K2.7 Code Model ID

For API and third-party tools, the model ID is:

kimi-k2.7-code

Kimi K2.7 Code supports a 256K context window, text/image/video input, thinking mode, chat tasks, and agent tasks. Thinking mode cannot be disabled.

Use Kimi K2.7 Code in Claude Code

The official integration path uses an Anthropic-compatible endpoint:

export ANTHROPIC_BASE_URL=https://api.moonshot.cn/anthropic
export ANTHROPIC_AUTH_TOKEN=${YOUR_MOONSHOT_API_KEY}
export ANTHROPIC_MODEL=kimi-k2.7-code
export ANTHROPIC_DEFAULT_OPUS_MODEL=kimi-k2.7-code
export ANTHROPIC_DEFAULT_SONNET_MODEL=kimi-k2.7-code
export ANTHROPIC_DEFAULT_HAIKU_MODEL=kimi-k2.7-code
export CLAUDE_CODE_SUBAGENT_MODEL=kimi-k2.7-code
export ENABLE_TOOL_SEARCH=false
export CLAUDE_CODE_AUTO_COMPACT_WINDOW=262144
claude

Then run:

/status

to confirm that Claude Code is using kimi-k2.7-code.

Claude Code plus Kimi K2.7 Code is best for multi-file feature work, bug fixing, test-failure analysis, dependency upgrades, codebase Q&A, and agent tasks that need planning.

Use Kimi K2.7 Code in Cline

In Cline, use the Moonshot provider:

SettingRecommended value
API ProviderMoonshot
Moonshot Entrypointapi.moonshot.cn
API KeyYour Kimi platform API key
Modelkimi-k2.7-code
BrowserDisable browser tool usage

Start with a read-only prompt:

Read package.json and the src directory. Tell me the tech stack, entry files, route structure, and likely development commands. Do not modify code yet.

This confirms that the model can read context before it starts editing files.

Use Kimi K2.7 Code in RooCode

RooCode uses a similar configuration:

SettingRecommended value
API ProviderMoonshot
Moonshot Entrypointapi.moonshot.cn
API KeyYour Kimi platform API key
Modelkimi-k2.7-code
BrowserDisable browser tool usage

RooCode is useful for iterative engineering work, especially tasks where the agent reads test output, edits code, and tries again. Because this can create many calls, set a daily budget in the Kimi platform.

Use Kimi K2.7 Code with the OpenAI SDK

Kimi API is compatible with the OpenAI SDK:

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_MOONSHOT_API_KEY",
    base_url="https://api.moonshot.cn/v1",
)

completion = client.chat.completions.create(
    model="kimi-k2.7-code",
    messages=[
        {
            "role": "system",
            "content": "You are a careful senior software engineer. Give executable and verifiable coding advice.",
        },
        {
            "role": "user",
            "content": "Explain how this Next.js project should organize i18n routing.",
        },
    ],
)

print(completion.choices[0].message.content)

Good product features to build with this API include code explanation, error diagnosis, and small code generation tools.

Cost Control for Kimi Code

Kimi K2.7 Code is powerful, but agentic programming can consume tokens quickly.

Billing itemPrice
Cache hit¥1.30 / MTok
Input¥6.50 / MTok
Output¥27.00 / MTok

To control cost:

  • set a daily project budget;
  • enable balance alerts;
  • ask for analysis before editing;
  • make the task boundary explicit;
  • monitor long-running agent jobs;
  • reuse project context when caching helps.

Prompt Templates for Kimi K2.7 Code

Codebase Understanding

Read the project structure and key configuration files. Return:
1. tech stack
2. main entry files
3. routing or module organization
4. local development commands
5. engineering constraints to be careful about

Do not modify code yet.

Bug Fixing

I will provide logs and related files. First analyze the root cause, list 2-3 likely explanations, and explain what you need to verify.
Do not edit code until the most likely cause is clear.
If changes are needed, keep them minimal and explain how to verify them.

Feature Work

Implement this feature with these constraints:
1. reuse existing components and helpers first
2. do not add dependencies unless necessary
3. follow existing code style
4. run the relevant test or build command
5. summarize changed files and verification results

FAQ

Is Kimi Code free?

The official page presents Kimi Code as part of Kimi membership benefits. Exact quota and plan details should be checked on the official page.

Which model powers Kimi Code?

The official Kimi Code page shows its CLI powered by K2.7 Code. The API model ID is kimi-k2.7-code.

Can Kimi K2.7 Code be used with Claude Code?

Yes. The official documentation provides the Anthropic-compatible endpoint https://api.moonshot.cn/anthropic.

Does Kimi K2.7 Code support Cline and RooCode?

Yes. Use the Moonshot provider, api.moonshot.cn, and the kimi-k2.7-code model.

Summary

Kimi Code is the most practical way to experience Kimi K2.7 Code. It brings long context, thinking mode, multimodal inputs, and agentic coding into the terminal, IDE, and automation workflows.

The real test is not whether Kimi K2.7 can answer coding questions. The real test is whether Kimi Code and Kimi K2.7 Code can understand a project, make useful changes, respond to tests, and stay within budget.

Related Articles

Kimi K2.7 Code is now available. This guide explains what Kimi K2.7 means for Kimi Code, 256K context coding, thinking mode, multimodal input, agent workflows, pricing, and developer adoption.
Moonshot AI has officially shipped Kimi K2.6, graduating the Code Preview branch into a general-availability model built for 12-hour autonomous coding sessions, 300-agent swarms, and full-stack generation. Here is what changed, what it means, and how to put it to work.
The interesting question about Kimi K2.6 is not what it does — it is what kind of model it is clearly being built to host. Treat the 12-hour runs, 300-agent swarms, and context compressor as load-bearing infrastructure, and the shape of K3 becomes visible.