Using Kimi CLI in SpaceSpider: Cost-Efficient Agent

Run Moonshot Kimi CLI inside a SpaceSpider pane. Install Kimi, authenticate, and use its long context as a cheap reader and cleanup agent.

April 18, 2026 · 5 min read

Using Kimi CLI in SpaceSpider

Kimi CLI is Moonshot's agentic coding tool powered by the Kimi K-series models. It is known for extremely long context windows at an attractive price per token, which makes it a strong "cheap worker" pane in a SpaceSpider grid: summarizing, grepping with reasoning, and cleaning up after the heavier agents.

This page covers install, auth, pane placement, and workflows where Kimi pays for itself.

Install Kimi CLI

Kimi ships as an npm package:

npm install -g @moonshot/kimi-cli

Confirm the install:

kimi --version

On Windows, open a fresh PowerShell after Node install so the PATH update sticks. On macOS and Linux, ensure the global npm bin directory is on PATH.

Get a Moonshot API key

  1. Sign in at Moonshot's platform console.
  2. Create an API key with "chat" and "agent" scopes.
  3. Export it in your shell before launching SpaceSpider:
export MOONSHOT_API_KEY=sk-...
export KIMI_MODEL=kimi-k2

On Windows:

setx MOONSHOT_API_KEY "sk-..."
setx KIMI_MODEL "kimi-k2"

Restart SpaceSpider so new panes see the env vars.

If you prefer routed access, Kimi CLI also accepts an OpenRouter key:

export OPENROUTER_API_KEY=sk-or-...
export KIMI_BASE_URL=https://openrouter.ai/api/v1
export KIMI_MODEL=moonshotai/kimi-k2

Assign Kimi to a pane

  1. In the new-space wizard or the CLI picker (Ctrl+Shift+T), click a slot.
  2. Select Kimi CLI. A green dot confirms it is on PATH.
  3. Save and let SpaceSpider spawn the pane.

The pane runs kimi in your space directory.

Kimi is most useful as a cheaper alternative or a dedicated reader in a 4-pane or 6-pane space.

In a 4-pane 2-by-2:

  • Top-left: Claude Code (architecture).
  • Top-right: Codex (iteration).
  • Bottom-left: Kimi CLI (cheap reader, cleanup, summaries).
  • Bottom-right: shell for tests and git.

In a 6-pane grid, pair Kimi with Qwen Code. They have different training lineages, so their answers differ even on the same prompt; a quick two-reader comparison is useful when you cannot tell which summary to trust.

See Grid layouts for monitor guidance.

Workflows that fit Kimi

Long log triage

Pipe a giant log into the Kimi pane and ask for clustering:

cat build.log | kimi "cluster the top 10 error patterns"

Kimi's long context handles thousands of lines at a fraction of the cost of Claude Opus.

Cleanup after a Claude Code session

After Claude Code finishes a big refactor, ask Kimi in a separate pane to sweep for leftovers:

  • Unused imports.
  • TODO markers.
  • Dead branches.

Let Claude Code do the heavy reasoning; let Kimi do the polish.

Cheap grep with reasoning

Ask Kimi: "list every function that touches user authentication". Because its context is long and its cost is low, you can throw wide questions at it without worrying about the bill.

Kimi environment variables

  • MOONSHOT_API_KEY: direct provider key.
  • OPENROUTER_API_KEY: if routed through OpenRouter.
  • KIMI_BASE_URL: override endpoint for OpenRouter or self-hosted bridges.
  • KIMI_MODEL: default model. Examples: kimi-k2, kimi-k2-thinking, or a specific variant.
  • KIMI_EDITOR: editor Kimi launches for interactive edits. Falls back to $EDITOR.

Useful Kimi commands

  • /help: lists commands.
  • /model: switches the active model.
  • /clear: drops context.
  • /cost: prints session token spend.

Choosing between Kimi models

  • kimi-k2: default, cost-efficient, long context.
  • kimi-k2-thinking: slower but better at multi-step reasoning.

Pin the thinking variant when you want Kimi to plan; pin the standard variant when you want it to summarize or retrieve.

Kimi vs Qwen Code

They look similar on paper. Practical differences:

PropertyKimi CLIQwen Code
ProviderMoonshotAlibaba DashScope
Context lengthVery longVery long
Cost profileCheap per tokenModerate
Code strengthGood general, strong summaryVery strong on Coder variant
Community pluginsSmallerLarger

If you are doing heavy editing and need a Coder-tuned model, Qwen Code is a better fit. If you are summarizing and reading large amounts of text, Kimi is the cheaper choice. Many SpaceSpider users run both in the same grid.

See Using Qwen Code for the other side of this comparison.

Troubleshooting Kimi in SpaceSpider

  • "API key missing": export the key before launching SpaceSpider; relaunch.
  • "Model not found": the provider does not expose that exact model name. Run kimi models list.
  • Rate-limit errors: Moonshot tiers have different limits; upgrade or reduce concurrent panes.
  • Garbled output: set your system locale to UTF-8.

More on Troubleshooting.

Frequently asked questions

Can Kimi edit files?

Yes. Kimi CLI is an agentic tool with edit permissions in the current working directory. SpaceSpider passes through the usual interactive edit flows.

Is Kimi CLI open source?

The CLI is open source; model weights depend on the variant. Some Kimi variants are published openly under permissive licenses, while others are API-only.

Can I run Kimi against a local model?

If you have a local OpenAI-compatible server with a Kimi weight loaded, point KIMI_BASE_URL at it and set KIMI_MODEL to the exposed name. Quality depends on the weight.

How do I limit Kimi to read-only?

Pass --read-only as a custom arg on the pane. Edit the pane command via settings and include the flag.

Does Kimi learn from my codebase?

No. Like the other CLIs, Kimi reads files per turn and does not persist training data from your sessions.

Keep reading