Customization and References
Kimi Code CLI offers a wide range of customization options, allowing you to adjust how the AI behaves and works to fit your needs.
Configuration file
Kimi Code CLI uses ~/.kimi/config.toml as the global configuration file and supports both TOML and JSON formats. In the configuration file, you can set:
- API providers and models: Configure different model providers, API endpoints, and keys.
- Default model: Specify the model used by default.
- Runtime parameters: Adjust runtime settings such as timeout, concurrency, and output format.
Use the /config command to quickly open the configuration file for editing.
AGENTS.md project configuration
Place an AGENTS.md file in the project root to provide the AI with project-level context:
- Project background: Describe the project's features, architecture, and tech stack.
- Build steps: Explain how to install dependencies, build the project, and run tests.
- Code conventions: Define naming rules, directory-structure conventions, and code-style preferences.
- Notes: Highlight important security constraints, performance requirements, and other considerations.
Use the /init command to let the AI scan the project and generate an initial AGENTS.md automatically. You can also edit the file manually to add more project-specific information. AGENTS.md can be placed in any subdirectory of the project, and the AI will automatically load the relevant configuration.
Custom System Prompt
You can customize the AI's system prompt in the following ways:
- Global system prompt: Write it in
~/.kimi/AGENTS.md; it applies to all projects. - Project-level system prompt: Write it in the
AGENTS.mdfile in the project root; it applies only to the current project. - Startup parameter: Specify it at launch with the
--system-promptparameter.
Project-level configuration overrides global configuration, and startup parameters have the highest priority.
MCP integration
Kimi Code CLI supports Model Context Protocol (MCP), letting it connect to external tools and data sources to extend the AI's capabilities:
- MCP server configuration: Add MCP server addresses to the configuration file so the AI can call external tools.
- Built-in MCP support: Some commonly used MCP tools are built in and require no additional configuration.
- Custom MCP servers: You can develop your own MCP server to provide domain-specific capabilities for the AI.
MCP configuration can be written in ~/.kimi/config.toml or in a project-level configuration file.
Environment variables
Kimi Code CLI can also be configured through environment variables, which is useful for CI/CD or scripts:
| Environment variable | Description |
|---|---|
KIMI_API_KEY | API key |
KIMI_BASE_URL | Custom API endpoint |
KIMI_MODEL | Default model name |
KIMI_MAX_TOKENS | Maximum number of output tokens |
Environment variables take precedence over settings in the configuration file.
More references
- Slash command reference: Use
/helpto view all available commands. - CLI parameter reference: Run
kimi --helpto view all startup parameters. - Official documentation: Visit the Kimi Code Docs for the latest complete documentation.