Kimi Code Moonshot APIAn agentic coding assistant for VSCode powered by Moonshot's Kimi K2.6 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.
What's new in 0.15.0
Why this existsThe 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 on Windows / macOS / Linux without changing IDEs. FeaturesChat that feels like Claude Code
Agent capabilities
Approval modes (bottom of the chat)
Input affordances
Task history
EDITOR widget — chat in a full editor tab
KIMI2.6 Instructions — discipline on every response
Model Context Protocol (MCP) — Extend Kimi with External ServicesConnect 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):
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 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
Setup — step by stepStep 1: Get a Moonshot API key
Step 2: Install the extensionFrom the marketplace (once published):
From a local
Step 3: Open the Kimi sidebarClick 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
The chat view replaces the welcome panel. Your key is now in the OS credential store.
Step 5: (Recommended) Open a workspace folderMany of the tools ( Step 6: Send your first messageType any question and hit Enter. You should see a streaming response. The token/cost/balance footer appears under the input. Using the new affordancesSlash commands (
|
| 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-turbo-preview, /model kimi-k2-thinking |
/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.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.