Skip to content

Kimi Code Setup ​

Kimi Code CLI (kimi-cli) is Moonshot AI's terminal coding agent with shell execution, codebase search, and MCP support. Because RKAPI exposes both OpenAI-compatible and Anthropic-compatible endpoints under a single API key, you can connect Kimi Code CLI to kimi-k2.5 or any other model enabled on your account.

Match the Base URL to Your Chosen Protocol

  • OpenAI-compatible provider: https://api.zwwbai.com/v1
  • Anthropic-compatible provider: https://api.zwwbai.com (no /v1)
  • Never point Kimi Code to the web console domain https://s2pbxm0xv5y.adtyai-fz.top (returns HTTP 403).

Prerequisites ​

  1. Python 3.12+ or uv (recommended for isolated CLI installation).
  2. An RKAPI API Key (sk-...) created at https://s2pbxm0xv5y.adtyai-fz.top under API Tokens.
  3. Verify the exact live model IDs available in your token's group on https://s2pbxm0xv5y.adtyai-fz.top/pricing (for example kimi-k2.5 or other supported coding models).

1. Install Kimi Code CLI ​

Install uv first if you do not already have it:

bash
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Then install kimi-cli as an isolated global tool:

bash
uv tool install --python 3.13 kimi-cli

Option B: Using pip / pipx ​

bash
pipx install kimi-cli
# Or inside a dedicated virtual environment:
pip install --upgrade kimi-cli

Verify the command is on your PATH:

bash
kimi --version

2. Configure ~/.kimi/config.toml ​

Kimi Code stores provider and model definitions in:

  • macOS / Linux: ~/.kimi/config.toml
  • Windows: %USERPROFILE%\.kimi\config.toml

Create or update ~/.kimi/config.toml with an RKAPI provider pointing to https://api.zwwbai.com/v1:

toml
default_model = "gateway-kimi"

[providers.gateway_openai]
type = "openai_legacy"
base_url = "https://api.zwwbai.com/v1"
api_key = "sk-your-api-key"

[models.gateway-kimi]
provider = "gateway_openai"
model = "kimi-k2.5"
max_context_size = 262144

Adding Extra Models

You can declare additional [models.<alias>] entries referencing the same [providers.gateway_openai] block—or an Anthropic provider block below—and switch between them anytime with kimi --model <alias>. Always confirm exact model IDs at https://s2pbxm0xv5y.adtyai-fz.top/pricing.

Anthropic-Compatible Configuration (Alternative) ​

If you prefer Kimi Code to speak the Anthropic Messages protocol (for example, when calling Claude models or Anthropic-compatible routes on RKAPI), point base_url to https://api.zwwbai.com without /v1:

toml
default_model = "gateway-claude"

[providers.gateway_anthropic]
type = "anthropic"
base_url = "https://api.zwwbai.com"
api_key = "sk-your-api-key"

[models.gateway-claude]
provider = "gateway_anthropic"
model = "claude-sonnet-4-6"
max_context_size = 200000

Environment Variable Override (Quick Testing) ​

For quick shell-level testing without editing config.toml (or when using Kimi models through Anthropic-compatible mode):

macOS / Linux:

bash
export KIMI_BASE_URL="https://api.zwwbai.com/v1"
export KIMI_API_KEY="sk-your-api-key"
export KIMI_MODEL_NAME="kimi-k2.5"

Windows (PowerShell):

powershell
$env:KIMI_BASE_URL="https://api.zwwbai.com/v1"
$env:KIMI_API_KEY="sk-your-api-key"
$env:KIMI_MODEL_NAME="kimi-k2.5"

If you prefer launching via Claude Code / Anthropic environment variables, export ANTHROPIC_BASE_URL="https://api.zwwbai.com" and ANTHROPIC_AUTH_TOKEN="sk-your-api-key".

3. Quick Verification ​

Start Kimi Code in your workspace directory:

bash
cd /path/to/your/project
kimi

Or run a single non-interactive prompt to confirm connectivity:

bash
kimi --print -p "Reply with OK"

Inside an interactive session, run /setup or /model if you want to inspect active model configuration, and check Usage Logs in https://s2pbxm0xv5y.adtyai-fz.top to confirm traffic is billed to the right token and model.

Troubleshooting ​

  • Model not found / channel unavailable: Confirm kimi-k2.5 (or your chosen model ID) is listed on https://s2pbxm0xv5y.adtyai-fz.top/pricing and enabled for the token group you selected.
  • HTTP 403: Verify base_url uses https://api.zwwbai.com (not https://s2pbxm0xv5y.adtyai-fz.top).
  • HTTP 404: Check that type = "openai_legacy" / OpenAI providers include /v1, while type = "anthropic" does not include /v1.
  • Need more help? See the General FAQ or Environment Preparation.