Kimi Code CLI

1.33.0 · active · verified Tue Apr 14

Kimi Code CLI is an AI agent that runs in the terminal, assisting with software development tasks and terminal operations. It can read and edit code, execute shell commands, search web pages, and autonomously plan and adjust actions. The library is actively maintained with frequent updates, with the current version being 1.33.0.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install Kimi Code CLI using `uv` and then interact with it directly from the terminal. It covers verifying the installation, launching the interactive agent, and asking a single question using `kimi ask`. Ensure your `MOONSHOT_API_KEY` is set as an environment variable for direct commands or use `/setup` within the interactive CLI.

# Install Kimi CLI (recommended with uv and Python 3.13)
uv tool install kimi-cli python@3.13

# Verify installation
kimi --help

# Start Kimi CLI in interactive mode
kimi

# Inside Kimi CLI, use /setup to configure (e.g., API key)
# /setup

# Or, use kimi ask for a single question directly from the shell
export MOONSHOT_API_KEY="$(os.environ.get('MOONSHOT_API_KEY', ''))" # Ensure API key is set for non-interactive use
kimi ask "Generate a Python function to calculate the factorial of a number."

# To start an interactive chat session:
kimi chat

view raw JSON →