What is Kimi CLI?
Kimi CLI is a command-line tool that provides terminal access to Kimi K2.5 API. Generate code, analyze files, search the web, and interact with AI directly from your shell. Perfect for scripting, automation, and developers who prefer terminal workflows. Works with both official Moonshot API and our proxy at kimi-api.com.
Installation
Via npm (Node.js)
# Install globally
npm install -g kimi-cli
# Or use npx without installation
npx kimi-cli "Generate a Python REST API"Via pip (Python)
# Install from PyPI
pip install kimi-cli
# Or use pipx for isolated installation
pipx install kimi-cliRequires Node.js 18+ or Python 3.8+. API key from kimi-api.com or official Moonshot platform.
Getting Started
Set API Key
export KIMI_API_KEY='sk-xxxxx'
export KIMI_BASE_URL='https://kimi-api.com/v1' # For 40% off proxyBasic Usage
kimi "Explain async/await in JavaScript"
# Or with explicit model
kimi --model moonshot-v1-128k "Write a sorting algorithm"Code Generation
kimi "Write a Python function to validate email addresses"
# Output to file
kimi "Create a React login component" > LoginForm.tsxFile Analysis
# Analyze code file
kimi --file app.py "Review this code for security issues"
# Process multiple files
kimi --file package.json --file README.md "Suggest improvements"Web Search
kimi --search "Latest Next.js 15 features" "Summarize recent updates"Interactive Mode
kimi --interactive
# Opens chat session with conversation historyKimi CLI Features
Code Generation
Generate functions, classes, entire files in 50+ languages. Supports context from existing files with --file flag.
File Analysis
Upload and analyze code, logs, configs up to 500MB. Extract content from PDF, Word, Excel with File Extract API.
Web Search Integration
Enable real-time web search with --search flag for up-to-date information and documentation lookups.
200K Context Window
Process entire codebases, large log files, or multi-file projects in a single CLI command with Kimi K2.5's massive context.
Shell Integration
Pipe commands, use in scripts, combine with grep/awk/sed. Works in bash, zsh, PowerShell, fish.
Multi-Model Support
Switch between Kimi K2.5, moonshot-v1-128k, moonshot-v1-8k, and Vision models with --model flag.
Using Kimi CLI with kimi-api.com Proxy
Environment Variables
export KIMI_API_KEY='your-key-from-kimi-api-com'
export KIMI_BASE_URL='https://kimi-api.com/v1'
kimi "Your prompt here"CLI Flags
kimi --api-key sk-xxxxx \
--base-url https://kimi-api.com/v1 \
"Generate a Node.js server"Config File
# ~/.kimi/config.json
{
"apiKey": "sk-xxxxx",
"baseUrl": "https://kimi-api.com/v1",
"defaultModel": "moonshot-v1-128k"
}60%
vs official Moonshot API
~2s
Average API latency
500MB
For file uploads
Kimi CLI vs Alternatives
| Feature | Kimi CLI | GitHub Copilot CLI | ChatGPT CLI |
|---|---|---|---|
| Pricing | ¥8/M tokens (via proxy) | Free (limited beta) | ¥140/month |
| Context Window | 200K tokens | 8K tokens | 128K tokens |
| File Upload | Yes (500MB) | No | Yes (limited) |
| Web Search | Yes (built-in) | No | Plus only |
| Offline Mode | No (API-based) | No | No |
| Custom Base URL | Yes (proxy support) | No | No |
| Open Source | CLI open, API proprietary | Proprietary | Proprietary |
Related Resources
Kimi K2.5 API
Learn about the model powering Kimi CLI
Get API Key
Obtain your API key for Kimi CLI at 40% off
API Documentation
Full API reference for advanced CLI usage
Kimi Code IDE
Use Kimi in VS Code and other IDEs
Pricing
Transparent pay-as-you-go pricing for CLI usage
Coding Plan
Compare CLI API usage with subscription plans