VS Code language model provider that connects Copilot Chat to Moonshot Kimi. Just enter your API key from kimi.com/code/console and start chatting with the model in VS Code Copilot Chat/Agent.
- Install dependencies:
npm install - Compile:
npm run compile - Run npx
vsce packageto create the.vsixfile. - Load the extension in VS Code.
- Configure
apiKeyfromkimi.com/code/consolein the model provider settings.
- Base URL:
https://api.kimi.com/coding/v1 - Chat endpoint:
/chat/completions - Full endpoint used by the client:
https://api.kimi.com/coding/v1/chat/completions
The client sends:
modelmessagesstreamthinking(as{ type: "enabled", keep: "all" }or{ type: "disabled" })top_p(optional)max_completion_tokens(optional)tools(optional)tool_choice(optional,autoorrequired)stop(optional)prompt_cache_key(optional, frommetadata.taskId)
Notes:
temperatureis not sent by this extension. I am letting API handle it by itself. Chinese providers are better at handling these stuff by themselves, and I don't want to mess with it.safety_identifieris not sent.- Image and data attachments are supported via
LanguageModelDataPart; images are base64-encoded intoimage_urlobjects.
Currently, Kimi wouldn't accept ANY clients so we need to send extra headers to larp as an accepted client.
Each request includes:
Content-Type: application/jsonAuthorization: Bearer <apiKey>User-Agent: KimiCLI/<version>X-Msh-Platform: kimi_cliX-Msh-Version: <version>X-Msh-Device-Name: <hostname>X-Msh-Device-Model: <OS model>X-Msh-Device-Id: <generated device id>X-Msh-Os-Version: <OS version>
- Streaming responses are consumed as SSE (
data:lines). - Reasoning content (
reasoning_content) is streamed and rendered in collapsible<details><summary>Thinking</summary>blocks. - Tool calls are collected from streamed deltas and emitted when the model finishes with
tool_calls. - If the model returns tool calls after reasoning, the reasoning block is automatically closed before the tool calls are emitted.