Skip to content

Using in Third-Party Coding Agents

Kimi Code benefits support usage in mainstream Coding Agents — such as Claude Code, Roo Code, OpenCode, and more. It can also work with generic Agent frameworks like OpenClaw and Hermes, allowing you to freely call Kimi Code's AI capabilities in the tools you're already used to.

This document demonstrates the configuration methods for Claude Code and Roo Code.

Before You Start

  • Make sure you have subscribed to Kimi membership and activated Kimi Code benefits.
  • Obtain an API Key:
    1. Go to the Kimi Code Console;
    2. Click "Create API Key", enter a name and confirm;
    3. Copy the generated key and keep it safe (the full key cannot be viewed again after closing the dialog).

Kimi Code Console

Claude Code

Claude Code is a command-line programming assistant launched by Anthropic. By configuring environment variables to connect it to Kimi's API endpoint, you can directly call Kimi Code's AI capabilities within Claude Code and enjoy the Kimi Code programming experience in a familiar terminal interface.

Install Claude Code

For installation instructions, please refer to the Claude Code official documentation.

Run Script to Skip Login

After installation, do not start Claude directly. Execute the following script in the terminal first to skip Anthropic's default login flow:

sh
node --eval "
    const homeDir = os.homedir();
    const filePath = path.join(homeDir, '.claude.json');
    if (fs.existsSync(filePath)) {
        const content = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
        fs.writeFileSync(filePath, JSON.stringify({ ...content, hasCompletedOnboarding: true }, null, 2), 'utf-8');
    } else {
        fs.writeFileSync(filePath, JSON.stringify({ hasCompletedOnboarding: true }), 'utf-8');
    }"

Set Environment Variables and Start

sh
export ANTHROPIC_BASE_URL=https://api.kimi.com/coding/
export ANTHROPIC_API_KEY=Your API Key
export CLAUDE_CODE_AUTO_COMPACT_WINDOW=262144

claude
powershell
$env:ANTHROPIC_BASE_URL="https://api.kimi.com/coding/"
$env:ANTHROPIC_API_KEY="Your API Key"
$env:CLAUDE_CODE_AUTO_COMPACT_WINDOW="262144"

claude

If prompted whether to use this API key, confirm to proceed. Afterwards, follow the prompts to select your trusted project folder to complete the authorization.

Claude Code Authorize Project Access

Verify After Starting

After starting, enter /status. If the returned information shows Base URL as https://api.kimi.com/coding/, the configuration is successful. Even if the model name still appears as a Claude model, the actual calls are still made to the Kimi Code API.

Claude Code Status Check

Note: Use the keyboard shortcut to enable Thinking mode — Option+T on macOS, Alt+T on Windows and Linux.

Roo Code

Roo Code is an AI programming plugin for VS Code. By configuring the OpenAI Compatible protocol, you can call Kimi models within Roo Code to complete code generation, refactoring, and multi-file collaboration tasks.

Install Roo Code

Click Install Roo Code in VS Code.

Open Roo Code from the Sidebar

After installation, click the Roo Code icon (kangaroo) in the VS Code left activity bar to open the panel.

Roo Code Panel

Configure Kimi Code Model

Open the Roo Code panel and go to the Settings page:

  • New users: On first use, directly select "3rd-party Provider" to enter configuration.
  • Existing users: Open the Roo Code panel, go to Settings, and click the 「+」 next to Configuration Profile to add a new configuration.

Create Configuration

Fill in the model configuration information as follows:

Configuration ItemValueDescription
API ProviderOpenAI CompatibleSelect third-party compatible provider
Base URLhttps://api.kimi.com/coding/v1Kimi Code API endpoint
API KeyYour Kimi Code API KeyObtained from the console
Model IDkimi-for-codingUnified model identifier

Model Configuration

Set the remaining options as follows:

OptionValueDescription
Enable streamingEnable streaming output
Include max output tokensInclude max output token count
Enable Reasoning EffortMedium (Recommended)Reasoning intensity
Max Output Tokens32768Maximum output token count
Context Window Size262144Context window size
Image SupportSupport image processing

Max Output Tokens and Context Window Size are used to inform Roo Code of the model's capability range; leaving them blank may lead to truncated output or insufficient context.

Model Configuration Supplement

Switch Configuration (Existing Users)

After configuration, existing users need to switch to the newly saved Kimi Code configuration in the Roo Code panel.

Switch Configuration

Save the configuration and start a new session to use it.