Kimi CLI - Command Line Interface for Kimi K2.5 API

Access Moonshot AI's Kimi K2.5 and moonshot-v1 models from your terminal. Code generation, file analysis, web search, and more at 40% of official pricing.

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-cli

Requires 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 proxy

Basic 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.tsx

File 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 history

Kimi 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

FeatureKimi CLIGitHub Copilot CLIChatGPT CLI
Pricing¥8/M tokens (via proxy)Free (limited beta)¥140/month
Context Window200K tokens8K tokens128K tokens
File UploadYes (500MB)NoYes (limited)
Web SearchYes (built-in)NoPlus only
Offline ModeNo (API-based)NoNo
Custom Base URLYes (proxy support)NoNo
Open SourceCLI open, API proprietaryProprietaryProprietary

Related Resources

Start Using Kimi CLI Today

Get your API key at 40% off and access Kimi K2.5 from your terminal