An agentic coding assistant for VSCode powered by Moonshot's Kimi K2.6 & K2.7 Code API. Bring your own Moonshot API key from platform.moonshot.ai — pay-per-use, no subscription. Works as a self-contained sidebar; does not require GitHub Copilot.
Unofficial. Not affiliated with or endorsed by Moonshot AI. "Kimi" and "Moonshot" are trademarks of their respective owners.
What's new in 0.15.3
- Kimi K2.7 Code & K2.7 Code HighSpeed support — choose between
kimi-k2.6,kimi-k2.7-code, orkimi-k2.7-code-highspeedfrom a new Model dropdown in Settings (or/model <id>in chat). K2.7 Code models use thinking mode automatically. - Model selector in Settings UI — pick your model from a dropdown in the Settings panel instead of only via slash commands.
- System prompt dynamically reflects the active model — the assistant now identifies itself by whichever model you selected.
Why this exists
The official Kimi Code extension requires a Kimi Code subscription and a separate OAuth login. If you already pay Moonshot per-token from platform.moonshot.ai and want to use that key directly inside VSCode — this is the gap-filler. Cursor doesn't accept the Moonshot endpoint either, so this extension is the most direct way to use Kimi K2.6, K2.7 Code, or K2.7 Code HighSpeed on Windows / macOS / Linux without changing IDEs.
Features
Chat that feels like Claude Code
- Streaming responses from your choice of model — Kimi K2.6, Kimi K2.7 Code, or Kimi K2.7 Code HighSpeed (all with 256K context window)
- Full markdown rendering with headings, lists, tables, blockquotes
- Syntax-highlighted code blocks for js, ts, jsx, tsx, py, sh/powershell, json, yaml, html, css, go, rs, sql — each block has a one-click Copy button
- Per-message Copy buttons: ⧉ corner button on user messages, "⧉ Copy" pill below every completed Kimi response
- Live token counter and cost estimate in the footer, plus your remaining Moonshot balance fetched from
/v1/users/me/balance
Agent capabilities
- Read-only tools:
read_file,list_files(with globname_patternto find files by name),search_files(regex content search) - Write tools with diff approval:
write_file,apply_diff(structured search/replace hunks). Every change is previewed in VSCode's native diff view before anything is written - Shell tool with command approval:
execute_command. Approve once, Approve & remember (allowlists the exact command), or Reject - MCP Tool Integration: Call tools from connected MCP servers (19 pre-configured in Marketplace, or add custom ones)
Approval modes (bottom of the chat)
- Ask permission (default) — approve every write and command
- Accept edits — auto-approve file edits; still ask for shell commands
- Plan mode — read-only research mode; the write/shell tools are filtered out before being sent to Moonshot, and the system prompt switches to "describe the change instead of making it"
- Bypass permissions — auto-approve everything (use only in trusted, sandboxed workspaces)
Input affordances
/slash commands with autocomplete:/help— list commands/new//clear— start a fresh task/model <id>— switch model (e.g./model kimi-k2-turbo-preview)/history— open the task history panel
@file mentions — type@, get a workspace file dropdown, pick one, file content is inlined into the message Kimi sees+attach button — open VSCode's native file picker. Picked files appear as removable chips above the input. Caps: 1 MB per file, 4 MB total per turn
Task history
- Every conversation auto-saves to
globalStorageas JSON - History button in the header lists tasks with relative timestamps; click to load, click ✕ to delete
- Survives VSCode restarts; loaded tasks resume cleanly with full context
EDITOR widget — chat in a full editor tab
- Click the EDITOR button to the left of Send to open the same React app in a VSCode editor tab
- The sidebar stays open; both views render identical state in real time
- Send from either side, see the stream appear in both simultaneously
- Powered by
vscode.window.createWebviewPaneland a shared in-host store — there is no separate state, so there is no drift
KIMI2.6 Instructions — discipline on every response
- The file
KIMI2.6_instructions.mdships with the extension and gets injected into Kimi's system prompt on every turn, in every mode (ask / accept edits / plan / bypass) — no exceptions - Based on Andrej Karpathy's coding skill guidelines: think before coding, simplicity first, surgical changes, goal-driven execution
- Open Settings → KIMI2.6 Instructions to view, edit, and Save & reload — your custom copy lives in globalStorage and applies on the next message
- Reset to default restores the shipped version
Model Context Protocol (MCP) — Extend Kimi with External Services
Connect Kimi to external databases, APIs, and tools via the Model Context Protocol.
Pre-configured Marketplace — 31 ready-to-use MCPs (19 original + 12 added in 0.15.0):
- Data & Databases: GitHub, PostgreSQL, SQLite, Jira, Memory (knowledge graph)
- Communication: Slack, Twilio (SMS/WhatsApp), Discord
- Web & Search: Brave Search, Wikipedia, YouTube, Cheerio, Tavily, Exa, Perplexity, Firecrawl, Hyperbrowser
- Cloud & Dev: AWS, Docker, Google Workspace, npm, Stripe, Apify
- Project Management: Linear, Notion
- Browsers: Puppeteer, Playwright
- Reasoning & Docs: Sequential Thinking, Context7 (library docs), Everything (MCP reference)
- Utilities: Filesystem
Verified. Of the 12 new MCPs added in 0.15.0, 8 connect with zero credentials (Memory, Sequential Thinking, Everything, Playwright, Context7, Tavily, Exa, Hyperbrowser). The other 4 (Firecrawl, Perplexity, Stripe, Apify) require an API key in the per-server settings before they boot. Run
node scripts/test-mcp-connections.mjsto reproduce; full report lands inmcp-connection-report.json.
One-click install — Open the Kimi sidebar settings, go to Model Context Protocol (MCP) → Marketplace, and click to add any server. You'll be prompted for API keys (securely stored per server).
AI-Generated MCP — Can't find what you need? Describe it: click AI Generate in the MCP panel, type a description (e.g., "I need to query my local SQLite database at /path/to/db.sqlite"), and Kimi will generate a custom MCP server configuration for you.
Manual MCP — Add custom MCP servers by URL or stdio command if you're running your own MCP implementations.
Auto-approve per server — In the MCP settings, toggle "Auto-approve tools from this server" to skip approval prompts for trusted MCPs. Or configure approval globally for all MCP tools.
Privacy & safety
- API key stored in the OS credential store (Windows Credential Manager / macOS Keychain / Linux libsecret) via VSCode's
SecretStorage— never written to settings.json, never logged, scrubbed from any error messages - Workspace path safety on every tool:
..traversal and absolute paths to other roots are rejected - Tool output is wrapped in
<tool_output>tags with closing-tag escaping; the system prompt forbids the model from acting on instructions found in file contents - Hard caps: agent turns (default 25), tokens per task (default 500K), file size (1 MB read), shell timeout (5 min)
- No telemetry
Setup — step by step
Step 1: Get a Moonshot API key
- Sign up at platform.moonshot.ai
- Add some credit (the API is billed per-token; pricing at platform.moonshot.ai/docs/pricing)
- From the dashboard, create an API key. It looks like
sk-.... Copy it somewhere safe.
Step 2: Install the extension
From the marketplace (once published):
- Open the Extensions panel (
Ctrl+Shift+X) and search for Kimi Code Moonshot API, or runext install <publisher>.kimi-code-moonshot-apiin the command palette.
From a local .vsix (during development or sideload):
- In the Extensions panel, click the
…menu → Install from VSIX… and pick the.vsixfile, or - From a terminal:
code --install-extension kimi-code-moonshot-api-<version>.vsix
Step 3: Open the Kimi sidebar
Click the Kimi icon in the activity bar (left edge of VSCode). The first time it opens, you'll see the Welcome to Kimi Code Moonshot API panel.
Step 4: Configure your key + name
- Paste your Moonshot API key into the Moonshot API Key field (toggle "Show key" if you want to verify it)
- (Optional) Enter a display name — it's shown in the chat UI as your label, nothing more
- Click Save and start
The chat view replaces the welcome panel. Your key is now in the OS credential store.
If you ever want to change the key later, run Kimi: Set Moonshot API Key from the command palette (
Ctrl+Shift+P), or click the ⚙ icon in the chat header.
Step 5: (Recommended) Open a workspace folder
Many of the tools (read_file, list_files, apply_diff, execute_command, @ mentions) need a workspace folder. Open one via File → Open Folder… before asking Kimi about a codebase.
Step 6: Send your first message
Type any question and hit Enter. You should see a streaming response. The token/cost/balance footer appears under the input.
Using the new affordances
Slash commands (/)
Type / at the start of an empty input. A dropdown appears. Use ↑/↓ to navigate, Tab/Enter to pick, Esc to dismiss.
| Command | What it does |
|---|---|
/help |
Shows all commands as a markdown card |
/new |
Starts a fresh task (current task is auto-saved) |
/clear |
Same as /new |
/model <id> |
Switches model. e.g. /model kimi-k2.6, /model kimi-k2.7-code, /model kimi-k2.7-code-highspeed |
/history |
Loads the task list (also reachable via the History button) |
Slash commands are handled locally — they don't consume tokens.
File mentions (@)
Type @ followed by part of a filename. A dropdown shows up to 10 matching workspace files. Pick one with Tab/Enter; the full workspace-relative path is inserted.
When you send the message, the content of every @-mentioned file is read fresh and inlined into the prompt, wrapped in an <attachment> tag so Kimi knows it's untrusted file data.
review @src/utils.ts and tell me if the error handling on line 14 is correct
File attachments (+ button)
Click the + button to the left of the input. Use VSCode's native file picker (multi-select supported). Files appear as chips above the input — click ✕ on a chip to remove.
Attachments are sent inline once with your next message, then cleared.
Caps: 1 MB per file, 4 MB total per turn (to keep token cost bounded).
Mode bar
Below the input, four chips control how approvals are handled:
| Mode | Writes (write_file, apply_diff) |
Shell (execute_command) |
Reads |
|---|---|---|---|
| Ask permission (default) | Ask | Ask | Auto-approved |
| Accept edits | Auto-approve | Ask | Auto-approved |
| Plan mode | Tool disabled | Tool disabled | Auto-approved |
| Bypass permissions | Auto-approve | Auto-approve | Auto-approved |
In Plan mode, Kimi gets a system-prompt hint to describe what it would change rather than calling tools that don't exist. Switch back to Ask permission or Accept edits to actually make the changes.
Diff approval
When Kimi proposes an edit:
- An approval card appears:
Write file src/utils.ts (+5 −2) - Click View diff to inspect (left = current file, right = proposed change in VSCode's native diff view)
- Approve to apply, Reject to discard
- The tool result is fed back to the model so it knows whether the edit landed
Command approval
When Kimi proposes a shell command:
- The card shows the full command and
cwd - Approve runs once. Approve & remember also adds an exact-match regex to
kimi.autoApprove.commandsso identical future commands auto-approve. Reject cancels. - Output (stdout + stderr + exit code, truncated to ~16 KB) is returned to the model
- The Stop button on the input area kills any running command
Copy buttons
- User messages show a small ⧉ button in the corner of the role label — copies your typed message
- Completed assistant messages show a "⧉ Copy" pill at the bottom — copies the full markdown text
- Code blocks inside any assistant message have their own per-block Copy button in the header
- All buttons flash ✓ for ~1 second after a successful copy
Configuration
All settings are under kimi.* and editable via VSCode's Settings UI (Ctrl+,).
| Setting | Default | What it does |
|---|---|---|
kimi.displayName |
"" |
Your name (display only, shown in the chat header) |
kimi.model |
kimi-k2.6 |
Moonshot model id. Allowed: kimi-k2.6, kimi-k2.7-code, kimi-k2.7-code-highspeed, kimi-k2.5, kimi-k2-turbo-preview, kimi-k2-thinking |
kimi.mode |
ask |
Approval mode: ask / accept_edits / plan / bypass. Also editable from the bottom-of-chat mode bar |
kimi.maxTurns |
25 |
Max agent turns per task before stopping |
kimi.maxTaskTokens |
500000 |
Max total tokens per task before stopping |
kimi.autoApprove.read |
true |
Auto-approve read-only operations (file reads, list, search) |
kimi.autoApprove.write |
false |
Auto-approve write_file / apply_diff. Same effect as Mode = "Accept edits" |
kimi.autoApprove.commands |
[] |
Regex patterns for execute_command allowlist. "Approve & remember" appends ^<exact-command>$ here |
kimi.pricing.inputPerMillion |
0.6 |
USD per 1M input tokens — cost-estimate footer only. Update to match Moonshot's current pricing |
kimi.pricing.outputPerMillion |
2.5 |
USD per 1M output tokens |
kimi.mcp.enabled |
true |
Enable/disable MCP servers globally |
kimi.mcp.autoApprove |
ask |
MCP tool approval mode: ask / per_server / all |
kimi.mcp.servers |
[] |
Connected MCP servers (managed via UI, not directly editable) |
The
kimi.pricing.*defaults are placeholders. Update them to match the rates listed at platform.moonshot.ai/docs/pricing for accurate cost estimates.
Model Context Protocol (MCP) Configuration
Quick Start
- Open the Kimi sidebar and go to Settings (⚙ icon)
- Scroll to Model Context Protocol (MCP)
- Click + Add Server or Marketplace to browse 19 pre-configured servers
Marketplace Servers (19 Available)
Data & Databases
- GitHub — Search repos, read issues, create PRs
- PostgreSQL — Query remote PostgreSQL databases
- SQLite — Query local SQLite files
- Jira — Create, search, and manage Jira tickets
Communication & Messaging
- Slack — Send messages, list channels
- Twilio — Send SMS and WhatsApp messages
- Discord — Send messages, manage Discord servers
Search & Reference
- Brave Search — Real-time web search
- Wikipedia — Search and retrieve articles
- YouTube — Search videos and retrieve metadata
- Cheerio — Lightweight HTML parsing and web scraping
Cloud & DevOps
- AWS — Manage EC2, S3, Lambda, CloudWatch, and other AWS services
- Docker — Manage containers, images, and inspect Docker resources
- Google Workspace — Gmail, Google Drive, Sheets, Calendar integration
Development & Package Management
- npm — Search npm registry, check package versions, dependencies
- Filesystem — Access files outside the workspace
- Browser (Puppeteer) — Web scraping, screenshots, automation
Project Management & Docs
- Linear — Modern issue tracking, create and manage Linear tickets
- Notion — Access Notion databases, pages, and create content
Installation Steps
-
From Marketplace: Click Marketplace in MCP settings → select a server → fill in credentials (if required) → click Add Server
- Credentials are securely stored per-server in VS Code's secret storage
- Servers are tested on connection; status shows as 🟢 (connected), 🟡 (connecting), or 🔴 (failed)
-
Manual Add: Click + Add Server, enter name, select transport (stdio or HTTP SSE), provide command/URL and environment variables
-
AI-Generated: Click AI Generate, describe what you need, and Kimi will generate a custom MCP server config based on your description
Configuration Options per Server
- Enabled/Disabled — Toggle the On checkbox to activate/deactivate
- Auto-approve — "Auto-approve tools from this server" skips approval prompts for all tools from this server
- View Discovered Tools — Click Details to see all tools the server provides, their names, and descriptions
Approval Modes
Control how MCP tool calls are handled via the MCP Tool Approval dropdown:
| Mode | Behavior |
|---|---|
| Ask for every MCP tool call (default) | Show approval card for each tool call |
| Auto-approve per-server | Auto-approve tools from servers marked as trusted; ask for others |
| Auto-approve all MCP tools | Never ask; all tool calls auto-approve (use only in trusted workspaces) |
Troubleshooting MCP
Server shows 🔴 (failed)
- Check the status message for details (click Details to expand)
- Verify credentials are correct
- For stdio servers, ensure the command is in your PATH or fully qualified
- Check the MCP output channel: Open Output panel → select Kimi MCP from the dropdown
Tool not appearing
- Click Collapse then Details on the server to refresh tool list
- Remove and re-add the server if it's still missing
"Tool call failed" errors
- Check that the MCP server is 🟢 (connected)
- Review the tool's expected input schema (shown in Details)
- Check the MCP output channel for errors
Credentials not saving
- Ensure you clicked the Add Server button, not just filled in the form
- If credentials are sensitive, copy them again and re-enter (secret storage is case-sensitive)
Commands (command palette)
| Command | What it does |
|---|---|
Kimi: New Task |
Reveals the sidebar and starts a fresh task |
Kimi: Set Moonshot API Key |
Prompt for your API key and store it in SecretStorage |
Kimi: Clear Moonshot API Key |
Remove the saved key |
Kimi: Clear Conversation History |
Clear the current in-memory conversation (saved tasks remain on disk) |
Development
# Install (postinstall also runs `npm install` in webview-ui/)
npm install
# Build host + webview
npm run compile
# Watch mode (concurrent esbuild + vite)
npm run dev
Open the project folder in VSCode and press F5 to launch an Extension Development Host with the extension loaded. Iterating: edit, save, reload the dev host (Ctrl+R).
If F5 prompts about a debugger port being in use, press Esc — the extension still loads, you just won't have the debugger attached.
To produce a sideloadable .vsix:
npm install -g @vscode/vsce
npm run compile
npx @vscode/vsce package
# Outputs kimi-code-moonshot-api-<version>.vsix in the repo root.
See PUBLISHING.md for the full marketplace publish flow (publisher setup, PAT, vsce publish) and SMOKE_TEST.md for the pre-release verification checklist.
Repo layout
src/ extension host (TypeScript)
extension.ts activation
config.ts constants (base URL, model, command ids)
secrets.ts SecretStorage wrapper + key redaction
api/
moonshotClient.ts OpenAI SDK pointed at api.moonshot.ai
balance.ts Moonshot user balance fetch
agent/
agentLoop.ts ReAct loop: stream chat, dispatch tools
systemPrompt.ts system prompt (markdown style + safety rules)
pathSafety.ts reject paths outside the workspace
diffProvider.ts kimi-pending: scheme for diff-view content
approval.ts diff summary helpers
modes.ts ApprovalMode + auto-decide + tool filtering
slashCommands.ts slash command registry
attachmentStore.ts + button + @ mention attachments
tools/ read_file, list_files, search_files,
write_file, apply_diff, execute_command
persistence/taskStore.ts JSON-per-task in globalStorageUri
webview/
provider.ts sidebar host + agent orchestration
messages.ts host↔webview discriminated union
webview-ui/ React app (Vite)
src/
App.tsx, store.ts, vscodeApi.ts, styles.css
components/
Chat.tsx, MessageBubble.tsx, MarkdownView.tsx, CodeBlock.tsx
InputBox.tsx, SlashMenu.tsx, MentionMenu.tsx, AttachmentChips.tsx
ModeBar.tsx, CopyButton.tsx
ToolUseCard.tsx, ApprovalCard.tsx
SettingsPanel.tsx, HistoryPanel.tsx
Troubleshooting
"No Moonshot API key set." — Open the Kimi sidebar, paste your key, or run Kimi: Set Moonshot API Key.
400 thinking is allowed but reasoning-content is missing in assistant tool at index N — This was a bug fixed in 0.8.x; if you see it on a fresh build, you're on an outdated bundle. Run npm run compile and reload the dev host.
Empty token / balance footer. — The footer only appears once Moonshot's API returns a usage block (after the first turn) and a balance from /v1/users/me/balance. If your account doesn't return either field, the footer stays hidden — the rest of the extension still works.
apply_diff keeps saying "search text not found". — The model's hunks must match the current file content exactly (whitespace-sensitive). Ask Kimi to re-read the file before re-trying.
Command times out. — Default is 5 minutes. Pass timeout_seconds in your prompt (e.g. "run X with a 20-minute timeout") or raise it for that turn.
Agent stops with "Reached the agent turn limit". — Send a follow-up message; the conversation continues from where it left off. To raise the cap, edit kimi.maxTurns.
Pricing footer is wrong. — Moonshot pricing changes; the defaults ($0.6 / $2.5 per 1M tokens) are placeholders. Set kimi.pricing.inputPerMillion / kimi.pricing.outputPerMillion to current rates.
@ autocomplete shows nothing. — Open a workspace folder (File → Open Folder). Mentions search files via vscode.workspace.findFiles, which needs a workspace.
Task history is empty after rename. — globalStorage is keyed by extension id. Renaming the package gave the extension a new id, so old tasks live under the previous id. Either revert the package name temporarily to recover them, or accept the fresh slate.
License
MIT — see LICENSE.
Disclaimer
Unofficial. This extension is not affiliated with or endorsed by Moonshot AI. "Kimi" and "Moonshot" are trademarks of their respective owners. The extension exists to let users who already pay Moonshot per-token use that API key inside VSCode without additional subscriptions.