What is Kimi CLI?
Kimi CLI is a command line tool that brings the full power of Kimi API (by Moonshot AI / 月之暗面) to your terminal. Instead of switching to a web browser or GUI application, you can ask Kimi questions, generate code, analyze documents, and perform web searches entirely from the command line.
Built for developers and power users, Kimi CLI integrates seamlessly into existing workflows. Pipe file contents directly into prompts, script complex AI-assisted operations, and automate repetitive tasks with Kimi's 200K-token context window that handles even the largest codebases.
Whether you're debugging a tricky bug, generating boilerplate code, or summarizing lengthy documents, Kimi CLI is your terminal-based AI assistant that understands context and delivers accurate results.
Installation
Kimi CLI can be installed via npm or pip, depending on your preferred ecosystem. Choose the method that fits your workflow:
Install via npm
# Install globally with npm
npm install -g @moonshot/kimi-cli
# Or with pnpm
pnpm add -g @moonshot/kimi-cli
# Verify installation
kimi --versionInstall via pip
# Install with pip
pip install kimi-cli
# Or with pipx for isolated environments
pipx install kimi-cli
# Verify installation
kimi --versionSystem Requirements
- -Node.js 18+ (for npm install) or Python 3.8+ (for pip install)
- -macOS, Linux, or Windows (WSL recommended)
- -A valid Kimi API key (get one at 40% off through our proxy)
Getting Started
After installation, configure your API key and start using Kimi CLI right away:
Configure Your API Key
# Set your API key (one-time setup)
kimi config set api_key YOUR_API_KEY
# Or use environment variable
export KIMI_API_KEY=YOUR_API_KEY
# If using our proxy, set the base URL too
kimi config set base_url https://kimi-api.com/v1Basic Usage Examples
# Ask a simple question
kimi "What is the time complexity of quicksort?"
# Generate code
kimi "Write a Python function to merge two sorted arrays"
# Analyze a file
kimi "Explain this code" < main.py
# Pipe input for analysis
cat error.log | kimi "What's causing these errors?"
# Interactive chat mode
kimi chat
# Multi-turn conversation with context
kimi chat --model moonshot-v1-128kKimi CLI remembers conversation context within a session, so you can ask follow-up questions naturally, just as you would in a chat interface.
Key Features
Code Generation
Generate boilerplate, functions, tests, and entire modules from natural language descriptions directly in your terminal.
File Analysis
Pipe any file into Kimi CLI for instant analysis - code review, bug detection, documentation generation, and more.
Web Search
Kimi's built-in web search lets you get up-to-date information without leaving the terminal. Great for research tasks.
200K Context Window
Analyze entire codebases at once. Kimi's industry-leading 200K token context handles large files with ease.
Shell Integration
Pipe, redirect, and script with standard Unix tools. Combine Kimi CLI with grep, awk, sed, and your favorite utilities.
Multi-Model Support
Switch between moonshot-v1-8k, 32k, and 128k models based on your task requirements and budget.
Using Kimi CLI with Our Proxy - Save 60%
By pointing Kimi CLI at our proxy service, you get the exact same functionality at a fraction of the cost. Our proxy is fully compatible with the official Kimi API, so no code changes are needed beyond setting the base URL.
Configure Proxy Base URL
# Option 1: Set via CLI config
kimi config set base_url https://kimi-api.com/v1
# Option 2: Set via environment variable
export KIMI_BASE_URL=https://kimi-api.com/v1
# Option 3: Per-request override
kimi --base-url https://kimi-api.com/v1 "Your prompt here"
# Verify it's working
kimi "Hello, are you connected?" --verbose60%
Cost Savings
100%
API Compatibility
0
Code Changes Needed
Kimi CLI vs Alternatives
How does Kimi CLI compare to other AI command line tools? Here's a side-by-side comparison:
| Feature | Kimi CLI | GitHub Copilot CLI | ChatGPT CLI |
|---|---|---|---|
| Context Window | 200K tokens | 8K tokens | 128K tokens |
| Web Search | Built-in | No | Plugin required |
| File Analysis | Native (pipe input) | Limited | Yes |
| Chinese Language | Excellent | Good | Good |
| Proxy Pricing | 40% of official | $10/mo fixed | $20/mo fixed |
| Open Source | Yes | No | Community |