Kimi K2.7 Code · configuration
The official Claude Code guide focuses on endpoint mapping, model aliases, and a controlled coding session.
Claude Code, a Moonshot-compatible endpoint, model mapping, and an isolated repository.
Pin the model version, inputs, and tool permissions; save returns, errors, and acceptance evidence after each round.
Deliver the artifact for “Kimi K2.7 Code: Official Claude Code Integration & Multi-Tier Model Mapping” and list assumptions not confirmed by the source or inputs.
Run the actual checks and record format, critical paths, tool state, and failed items.
Reproduce the smallest failing case, narrow the input, or fix configuration; do not treat model self-report as evidence.
The official Claude Code guide focuses on endpoint mapping, model aliases, and a controlled coding session.
Forwarding Claude Code requests to Kimi's Anthropic-compatible endpoint requires explicitly keeping Thinking enabled (Tab key), setting the auto-compact window to 256K (262144), and fully mapping all Opus/Sonnet/Haiku/Fable/Subagent tier aliases.
Suitable tasks: Repository-level coding, multi-file refactoring, test execution, and subagent orchestration in Claude Code CLI.
Unsuitable tasks: Zero-thinking fast generation, single prompt dumps exceeding 256K context, partial configurations missing Haiku/Subagent variables.
Applicable model versions: kimi-k2.7-code (Standard), kimi-k2.7-code-highspeed (~180–260 tokens/s).
Applicable clients/APIs: @anthropic-ai/claude-code CLI, Kimi Anthropic-compatible API endpoint (https://api.moonshot.ai/anthropic).
Recommended inference parameters: CLAUDE_CODE_EFFORT_LEVEL="max", CLAUDE_CODE_AUTO_COMPACT_WINDOW="262144", Thinking enabled.
export ANTHROPIC_BASE_URL="https://api.moonshot.ai/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 ANTHROPIC_DEFAULT_FABLE_MODEL="kimi-k2.7-code"
export CLAUDE_CODE_SUBAGENT_MODEL="kimi-k2.7-code"
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="262144"
export CLAUDE_CODE_EFFORT_LEVEL="max"
claude$env:ANTHROPIC_BASE_URL="https://api.moonshot.ai/anthropic";
$env:ANTHROPIC_AUTH_TOKEN="YOUR_MOONSHOT_API_KEY";
$env:ANTHROPIC_MODEL="kimi-k2.7-code";
$env:ANTHROPIC_DEFAULT_OPUS_MODEL="kimi-k2.7-code";
$env:ANTHROPIC_DEFAULT_SONNET_MODEL="kimi-k2.7-code";
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL="kimi-k2.7-code";
$env:ANTHROPIC_DEFAULT_FABLE_MODEL="kimi-k2.7-code";
$env:CLAUDE_CODE_SUBAGENT_MODEL="kimi-k2.7-code";
$env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="262144";
$env:CLAUDE_CODE_EFFORT_LEVEL="max";
claude~/.claude/settings.json){
"env": {
"ANTHROPIC_BASE_URL": "https://api.moonshot.ai/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_MOONSHOT_API_KEY",
"ANTHROPIC_MODEL": "kimi-k2.7-code",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k2.7-code",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k2.7-code",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2.7-code",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "kimi-k2.7-code",
"CLAUDE_CODE_SUBAGENT_MODEL": "kimi-k2.7-code",
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "262144",
"CLAUDE_CODE_EFFORT_LEVEL": "max"
}
}Install Claude Code: npm install -g @anthropic-ai/claude-code.
Obtain an API Key from Kimi API Platform (platform.kimi.ai).
Set environment variables or update ~/.claude/settings.json.
Run claude and execute /status to verify:
Base URL displays https://api.moonshot.ai/anthropic
Model displays kimi-k2.7-code
Press Tab in Claude Code to ensure the "Thinking on" indicator is active.
Submit a test instruction (e.g. summarize directory structure and package.json) to confirm tool execution.
Multi-tier model fallback: Claude Code uses Haiku for background summaries and Opus/Sonnet for complex tasks. Omitting tier variables causes silent 404/auth failures.
Compaction window matching: K2.7 Code has a 256K window (262144). Setting 1M causes context overflow errors; setting too low causes premature context loss.
Thinking requirement: kimi-k2.7-code rejects non-thinking requests with HTTP 400 (invalid thinking: only type=enabled is allowed).
Requires Kimi's Anthropic compatibility endpoint; unofficial wrappers must support reasoning token propagation.
/model menu in Claude Code is hardcoded and will not list Kimi aliases; verify via /status.
Kimi API Platform Documentation · Source date: Not disclosed · Edited: 2026-09-20
Read the original sourceKimi K2.7 Code
Run this guide in the environment listed above. Downloading does not transfer the template or establish model availability for your account.