Run Kimi K3 Inside Claude Code (MAX POWER)

Published
Jul 18, 2026
Duration
8:31
Click to load the YouTube player

Suggested for this guide

Kimi

Start with the current Kimi plan and confirm that it includes the model and coding access this guide needs.

Best for: Claude Code setups and cost-aware model work

Check Kimi plansPartner link. It supports Superbash Learn at no extra cost to you.

You can run Kimi K3 inside Claude Code by pointing Claude Code at Kimi’s Anthropic-compatible coding endpoint, assigning a Kimi model ID, and setting the matching context limit. Claude Code keeps responsibility for files, commands, subagents, and the coding workflow. Kimi K3 handles the model calls.

The configurations below come from Kimi’s official Claude Code documentation, checked August 6, 2026.

Start with 256K

Use k3-256k for ordinary coding sessions. Kimi recommends it for routine development because it offers K3 within a 256K context window while using less plan quota than the 1M option. Use "k3[1m]" only when your plan includes one-million-token context and the repository or session genuinely needs it.

Your situationClaude Code model valueContext limit
Routine coding, small or medium repository"k3-256k"262144
Large repository or unusually long session on Allegretto or above"k3[1m]"1048576
Kimi K2.7 Code on Andante"kimi-for-coding"262144

If you switch an existing session from 1M to 256K after it has grown beyond 256K, run compact first. Kimi also notes that k3-256k does not accept video input.

What you need

You need:

  • A Kimi membership with Kimi Code benefits enabled.
  • A Kimi Code API key from the Kimi Code Console.
  • macOS, Linux, or WSL for the shell commands below. Kimi’s official guide also provides PowerShell versions for Windows.
  • A project folder you are comfortable allowing an agent to read and modify.

When you create the API key, copy it immediately and store it in a password manager. Kimi does not show the full key again after the dialog closes. Never add the key to Git, a project .env file, a screenshot, or a shared shell script.

Install Claude Code

Claude Code’s current official documentation recommends the native installer on macOS, Linux, and WSL:

# Install Claude Code and confirm that the command is available.
curl -fsSL https://claude.ai/install.sh | bash
claude --version

If Claude Code is already installed, run claude --version and update it before continuing.

Do not start the login flow yet. Open Kimi’s official setup page and run its Run Script to Skip Login step first. That script enables third-party model support in ~/.claude.json and removes conflicting model mappings from ~/.claude/settings.json. Read the script before running it if you already have custom Claude Code settings.

Configure Kimi K3

Create an API key in the Kimi Code Console, then choose one configuration below. These exports apply only to the current terminal session, which is useful for testing without permanently saving the key.

K3 with 1M context

Use this block only if your Kimi plan includes K3 with a one-million-token context window. Replace Your API Key before pasting.

# Kimi K3 with 1M context in Claude Code.
export ANTHROPIC_BASE_URL=https://api.kimi.com/coding/
export ANTHROPIC_API_KEY="Your API Key"
export ANTHROPIC_MODEL="k3[1m]"
export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL
export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL
export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL
export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL
export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL
export CLAUDE_CODE_EFFORT_LEVEL=high

export CLAUDE_CODE_AUTO_COMPACT_WINDOW=1048576
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=1048576

claude

The quoted "k3[1m]" model name is specific to Claude Code environment variables. In API requests or another tool’s Model ID field, use k3 instead.

Use this block if your plan supports K3 but not the 1M context option.

# Kimi K3 with 256K context in Claude Code.
export ANTHROPIC_BASE_URL=https://api.kimi.com/coding/
export ANTHROPIC_API_KEY="Your API Key"
export ANTHROPIC_MODEL="k3-256k"
export ANTHROPIC_DEFAULT_FABLE_MODEL=$ANTHROPIC_MODEL
export ANTHROPIC_DEFAULT_OPUS_MODEL=$ANTHROPIC_MODEL
export ANTHROPIC_DEFAULT_SONNET_MODEL=$ANTHROPIC_MODEL
export ANTHROPIC_DEFAULT_HAIKU_MODEL=$ANTHROPIC_MODEL
export CLAUDE_CODE_SUBAGENT_MODEL=$ANTHROPIC_MODEL
export CLAUDE_CODE_EFFORT_LEVEL=high

