An API for everyoneUser guide
Website ↗
User guideTool setup

Kimi Code

Kimi Code is the agent, not a restriction to Kimi models. With a third-party provider, your configuration chooses the model. This article covers the current CLI.

Have these three details ready

With your app already installed, open Self-service on this website and sign in. Create or view your own API key, copy the API address shown there, and copy an exact model ID from Models and pricing. A website homepage, account password or marketing name is not a substitute. Check both account balance and key allowance.

API_HOST, YOUR_API_KEY and YOUR_MODEL_ID below are placeholders: replace each before use. Follow this article on whether to keep /v1; do not append /chat/completions or /responses. Examples do not connect automatically or contain your key.

1. Check version and file location

Run kimi --version. The current file is ~/.kimi-code/config.toml, or %USERPROFILE%\.kimi-code\config.toml on Windows. Older versions may use ~/.kimi; consult the docs for your installed version rather than editing both.

2. Add provider and model

Merge the example below. provider = "my_api" must match [providers.my_api]. my-model is a local alias; model is the actual platform ID. The 32768 context value is an example, not a model specification: adjust it to confirmed limits.

Field diagram · not an app screenshot
type
openai / openai_responses
base_url
https://API_HOST/v1
model
YOUR_MODEL_ID
api_key_env
MY_API_KEY
Configuration example

Keep a copy of your current file first. Update matching entries rather than adding duplicates, and preserve unrelated settings. Do not share a configuration or screenshot containing a real key.

default_model = "my-model"

[providers.my_api]
type = "openai"
base_url = "https://API_HOST/v1"
api_key_env = "MY_API_KEY"

[models.my-model]
provider = "my_api"
model = "YOUR_MODEL_ID"
max_context_size = 32768

3. Set credentials and select the model

api_key_env = "MY_API_KEY" explicitly reads that environment variable. Set it below, run kimi, then use /model to select my-model. /login signs into the official service and does not configure this platform.

When the configuration uses MY_API_KEY, set it in the same terminal from which you start the app. Enter your real key only on your computer. This example shows the syntax; the variable lasts for that terminal session.

macOS / Linux terminal
export MY_API_KEY="YOUR_API_KEY"
kimi
Windows PowerShell
$env:MY_API_KEY = "YOUR_API_KEY"
kimi

4. Choose the format

type = "openai" uses Chat Completions. Change to "openai_responses" only after confirming that route for your model. Both examples retain /v1 in the supplied platform address.

5. Declare supported thinking levels

Recognized models usually get automatic capabilities. For an unrecognized alias, add capabilities = ["tool_use", "thinking"] under [models.my-model] only when supported. Declare support_efforts and default_effort from real capabilities; for a low/high model, use support_efforts = ["low", "high"] and default_effort = "low". A declaration cannot add a capability to a model.

Once low is confirmed for this model, add the separate [thinking] section below to select it. Change effort to another declared value when needed. A global effort overrides the model’s default_effort. Save, run /reload in an idle session, then send a test message.

[thinking]
enabled = true
effort = "low"

Check 1: receive a reply

Create an empty test folder, choose it as the workspace and start a new chat. Confirm the new provider and model are selected, then send the prompt below. A normal reply without an error confirms basic connectivity, not every agent feature. Tests incur normal API usage.

Reply only: Connection successful.

Expected: the app displays “Connection successful.” If you see a login page, an error or endless loading, use the checks below before sending again.

Check 2: read a real file

In that test folder, use a text editor to create hello.txt containing “API connection test 27”. Save it, then send the prompt below. If permission is requested, allow reading only this test folder.

Use the file-reading tool to open hello.txt in the current workspace and tell me its contents. Do not change any files.

Expected: a visible tool execution reading hello.txt, followed by an answer containing API connection test 27. A text answer alone is not evidence of a tool call. You may remove the test folder afterwards.

Troubleshoot by symptom

401 / Invalid API key

Check that the address and complete key belong to the same service and that the key is active. Never send support a full key.

404 / model not found

Check /v1, the exact model ID and the API format. A listed model is not a guarantee of support for every format.

429 / quota / balance

Check balance, key allowance and request rate; follow the returned error. More thinking effort cannot fix a quota problem.

Chat works but files cannot be read

Check model tool support, workspace permissions and the tool execution error.

No effort selector

Check capability declarations, the model and client version. Thinking support does not necessarily include adjustable effort.

Official references and scope

Configuration checked on 2026-11-08. Menus may change with updates; use these official references to verify details. Use the current connection information provided by this platform.