Kimi Code

Kimi Code CLI is Moonshot AI’s terminal coding agent. Register ApiGo as a Kimi provider so Kimi Code uses your ApiGo key, the kimi-k3 model, Workspace limits, and call logs.

Prerequisites

1. Install Kimi Code

On macOS or Linux, use the official installer:

curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash

On Windows PowerShell:

irm https://code.kimi.com/kimi-code/install.ps1 | iex

Open a new terminal and confirm the command is available:

kimi --version

2. Configure ApiGo

Create or edit ~/.kimi-code/config.toml. If the file already contains other providers or models, merge the following entries instead of replacing them.

default_model = "kimi-k3"
default_permission_mode = "auto"
default_plan_mode = false
merge_all_available_skills = true
telemetry = true

[providers."managed:apigo"]
type = "kimi"
base_url = "https://api.apigo.ai/v1"
api_key = "sk-apg-..."

[models."kimi-k3"]
provider = "managed:apigo"
model = "kimi-k3"
max_context_size = 1048576
capabilities = [ "thinking", "always_thinking", "image_in", "video_in", "tool_use" ]
display_name = "K3"
support_efforts = [ "max" ]
default_effort = "max"

This configuration has been verified with ApiGo. The provider name managed:apigo is a local alias; the model entry must reference the same value.

Kimi Code stores api_key as plain text in this file. Restrict access after saving it:

chmod 700 ~/.kimi-code
chmod 600 ~/.kimi-code/config.toml

default_permission_mode = "auto" lets the Agent run tool actions without asking for confirmation. Change it to manual if you want to approve actions individually.

3. Start and verify

Start Kimi Code inside your project:

cd /path/to/your/project
kimi

Use /model to confirm that K3 is selected. Then send a short prompt, or run a one-shot terminal check:

kimi -p 'Reply with exactly APIGO_KIMI_OK and nothing else.'

A successful setup prints:

APIGO_KIMI_OK

Confirm the request in Workspace → Call Logs.

Configuration reference

Setting Value Purpose
Configuration file ~/.kimi-code/config.toml Stores Kimi Code runtime, provider, and model settings
Provider type kimi Uses Kimi Code’s OpenAI-compatible provider implementation
Provider alias managed:apigo Connects the model entry to the ApiGo provider
Base URL https://api.apigo.ai/v1 ApiGo OpenAI-compatible gateway prefix
Model alias and slug kimi-k3 Selects the ApiGo K3 model
Context size 1048576 Declares the model’s 1M-token context window
Thinking effort max Uses the supported maximum thinking effort

Troubleshooting

Symptom Fix
Configuration warning on startup Run kimi doctor and confirm the file is valid TOML
401 / 403 Replace api_key with an active ApiGo key and check its Workspace permissions or spend cap
Model not found Confirm both model fields are exactly kimi-k3 and check the current ApiGo Model Catalog
Kimi Code ignores the file Check whether KIMI_CODE_HOME points to another data directory
Kimi Code asks for tool approval Confirm default_permission_mode is auto; use manual when approval prompts are preferred
No request in Call Logs Confirm the provider uses https://api.apigo.ai/v1 and /model shows K3

Resources