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
- Python 3.12+ or uv (recommended for isolated CLI installation).
- An RKAPI API Key (
sk-...) created at https://s2pbxm0xv5y.adtyai-fz.top under API Tokens. - Verify the exact live model IDs available in your token's group on https://s2pbxm0xv5y.adtyai-fz.top/pricing (for example
kimi-k2.5or other supported coding models).
1. Install Kimi Code CLI
Option A: Using uv (Recommended)
Install uv first if you do not already have it:
# 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:
uv tool install --python 3.13 kimi-cliOption B: Using pip / pipx
pipx install kimi-cli
# Or inside a dedicated virtual environment:
pip install --upgrade kimi-cliVerify the command is on your PATH:
kimi --version2. Configure ~/.kimi/config.toml
Kimi Code stores provider and model definitions in:
- macOS / Linux:
~/.kimi/config.toml - Windows:
%USERPROFILE%\.kimi\config.toml
OpenAI-Compatible Configuration (Recommended for Kimi & Multi-Model Routing)
Create or update ~/.kimi/config.toml with an RKAPI provider pointing to https://api.zwwbai.com/v1:
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 = 262144Adding 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:
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 = 200000Environment Variable Override (Quick Testing)
For quick shell-level testing without editing config.toml (or when using Kimi models through Anthropic-compatible mode):
macOS / Linux:
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):
$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:
cd /path/to/your/project
kimiOr run a single non-interactive prompt to confirm connectivity:
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_urluseshttps://api.zwwbai.com(nothttps://s2pbxm0xv5y.adtyai-fz.top). - HTTP 404: Check that
type = "openai_legacy"/ OpenAI providers include/v1, whiletype = "anthropic"does not include/v1. - Need more help? See the General FAQ or Environment Preparation.