export CLAUDE_CODE_AUTO_COMPACT_WINDOW=262144
export CLAUDE_CODE_MAX_CONTEXT_TOKENS=262144

claude

Kimi currently documents these plan-level model options:

Kimi accessModelsContext setting
Andantekimi-for-coding262,144
Moderatok3, k3-256k, or kimi-for-coding262,144
Allegretto and abovek3, k3-256k, kimi-for-coding, or kimi-for-coding-highspeedK3 can use 1M; k3-256k and K2.7 Code use 262,144

Plan names, benefits, and model access can change. Check the official page before setting up another machine.

Verify the connection

After Claude Code starts:

  1. Enter /status.
  2. Confirm the Base URL is https://api.kimi.com/coding/.
  3. Confirm the selected model and context match the block you used.
  4. Open the Kimi Code Console and check that the key shows recent activity.
  5. Test a small read-only task before allowing file edits or sub-agents.

Do not verify the setup by asking the model which model it is. Claude Code maps its internal model slots to Kimi, so the answer can show a Claude-family name even when requests are reaching Kimi. The Base URL in /status and activity in the Kimi console are the reliable checks.

Set the thinking effort

Run /effort inside Claude Code to change the reasoning level. Kimi’s current mapping is:

Claude Code settingK3 setting
lowlow
mediumhigh
highhigh
xhighmax
maxmax
Not sethigh

Keep thinking enabled when you want K3 or K2.7 Code. Kimi’s documentation says disabling thinking routes both model families to K2.6. Use high for normal repository work and reserve xhigh or max for genuinely difficult planning, refactoring, or debugging.

Troubleshooting

ProblemFix
Claude Code opens the Anthropic login flowRun Kimi’s login-bypass script before launching claude, then reopen the terminal.
/status shows the wrong Base URLRe-run the exports in the same shell and check for older values in ~/.claude/settings.json.
The API key is rejectedConfirm that it is a Kimi Code key, not an Anthropic key or a key from another Kimi product. Create a replacement if necessary.
K3 has the wrong context sizeUse "k3[1m]" with both values set to 1048576, or "k3-256k" with both values set to 262144. Do not mix the two blocks.
K3 consumes quota too quicklySwitch to "k3-256k" for routine work. Compact first if the current session is already larger than 256K.
The model appears to have changedCheck /status and the Kimi console instead of relying on the model’s self-identification.
A key was exposedRevoke it immediately in the Kimi Code Console and create a new key.

Run it safely on a VPS

A remote server lets Claude Code continue after your laptop is closed, but an unattended agent needs limits:

  • Give each loop one bounded unit of work.
  • Specify where output should be written.
  • Add a validation step and a clear stop condition.
  • Keep deployment, publishing, deletion, and payment actions behind human review.
  • Use a private network or VPN for remote access instead of exposing the agent terminal directly to the public internet.
  • Review Kimi usage in the console so a failed loop does not consume the plan unnoticed.

Start with one short run. Check the diff, logs, and final output before increasing the interval or leaving it overnight.

Common questions

Can Claude Code use Kimi K3 instead of a Claude model?

Yes. Claude Code supports an overridden API base URL, and Kimi provides an Anthropic-compatible endpoint for this integration. The Claude Code interface still supplies the agent tools; requests go to the Kimi Code API when /status shows https://api.kimi.com/coding/ as the Base URL.

Why does Claude Code still display a Claude model name?

Claude Code maps internal model slots to the Kimi model configured in your environment. The displayed family name is therefore not reliable proof of the provider. Check /status and recent activity in the Kimi Code Console instead.

Should I use Kimi K3 256K or 1M in Claude Code?

Start with k3-256k. Choose the 1M configuration for a repository or session that cannot fit comfortably inside 256K, and only when your Kimi membership includes that context window. Kimi says the 1M option consumes about twice as much quota as k3-256k.

Does this configuration permanently change Claude Code?

The export commands shown here affect only the current shell. Closing that terminal removes them. This makes the setup safer to test before you decide whether to store the values in a shell profile or Claude Code settings.

Official documentation