Configuration
Files and locations
| File | Purpose |
|---|---|
~/.kimi-code/config.toml | Main user config (created on first run) |
~/.kimi-code/tui.toml | Terminal UI preferences |
~/.kimi-code/mcp.json | MCP server definitions (see MCP: Connecting Servers to Kimi Code) |
<project-root>/.kimi-code/local.toml | Project-local: only [workspace] additional_dir (absolute paths; add to .gitignore) |
KIMI_CODE_HOME relocates the entire data root (~/.kimi-code/) — it is resolved before all other configuration. Note that generic cross-tool resources (~/.agents/skills/, ~/.agents/AGENTS.md) live in the real OS home and do not move with KIMI_CODE_HOME.
The docs state explicitly: “The CLI currently reads a single user-level config file and has no project-level config file mechanism” (beyond local.toml for workspace directories). TOML keys are snake_case; quote keys containing dots, e.g. [models."gpt-4.1"].
config.toml essentials
default_model = "k3"
default_permission_mode = "manual" # manual | yolo | auto
default_plan_mode = false
merge_all_available_skills = true
extra_skill_dirs = ["~/team-skills"]
extra_agent_dirs = ["~/team-agents"]
builtin_product_skills = true
telemetry = true
[providers.kimi]
type = "kimi"
api_key = "sk-..."
[models."k3"]
provider = "kimi"
model = "k3"
max_context_size = 256000
[secondary_model]
default_model = "kimi-for-coding-highspeed"
force = false
[thinking]
enabled = true
effort = "high" # low | medium | high | xhigh | max
[loop_control]
max_steps_per_turn = 0 # unset/0 = unlimited
max_attempts_per_step = 10
[permission]
dangerous_command_guard = true
[[permission.rules]]
decision = "deny"
pattern = "Bash(rm -rf*)"
reason = "never delete recursively without asking"
[[hooks]]
event = "PreToolUse"
matcher = "Bash"
command = "~/bin/my-hook.sh"
timeout = 30
Key field notes:
- providers:
type(required; one ofkimi,anthropic,openai,openai_responses,google-genai,vertexai),api_key,base_url,oauth(auto-injected by login),env(sub-table of conventional key names as fallback),custom_headers. - models:
provider(required),model(required),max_context_size(required),max_input_size,capabilities,default_effort, per-modelbase_url,display_name, and more. - secondary_model: the subagent model pool (stable since 0.40.0, enabled by default);
force = truepins all subagents todefault_model. - permission.rules:
decision(allow/deny/ask),scope,pattern(ToolNameorToolName(arg-pattern)),reason; first match wins. See Permissions and Approvals. - hooks: only
event,matcher,command,timeout(1–600 s, default 30) are allowed. Hooks are fail-open — do not rely on them as the sole security barrier.
Other documented tables: [background], [subagent], [swarm], [mcp], [identity], [tools] (global allow/deny lists), [image], [services.moonshot_search], [services.moonshot_fetch], [token_counting].
tui.toml
theme = "auto" # auto | dark | light | custom
render_latex = true
disable_paste_burst = false
[editor]
command = "code --wait"
[notifications]
enabled = true
notification_condition = "unfocused" # unfocused | always
[upgrade]
auto_install = true
[status_line]
items = ["mode", "goal", "model", "tasks", "cwd", "git", "tips"]
/reload-tui applies tui.toml changes immediately; /reload reloads both config files without restarting.
Environment variables
Highlights (full list on the env-vars docs page):
| Variable | Purpose |
|---|---|
KIMI_CODE_HOME | Relocate the entire data root |
KIMI_DISABLE_TELEMETRY | 1/true/yes/y disables anonymous telemetry |
KIMI_MODEL_NAME / _API_KEY / _PROVIDER_TYPE / _BASE_URL / _MAX_CONTEXT_SIZE | Synthesize a temporary in-memory provider (takes priority over default_model; -m still wins) |
KIMI_CODE_OAUTH_HOST | OAuth host (default https://auth.kimi.com) |
KIMI_CODE_BASE_URL | Coding API base URL (default https://api.kimi.com/coding/v1) |
KIMI_LOG_LEVEL | off/error/warn/info/debug (default info) |
KIMI_CODE_DANGEROUS_COMMAND_GUARD | false disables the dangerous-command guard |
KIMI_SUBAGENT_TIMEOUT_MS | Subagent timeout (default 7200000 = 2 h) |
KIMI_MCP_STARTUP_TIMEOUT_MS / KIMI_MCP_TOOL_TIMEOUT_MS | MCP timeouts |
KIMI_SHELL_PATH | Custom Git Bash path on Windows |
KIMI_DISABLE_CRON | 1 disables cron tools |
HTTP_PROXY / HTTPS_PROXY / ALL_PROXY / NO_PROXY | Standard proxy support (SOCKS via scheme in ALL_PROXY) |
Credentials come from config.toml, not the shell environment. Shell env vars are NOT read for provider credentials (exceptions:
GOOGLE_APPLICATION_CREDENTIALS, read by the Google SDK directly, and theKIMI_MODEL_*family). Credential priority:[providers.<name>].api_key>[providers.<name>.env]sub-table > startup failure.
Override precedence
Not a simple stack — three roles:
KIMI_CODE_HOMElocates everything (runs before all other resolution).- Runtime switches (e.g.
KIMI_DISABLE_TELEMETRY) disable subsystems regardless of config (“additionally disable” semantics). - Endpoint/diagnostic vars (
KIMI_CODE_OAUTH_HOST,KIMI_CODE_BASE_URL,KIMI_LOG_LEVEL) are read at subsystem init.
For ordinary parameters: CLI options > user config file. Specific env vars override specific config fields where documented. Validate your files with kimi doctor (Terminal Commands (kimi)).
Last verified: 2026-09-07
Official sources:
- https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/config-files.html
- https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/providers.html
- https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/env-vars.html
- https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/overrides.html
- https://www.kimi.com/code/docs/en/kimi-code-cli/configuration/data-locations.html
AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.