Skip to main content

Kimi Provider

CCS provides two distinct Kimi offerings:
CommandAuthEndpointUse Case
ccs kimiOAuth via CLIProxy (device code)http://127.0.0.1:8317/api/provider/kimiMulti-account, no API key needed
ccs kmAPI key directhttps://api.kimi.com/coding/Single API key, Kimi for Coding
Provider aliases: kimi, moonshot both route to the same CLIProxy provider.

Quick Start

# OAuth mode (CLIProxy) — no API key needed
ccs kimi "explain this code"

# API preset mode — requires API key (Kimi for Coding)
ccs km "explain this code"

# List accounts (OAuth mode)
ccs kimi --accounts

# Switch account
ccs kimi --use work

Authentication

ccs kimi — OAuth Mode (CLIProxy)

1

Trigger Login

Run ccs kimi --kimi-login — device code displayed in terminal
2

Activate Device

Visit the URL shown and enter the device code (no callback port needed)
3

Token Cached

OAuth token saved to ~/.ccs/cliproxy/auth/kimi-{email}.json
4

Auto Refresh

CLIProxy backend manages token refresh automatically
Device Code Flow: Polling-based authentication — no local callback server required. Works in headless/server environments.

ccs km — API Key Mode (Kimi for Coding)

1

Get API Key

Obtain a sk-... key from Moonshot AI platform
2

Configure

Run ccs km — prompted for API key on first use
3

Thinking Always On

All requests use extended thinking by default
ccs km connects directly to https://api.kimi.com/coding/. Default model: kimi-k2-thinking-turbo. The --preset kimi flag auto-maps to km for backward compatibility.

Multi-Account Support

# Add second Kimi account (preserves existing)
ccs kimi --kimi-login --add

# Auto-nicknamed from email prefix
Account Registry: ~/.ccs/cliproxy/accounts.json — aliases kimi and moonshot both map to the same provider.

Model Configuration

Available Models

ccs kimi (CLIProxy OAuth)

ModelContextNotes
kimi-k2.5262KDefault — latest multimodal
kimi-k2-thinkingExtended reasoning
kimi-k2Flagship coding model

ccs km (API key direct)

ModelNotes
kimi-k2-thinking-turboDefault model for km
Thinking budget: 1K–32K tokens, dynamic and zero allowed. Vision: Configurable via vision-model placeholder in settings.

Settings Template

Settings saved to ~/.ccs/km.settings.json from base-km.settings.json:
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/",
    "ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE",
    "ANTHROPIC_MODEL": "kimi-k2-thinking-turbo",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k2-thinking-turbo",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k2-thinking-turbo",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2-thinking-turbo"
  }
}
These env vars are injected automatically by CCS. Manual override is rarely needed.

Commands Reference

# Basic usage
ccs kimi "your prompt"
ccs km "your prompt"              # API preset

# Authentication
ccs kimi --kimi-login             # Trigger device code OAuth
ccs kimi --kimi-login --add       # Add second account
ccs kimi --logout                 # Clear tokens

# Account management
ccs kimi --accounts               # List all accounts
ccs kimi --use work               # Switch default account
ccs kimi --nickname personal      # Rename current account

Troubleshooting

Device Code Expired

Symptom: “Device code expired” error during login Solution: Device codes have a short TTL. Re-run login and complete quickly:
ccs kimi --logout
ccs kimi --kimi-login

API Key Rejected (km mode)

Symptom: 401 errors when using ccs km Solution: Verify key format (sk-...) and permissions on Moonshot AI platform.
API keys for ccs km are separate from OAuth tokens used by ccs kimi. Do not mix them.

Wrong Account Active

Symptom: Unexpected account being used Solution:
# Check default (marked with *)
ccs kimi --accounts

# Switch default
ccs kimi --use work

Storage Locations

PathDescription
~/.ccs/cliproxy/auth/kimi-*.jsonOAuth tokens (one per account)
~/.ccs/cliproxy/accounts.jsonAccount registry, nicknames
~/.ccs/km.settings.jsonKimi for Coding model config

Cost Information

ModelInput/MOutput/MCache/M
kimi-k2.5$0.60$3.00$0.10
kimi-k2-thinking$0.60$2.50$0.15
kimi-k2-thinking-turbo$1.15$8.00$0.15
kimi-k2$0.60$2.50$0.15

Next Steps

Multi-Account Setup

Manage multiple Kimi accounts

API Preset (km)

Configure direct API key access

Remote Proxy

Connect to external CLIProxy server

All Providers

Explore other supported providers