copilot-custom-endpoint 1.6.8 → 1.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,15 +2,15 @@
2
2
 
3
3
  > **TL;DR:** GLM works directly with VS Code's custom-endpoint provider — **no proxy needed**. The API is OpenAI Chat Completions compatible at `https://api.z.ai/api/paas/v4/chat/completions`, and Z.ai's default `thinking.clear_thinking: true` quietly strips `reasoning_content` from prior turns, which makes multi-turn tool loops stable even when VS Code doesn't preserve reasoning blocks.
4
4
  >
5
- > **Billing:** The PaaS API is **Pay-as-You-Go** (per-token). Z.ai also offers a **Coding Plan** subscription (Lite/Pro/Max, $18–$160/mo), but it uses a **different endpoint** (`/api/coding/paas/v4`) that is **locked to a curated list of coding tools** (Claude Code, Cursor, Cline, etc.) — it **cannot** be used from VS Code custom endpoints. See [Why the GLM Coding Plan is not an option](#why-the-glm-coding-plan-is-not-an-option-for-vs-code).
5
+ > **Billing:** The PaaS API is **Pay-as-You-Go** (per-token). Z.ai also offers a **Coding Plan** subscription (Lite/Pro/Max, $18–$160/mo), but it uses a **different endpoint** (`/api/coding/paas/v4`) that is **locked to a curated list of coding tools** (Claude Code, Cursor, Cline, etc.) — it **cannot** be used from VS Code custom endpoints.
6
6
  >
7
- > **🆕 GLM VS Code extensions are available.** Three community extensions add reasoning visibility (collapsible thinking blocks), per-model thinking toggles, usage dashboards, and more — all impossible with custom endpoints. Two of them support **Standard API** keys. See the [full comparison](../research/glm-vscode-extension.md) for details:
8
- >
9
- > | Extension | Marketplace ID | Standard API | Coding Plan | Key feature |
10
- > | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | :----------: | :---------: | ----------------------------------- |
11
- > | **GLM for Copilot** (umbrella22) | [`ikaros.glm-for-vscode-copilot`](https://marketplace.visualstudio.com/items?itemName=ikaros.glm-for-vscode-copilot) | ✅ | ✅ | Vision proxy, cost est., team mode |
12
- > | **GLM Models for Copilot** (KiwiGaze) | [`yijiazhen-qi.glm-for-github-copilot-chat`](https://marketplace.visualstudio.com/items?itemName=yijiazhen-qi.glm-for-github-copilot-chat) | ✅ | ✅ | Quota dashboard, dual API |
13
- > | **GLM Chat Provider** (zelosleone) | _(pending)_ | ❌ | ✅ | 14 models, per-model thinking tiers |
7
+ > **🆕 GLM VS Code extensions are available.** Three community extensions add reasoning visibility (collapsible thinking blocks), per-model thinking toggles, usage dashboards, and more — all impossible with custom endpoints. See [the full comparison](../research/glm-vscode-extension.md):
8
+
9
+ | Extension | Marketplace ID | Standard API | Coding Plan | Key feature |
10
+ | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | :----------: | :---------: | ----------------------------------- |
11
+ | **GLM for Copilot** (umbrella22) | [`ikaros.glm-for-vscode-copilot`](https://marketplace.visualstudio.com/items?itemName=ikaros.glm-for-vscode-copilot) | ✅ | ✅ | Vision proxy, cost est., team mode |
12
+ | **GLM Models for Copilot** (KiwiGaze) | [`yijiazhen-qi.glm-for-github-copilot-chat`](https://marketplace.visualstudio.com/items?itemName=yijiazhen-qi.glm-for-github-copilot-chat) | ✅ | ✅ | Quota dashboard, dual API |
13
+ | **GLM Chat Provider** (zelosleone) | _(pending)_ | ❌ | ✅ | 14 models, per-model thinking tiers |
14
14
 
15
15
  ## At a Glance
16
16
 
@@ -27,7 +27,7 @@
27
27
  | Endpoint (China) | `https://open.bigmodel.cn/api/paas/v4/chat/completions` |
28
28
  | Auth | `Authorization: Bearer $ZAI_API_KEY` |
29
29
 
30
- ### Models at a glance
30
+ ### Models
31
31
 
32
32
  | Model | Vision | Context | Max output | Thinking | Cost (in / out per 1M) | Role |
33
33
  | -------------- | ------ | ------- | ---------- | --------- | ---------------------- | ---------------------------------------------------------------------------------------- |
@@ -35,13 +35,13 @@
35
35
  | `glm-5.1` | ❌ | 200K | 131072 | `enabled` | $1.40 / $4.40 | Previous flagship — long-horizon / 8h autonomous work |
36
36
  | `glm-5v-turbo` | ✅ | 200K | 131072 | `enabled` | $1.20 / $4.00 | Multimodal **coding** model — vision-based agentic coding |
37
37
 
38
- > Other GLM models — `glm-5`, `glm-5-turbo`, `glm-4.6v-flashx`, `glm-4.5`, `glm-4.5-air`, `glm-4.5-flash`, `glm-4.5-x`, `glm-4.5-airx`, `glm-4-32b-0414-128k` — are callable on the same endpoint but are intentionally **not** added to the default `chatLanguageModels.json` block below. Add them in the same shape if you need them. Note: `glm-4.6v-flashx` was previously in the default block but has been **removed** because live testing showed it is not reliable for tool calling.
38
+ > Other GLM models (`glm-5`, `glm-5-turbo`, `glm-4.5-air`, etc.) are callable on the same endpoint but are intentionally **not** added to the default `chatLanguageModels.json` block below. Add them in the same shape if you need them. Note: `glm-4.6v-flashx` was previously in the default block but has been **removed** because live testing showed it is not reliable for tool calling.
39
39
 
40
40
  ## Quick Start
41
41
 
42
42
  1. **Verify your account** at [z.ai/model-api](https://z.ai/model-api) or [open.bigmodel.cn](https://open.bigmodel.cn) to ensure the flagship models are active under your plan.
43
43
  2. **Generate an API key** on the API Keys page of the platform.
44
- 3. **Edit `chatLanguageModels.json`** — add the GLM block from [Setup](#setup) below.
44
+ 3. **Edit `chatLanguageModels.json`** — add the GLM block below.
45
45
  4. **Set the API key** via Command Palette → **Chat: Manage Language Models** → right-click **GLM** → **Update API Key**.
46
46
  5. **Restart VS Code** and select a GLM model from the picker.
47
47
 
@@ -49,16 +49,12 @@
49
49
 
50
50
  ### 1. VS Code configuration
51
51
 
52
- Config file location:
53
-
54
52
  | OS | Path |
55
53
  | ------- | ----------------------------------------------------------------- |
56
54
  | Windows | `%APPDATA%\Code\User\chatLanguageModels.json` |
57
55
  | macOS | `~/Library/Application Support/Code/User/chatLanguageModels.json` |
58
56
  | Linux | `~/.config/Code/User/chatLanguageModels.json` |
59
57
 
60
- Modify your configuration:
61
-
62
58
  ```json
63
59
  {
64
60
  "name": "GLM",
@@ -118,7 +114,7 @@ Modify your configuration:
118
114
  > **Leave `apiKey` as `""`** — set it through the Language Models UI so VS Code stores it in the OS keychain (it will replace the empty string with a `${input:chat.lm.secret.<id>}` reference).
119
115
  > If you signed up on `bigmodel.cn` (China), swap the `url` values in the block above to the regional endpoint `https://open.bigmodel.cn/api/paas/v4/chat/completions`.
120
116
 
121
- <h3>2. API Key</h3>
117
+ ### 2. API Key
122
118
 
123
119
  1. Open the Command Palette (`Ctrl+Shift+P`).
124
120
  2. Run **Chat: Manage Language Models**.
@@ -132,54 +128,13 @@ Modify your configuration:
132
128
  | **International** (default above) | `https://api.z.ai/api/paas/v4/chat/completions` | [z.ai/model-api](https://z.ai/model-api) — USD billing |
133
129
  | China | `https://open.bigmodel.cn/api/paas/v4/chat/completions` | [open.bigmodel.cn](https://open.bigmodel.cn) — CNY billing |
134
130
 
135
- ## Configuration Reference
136
-
137
- ### Sampling parameters
138
-
139
- | Parameter | Range (hard cap) | Default / Recommended |
140
- | ------------- | ---------------- | --------------------------------------- |
141
- | `temperature` | `[0.0, 1.0]` | `1.0` for GLM-5.2 / 5.1 · `0.6` for 4.5 |
142
- | `top_p` | `[0.01, 1.0]` | `0.95` for GLM 5.x |
143
- | `do_sample` | bool | `true` — set `false` to bypass sampling |
144
-
145
- > **Important:** Z.ai's `temperature` is capped at `1.0` server-side. Sending any value `> 1.0` will immediately reject with a 400.
146
-
147
- ### Thinking mode
148
-
149
- `thinking` is a GLM-specific object. It only applies to **GLM-4.5 and above**.
150
-
151
- | Field | Values | Default | Meaning |
152
- | ------------------------- | ---------------------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
153
- | `thinking.type` | `enabled` / `disabled` | `enabled` for 5.2/5.1/5-Turbo; hybrid for 4.6/4.5 | Force-enable or force-disable chain-of-thought. Hybrid lets the model decide. |
154
- | `thinking.clear_thinking` | bool | **`true`** | When `true`, Z.ai **strips historical `reasoning_content` from prior turns** before sending to the model. |
131
+ ## Notes
155
132
 
156
- > **Why the default is good for VS Code:** with `clear_thinking: true` (the server default), Z.ai doesn't require the client to forward `reasoning_content` between turns. VS Code's custom-endpoint provider doesn't preserve that field across tool turns — but for GLM it doesn't need to, because the server strips it. This avoids the same class of `reasoning_content` 400 errors that bite on MiMo.
157
- > Do **not** set `clear_thinking: false` from VS Code's `requestBody` as it forces the client to feed `reasoning_content` back, which VS Code cannot satisfy.
158
-
159
- | Mode in VS Code | Plain chat | Tool turns |
160
- | ------------------- | -------------------------------- | ---------------------------------------------------- |
161
- | Recommended (above) | Thinking ON | Thinking ON, prior `reasoning_content` auto-stripped |
162
- | Faster/cheaper | `thinking: { type: "disabled" }` | `thinking: { type: "disabled" }` |
163
- | Preserved Thinking | not supported in VS Code | do not enable `clear_thinking: false` |
164
-
165
- ### Capabilities & Key Leaps
166
-
167
- - **Solid 1M Lossless Context:** Unlike simple context-extension solutions that suffer from attention-drift, `glm-5.2` is trained targeting flawless retention and retrieval (no "needle-in-a-haystack" loss) up to 1,000,000 tokens. This lets it easily context-load whole file trees.
168
- - **Agentic coding reinforcement:** Deeply optimized through several months of focused reinforcement learning to execute long-horizon Coding Agent tasks (such as ZCode 3.0 integrations, multi-file structural implementation, and automated bug debugging and research/refactoring).
169
- - **Tool calling** with the standard `tools` array. `tool_choice` accepts only `auto`.
170
- - **Tool stream** (`tool_stream: true`) is supported on the `glm-5v-turbo` family and `glm-5.2` for streaming tool-call deltas.
171
- - **Vision** on `glm-5v-turbo` only, using the OpenAI `image_url` content-part format. External URLs and base64 data URIs both work. (`glm-5.2` and `glm-5.1` are text-only — see [Z.ai's GLM-5.2 model card](https://docs.z.ai/guides/llm/glm-5.2): Input Modalities = Text.)
172
- - **Video input** on `glm-5v-turbo` — the model natively accepts video (Input Modality: **Video / Image / Text / File**). For a turnkey VS Code integration that bridges the gap (extracts frames, routes them to GLM or a fallback provider, and answers natural-language questions about the video), see [**Video Context MCP**](https://www.videocontextmcp.com/) — an MCP server that gives Copilot/Cursor/Claude Code video understanding via the `glm-5v-turbo` provider.
173
- - **Native multimodal tool calling** on `glm-5v-turbo` — images, screenshots, and document pages can be passed directly as tool parameters and tool results can be consumed visually.
174
- - **Context caching** is automatic — the API returns `usage.prompt_tokens_details.cached_tokens` on cache hits; cache writes are currently free of charge.
175
-
176
- ### Rate limits
177
-
178
- Z.ai throttles **by in-flight concurrency**, not classic RPM/TPM. The exact per-model limits are shown on the [Rate Limits dashboard](https://z.ai/manage-apikey/rate-limits) once you are signed in. **All paid models share a generous pool sized to your prepaid balance.**
179
-
180
- For large or high-complexity tasks, use the `glm-5.2` flagship ($1.40 / $4.40 per 1M). For vision-capable work, use the `glm-5v-turbo` model ($1.20 / $4.00 per 1M). For text-only use, `glm-5.1` ($1.40 / $4.40 per 1M) remains available.
181
-
182
- > The **GLM Coding Plan** has separate (much higher) concurrency limits but is **not available via custom endpoints** — see [Why the Coding Plan is not an option](#why-the-glm-coding-plan-is-not-an-option-for-vs-code) below.
133
+ - **Sampling:** recommended `temperature: 1`, `top_p: 0.95`. Z.ai's `temperature` is **hard-capped at `1.0` server-side** — sending `> 1.0` will reject with a 400. Don't set `do_sample: false` from `requestBody` (it would make `temperature`/`top_p` be ignored).
134
+ - **`tool_choice` only supports `auto`** — don't override it (VS Code's default is `auto`).
135
+ - **`clear_thinking` defaults to `true` server-side**, which strips historical `reasoning_content` from prior turns before sending to the model. This is what makes multi-turn tool loops stable. **Do not** set `clear_thinking: false` from `requestBody` — VS Code can't forward `reasoning_content` and the request will fail.
136
+ - **Vision** is supported only on `glm-5v-turbo` (OpenAI `image_url` content-part format — external URLs and base64 data URIs both work). `glm-5.2` and `glm-5.1` are text-only. For turnkey VS Code video understanding via `glm-5v-turbo`, see [**Video Context MCP**](https://www.videocontextmcp.com/).
137
+ - **Context caching** is automatic — `usage.prompt_tokens_details.cached_tokens` reports cache hits; cache writes are currently free.
183
138
 
184
139
  ## Troubleshooting
185
140
 
@@ -195,68 +150,8 @@ For large or high-complexity tasks, use the `glm-5.2` flagship ($1.40 / $4.40 pe
195
150
  | Upstream complains about `reasoning_content is missing` | You set `clear_thinking: false` from a client that doesn't forward it | Drop `clear_thinking` from `requestBody` |
196
151
  | 429 / "concurrency limit exceeded" | Too many in-flight requests | Reduce concurrent agent sessions, or upgrade your Z.ai plan |
197
152
 
198
- | Long Chinese responses when the prompt is English | Missing `Accept-Language: en-US,en` (Z.ai default) | Optional — VS Code's custom-endpoint provider doesn't set custom headers; usually the prompt language wins |
199
-
200
153
  ## Pricing
201
154
 
202
- All prices are **USD per 1M tokens** (cache miss) on the Z.ai international platform. Per-model input/output rates are listed in the `Cost` column of the [Models at a glance](#models-at-a-glance) table above.
155
+ All prices are **USD per 1M tokens** (cache miss) on the Z.ai international platform. Per-model input/output rates are listed in the `Cost` column of the [Models](#models) table above.
203
156
 
204
157
  > **Cache writes** are currently **Limited-time Free** for all models. Cached-input pricing is roughly 18% of the input price (e.g. `$1.40` input → `$0.25` cached for `glm-5.1` / `glm-5.2`). China platform (`bigmodel.cn`) prices in CNY; see the [China pricing page](https://bigmodel.cn/pricing). For the cross-provider comparison, see [docs/pricing.md](../pricing.md).
205
-
206
- ---
207
-
208
- ## Background & Findings
209
-
210
- > This appendix preserves the validation narrative for future reference. It is not required to use the model.
211
-
212
- ### Why GLM was a reasonable candidate
213
-
214
- Z.ai publishes an OpenAI-Chat-Completions-compatible API at `https://api.z.ai/api/paas/v4/chat/completions` with:
215
-
216
- - Standard Bearer auth (`Authorization: Bearer <key>`).
217
- - Standard request/response shapes (`messages`, `tools`, `tool_calls`, `stream`).
218
- - Standard `model`, `temperature`, `top_p`, `max_tokens`, `response_format`.
219
- - A documented OpenAI SDK `base_url` of `https://api.z.ai/api/paas/v4/`.
220
-
221
- That makes VS Code's `chat-completions` provider the obvious starting point — same shape as DashScope, Moonshot, and MiMo, all of which already work in this repo.
222
-
223
- ### What differs from other providers in this repo
224
-
225
- | Concern | Z.ai / GLM behaviour | Why it matters for VS Code |
226
- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
227
- | Thinking default | Always-on for `glm-5.2`, `glm-5.1` / `glm-5v-turbo`. | VS Code can simply set `thinking: { type: "enabled" }` in `requestBody` to make thinking deterministic on every model. |
228
- | `reasoning_content` on tool turns | Z.ai defaults to `clear_thinking: true`, **silently stripping historical `reasoning_content`**. | This is a near-perfect match for VS Code, which does **not** preserve `reasoning_content` between turns. Loops work without extra plumbing. |
229
- | `tool_choice` | Only `auto` is accepted. | VS Code's default behaviour is `auto`, so no override needed. |
230
- | `temperature` hard cap | `[0.0, 1.0]` — strictly enforced server-side. | Use `1.0` for coding/agent work; never go above. |
231
- | `do_sample` | Default `true`. When `false`, `temperature` and `top_p` are ignored. | Don't set `do_sample: false` from `requestBody` — you'll lose the sampling you just configured. |
232
- | Coding Plan endpoint | A separate endpoint at `https://api.z.ai/api/coding/paas/v4` (Anthropic flavour at `/anthropic`) is **locked to specific tools**. | Cannot be used for VS Code custom endpoints — see below. |
233
- | Vision (image input + tool use) | OpenAI `image_url` content-part format (external URLs and base64 data URIs both work). **`glm-5v-turbo` only** supports vision and **native multimodal tool use** (images as tool args, tool results consumed visually). `glm-5.2` and `glm-5.1` are text-only. | Same as OpenAI for input; native multimodal tool use enables vision-driven agent loops in VS Code. |
234
-
235
- ### Why the GLM Coding Plan is **not** an option for VS Code
236
-
237
- The Coding Plan ($18–$160/mo) is a subscription that gates access to a small set of officially supported tools: **Claude Code, Cline, OpenCode, Kilo Code, Crush, Factory, and a handful of others**. The relevant callouts from Z.ai's own docs:
238
-
239
- - _"The GLM Coding Plan is strictly limited to use within officially supported tools and product environments; users may not use their subscription benefits for tools or scenarios outside of this scope."_
240
- - _"If the system detects usage through unauthorized or unsupported tools (such as SDK-based access or other third-party integrations), some subscription benefits may be restricted."_
241
- - The Coding endpoint base URL (`/api/coding/paas/v4`) is the only one that consumes the subscription quota — the general `/api/paas/v4` endpoint **always** charges against pay-as-you-go balance, even if you have an active Coding Plan.
242
-
243
- VS Code's custom-endpoint provider is not on the supported list, so the Coding Plan endpoint is the wrong target. The general `/api/paas/v4/chat/completions` endpoint is the correct one, and it bills against your prepaid Z.ai balance.
244
-
245
- ### Plan for this repo
246
-
247
- This file is the **research record and the user-facing setup guide**. The implementation work, when carried out, will be:
248
-
249
- 1. **Add the `chatLanguageModels.json` block** shown above into [docs/example-config.md](../example-config.md) so users can copy all-providers-at-once.
250
- 2. **Add a row to the model table** in [README.md](../../README.md) point to `docs/models/glm.md`.
251
- 3. **No new proxy.** The direct path is sufficient.
252
- 4. **No CLI / npm-script changes.** `npm run proxy` continues to start Kimi + Qwen; GLM does not need a local process.
253
- 5. **No test changes.** Unit + integration tests in `tests/` are scoped to the existing proxies; GLM has no proxy, so there is nothing new to assert.
254
- 6. **Live validation complete for `glm-5.2`, `glm-5v-turbo`, and `glm-5.1` (text-only).**
255
-
256
- ### Validation results
257
-
258
- #### VS Code live validation (2026-06-21 Update)
259
-
260
- - **GLM 5.2 — full pass (text-only):** Verified **1M Solid context**, **AA score 51.0**, and flawless multi-turn agent loops with `clear_thinking: true` server routine. Vision **not** tested — `glm-5.2` is text-only per [Z.ai's model card](https://docs.z.ai/guides/llm/glm-5.2) (Input Modalities: Text). Earlier drafts of this doc incorrectly marked `glm-5.2` as vision-capable; corrected 2026-06-22.
261
- - **GLM 5V Turbo — full pass:** Native screenshot validation described flawlessly; multimodal agentic tool loops success.
262
- - **GLM 5.1 — full pass:** Conservative 200K window tested perfectly with multi-step structural debugging tasks.
@@ -1,8 +1,8 @@
1
1
  # Kimi — VS Code Custom Endpoint Setup Guide
2
2
 
3
- > **TL;DR:** Kimi models require the local proxy. The K2 family locks `temperature: 1` and `top_p: 0.95`. K2.6 requires `thinking: { type: "disabled" }` on tool turns; **K2.7 Code is always-thinking and rejects `thinking: disabled`**, so the proxy detects `kimi-k2.7*` and skips that rewrite while keeping sampling enforcement. Direct VS Code → Moonshot integration is not viable in this environment.
3
+ > **TL;DR:** Kimi models require the local proxy. The K2 family locks `temperature: 1` and `top_p: 0.95`. K2.6 needs `thinking: { type: "disabled" }` on tool turns; **K2.7 Code is always-thinking and rejects `thinking: disabled`**, so the proxy detects `kimi-k2.7*` and skips that rewrite while keeping sampling enforcement. Direct VS Code → Moonshot is not viable.
4
4
  >
5
- > **🆕 Alternative: Kimi VS Code extension.** If you're on the **Kimi Coding tier** (`kimi.com/code/console`), try the [**Moonshot LM Provider**](https://marketplace.visualstudio.com/items?itemName=DenizhanDaklr.kimi-lm-provider) extension — it offers zero-proxy setup, reasoning visibility via `LanguageModelThinkingPart`, prompt caching, and a simpler install. **Not compatible with Pay-as-You-Go** keys from `platform.kimi.ai`. See the [full comparison](../research/kimi-vscode-extension.md).
5
+ > **🆕 Alternative:** On the **Kimi Coding tier** (`kimi.com/code/console`), the [**Moonshot LM Provider**](https://marketplace.visualstudio.com/items?itemName=DenizhanDaklr.kimi-lm-provider) extension offers zero-proxy setup with reasoning visibility. **Not compatible with Pay-as-You-Go** keys from `platform.kimi.ai`. See [the extension comparison](../research/kimi-vscode-extension.md).
6
6
 
7
7
  ## At a Glance
8
8
 
@@ -15,54 +15,26 @@
15
15
  | Upstream endpoint | `https://api.moonshot.ai/v1/chat/completions` |
16
16
  | Proxy endpoint | `http://127.0.0.1:3457/v1/chat/completions` |
17
17
 
18
- ### Deprecated K2 model ids
18
+ ### Models
19
19
 
20
- Moonshot's official model catalog says the older `kimi-k2` preview and thinking variants were **officially discontinued on May 25, 2026** and are no longer maintained or supported. Deprecated ids:
20
+ | Model id | Context | Max output | Notes |
21
+ | ---------------- | ------- | ---------- | --------------------------------------------------------------------------------- |
22
+ | `kimi-k2.6` | 262K | 32768 | Proxy forces `thinking: { type: "disabled" }` on tool turns |
23
+ | `kimi-k2.7-code` | 262K | 4096 | Always-thinking; rejects `thinking: disabled`. Keep `maxOutputTokens` low (4096). |
21
24
 
22
- - `kimi-k2-0905-preview`
23
- - `kimi-k2-0711-preview`
24
- - `kimi-k2-turbo-preview`
25
- - `kimi-k2-thinking`
26
- - `kimi-k2-thinking-turbo`
27
-
28
- For current use, stick to `kimi-k2.6` or `kimi-k2.7-code`. As of June 24, 2026, Moonshot still lists `kimi-k2.5`, `kimi-k2.6`, `kimi-k2.7-code`, and `kimi-k2.7-code-highspeed` as active models.
29
-
30
- ### K2.6
31
-
32
- | Field | Value |
33
- | ---------------------- | ------------------------------------ |
34
- | Model id | `kimi-k2.6` |
35
- | Context | 262K |
36
- | Max output | 32768 |
37
- | Required `requestBody` | `temperature: 1` |
38
- | Tool calling | ✅ Proxy forces `thinking: disabled` |
39
-
40
- ### K2.7 Code
41
-
42
- | Field | Value |
43
- | ---------------------- | ---------------------------------------------------------- |
44
- | Model id | `kimi-k2.7-code` |
45
- | Context | 262K |
46
- | Max output | 4096 |
47
- | Required `requestBody` | `temperature: 1`, `max_tokens: 4096` |
48
- | Tool calling | ✅ Proxy lets K2.7 think (it rejects `thinking: disabled`) |
25
+ > Deprecated K2 ids (`kimi-k2-0905-preview`, `kimi-k2-turbo-preview`, `kimi-k2-thinking`, etc.) were discontinued May 25, 2026 — use K2.6 or K2.7.
49
26
 
50
27
  ## Quick Start
51
28
 
52
- 1. **Start the proxy** — choose one:
53
- - `npm run proxy:kimi` (from the repo root)
54
- - `npx copilot-custom-endpoint kimi` (standalone, no clone needed)
55
- - `npx copilot-custom-endpoint` (also starts the Qwen and MiMo proxies concurrently)
56
- 2. **Edit `chatLanguageModels.json`** — add the Kimi block from [Setup](#setup) below.
57
- 3. **Set your Moonshot API key** via the Command Palette → **Chat: Manage Language Models**.
58
- 4. **Restart VS Code** and pick "Kimi K2.6" or "Kimi K2.7 Code" in the chat picker.
29
+ 1. **Start the proxy** — `npm run proxy:kimi` (or `npx copilot-custom-endpoint kimi` standalone).
30
+ 2. **Edit `chatLanguageModels.json`** — add the Kimi block below.
31
+ 3. **Set your Moonshot API key** via Command Palette → **Chat: Manage Language Models**.
32
+ 4. **Restart VS Code** and pick "Kimi K2.6" or "Kimi K2.7 Code".
59
33
 
60
34
  ## Setup
61
35
 
62
36
  ### 1. VS Code configuration
63
37
 
64
- Config file location:
65
-
66
38
  | OS | Path |
67
39
  | ------- | ----------------------------------------------------------------- |
68
40
  | Windows | `%APPDATA%\Code\User\chatLanguageModels.json` |
@@ -80,9 +52,7 @@ Config file location:
80
52
  "id": "kimi-k2.6",
81
53
  "name": "Kimi K2.6 (vision)",
82
54
  "url": "http://127.0.0.1:3457/v1/chat/completions",
83
- "requestBody": {
84
- "temperature": 1
85
- },
55
+ "requestBody": { "temperature": 1 },
86
56
  "toolCalling": true,
87
57
  "vision": true,
88
58
  "streaming": true,
@@ -93,10 +63,7 @@ Config file location:
93
63
  "id": "kimi-k2.7-code",
94
64
  "name": "Kimi K2.7 Code (vision)",
95
65
  "url": "http://127.0.0.1:3457/v1/chat/completions",
96
- "requestBody": {
97
- "temperature": 1,
98
- "max_tokens": 4096
99
- },
66
+ "requestBody": { "temperature": 1, "max_tokens": 4096 },
100
67
  "toolCalling": true,
101
68
  "vision": true,
102
69
  "streaming": true,
@@ -107,18 +74,18 @@ Config file location:
107
74
  }
108
75
  ```
109
76
 
110
- > **K2.7 note:** `max_tokens` and `maxOutputTokens` are intentionally conservative at **4096**. K2.7 is always-thinking, so reasoning tokens inflate response size. Values above 24K triggered VS Code's "Response too long" error in agent mode during validation. Raise this only if you have tested your specific workload.
77
+ > **K2.7 note:** `max_tokens` and `maxOutputTokens` are intentionally conservative at **4096**. K2.7 is always-thinking, so reasoning tokens inflate response size. Values above 24K triggered VS Code's "Response too long" error in agent mode.
111
78
 
112
79
  ### 2. API key
113
80
 
114
- Kimi is **Pay-as-You-Go only** — there is no monthly subscription or Token Plan alternative. A single Open Platform API key covers all models. Recharge your balance at `platform.kimi.ai/console`.
81
+ Kimi is **Pay-as-You-Go only** — no subscription. A single Open Platform API key covers all models. Recharge at `platform.kimi.ai/console`.
115
82
 
116
83
  1. Open the Command Palette (`Ctrl+Shift+P`).
117
84
  2. Run **Chat: Manage Language Models**.
118
85
  3. Find the **Kimi** group → **Update API Key**.
119
86
  4. Paste your Moonshot / Kimi Platform API key.
120
87
 
121
- > After setting via the UI, VS Code replaces `"apiKey": ""` with a `${input:chat.lm.secret.<id>}` reference. The Kimi Platform (formerly Moonshot) rebranded to `platform.kimi.ai` in 2026 — the `api.moonshot.ai` upstream endpoint still resolves and the proxy targets it unchanged.
88
+ > VS Code replaces `"apiKey": ""` with a `${input:chat.lm.secret.<id>}` reference. Kimi Platform (formerly Moonshot) rebranded to `platform.kimi.ai` in 2026 — `api.moonshot.ai` still resolves and the proxy targets it unchanged.
122
89
 
123
90
  ### 3. Local proxy
124
91
 
@@ -126,70 +93,33 @@ Kimi is **Pay-as-You-Go only** — there is no monthly subscription or Token Pla
126
93
  | ------------ | ----------------------------------------------------- |
127
94
  | Script | `proxy/kimi-proxy.mjs` |
128
95
  | Listen URL | `http://127.0.0.1:3457/v1/chat/completions` |
129
- | Health check | `http://127.0.0.1:3457/healthz` |
96
+ | Health check | `curl http://127.0.0.1:3457/healthz` |
130
97
  | Start | `npm run proxy:kimi` (or `node proxy/kimi-proxy.mjs`) |
131
98
  | Help | `node proxy/kimi-proxy.mjs --help` |
132
99
 
133
100
  #### Environment variables
134
101
 
135
- All can be set in a `.env` file at the repo root (both proxies `import 'dotenv/config'` automatically).
136
-
137
- | Variable | Default | Purpose |
138
- | ------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------- |
139
- | `KIMI_PROXY_PORT` | `3457` (falls back to `PORT`) | Local listen port |
140
- | `KIMI_UPSTREAM_URL` | `https://api.moonshot.ai/v1/chat/completions` | Upstream Moonshot endpoint |
141
- | `KIMI_PROXY_FORCE_TEMPERATURE` | `1` | Temperature for thinking-mode requests |
142
- | `KIMI_PROXY_FORCE_NON_THINKING_TEMPERATURE` | `0.6` | Temperature when thinking is disabled (tool requests) |
143
- | `KIMI_PROXY_FORCE_TOP_P` | `0.95` | `top_p` forced into request body |
144
- | `KIMI_PROXY_DISABLE_THINKING_WITH_TOOLS` | `1` | Force `thinking={"type":"disabled"}` when tools present |
145
- | `KIMI_PROXY_LOG` | `debug_log/kimi-proxy.ndjson` (relative to proxy script) | Redacted NDJSON log path |
146
-
147
- #### Health check response
148
-
149
- ```json
150
- {
151
- "ok": true,
152
- "upstreamUrl": "https://api.moonshot.ai/v1/chat/completions",
153
- "port": 3457,
154
- "forcedTemperature": 1,
155
- "forcedTopP": 0.95
156
- }
157
- ```
158
-
159
- #### Proxy behavior
160
-
161
- - Forwards the existing `Authorization` header upstream.
162
- - Rewrites plain-chat requests to `temperature: 1` and `top_p: 0.95`.
163
- - For **K2.5/K2.6**: rewrites tool-enabled requests to `thinking: {"type": "disabled"}`, `temperature: 0.6`, and `top_p: 0.95`.
164
- - For **K2.7 Code**: keeps thinking enabled (K2.7 rejects `thinking: disabled` with HTTP 400) and rewrites to `temperature: 1`, `top_p: 0.95`.
165
- - Preserves streaming responses.
102
+ Set in `.env` at the repo root (the proxy `import 'dotenv/config'` automatically).
103
+
104
+ | Variable | Default | Purpose |
105
+ | ------------------------------------------- | --------------------------------------------- | ------------------------------------------------------- |
106
+ | `KIMI_PROXY_PORT` | `3457` | Local listen port |
107
+ | `KIMI_UPSTREAM_URL` | `https://api.moonshot.ai/v1/chat/completions` | Upstream Moonshot endpoint |
108
+ | `KIMI_PROXY_FORCE_TEMPERATURE` | `1` | Temperature for thinking-mode requests |
109
+ | `KIMI_PROXY_FORCE_NON_THINKING_TEMPERATURE` | `0.6` | Temperature when thinking is disabled (tool requests) |
110
+ | `KIMI_PROXY_FORCE_TOP_P` | `0.95` | `top_p` forced into request body |
111
+ | `KIMI_PROXY_DISABLE_THINKING_WITH_TOOLS` | `1` | Force `thinking={"type":"disabled"}` when tools present |
112
+ | `KIMI_PROXY_LOG` | `debug_log/kimi-proxy.ndjson` | Redacted NDJSON log path |
113
+
114
+ #### What the proxy does
115
+
116
+ - Forwards your `Authorization` header upstream.
117
+ - Rewrites plain-chat requests to `temperature: 1`, `top_p: 0.95`.
118
+ - For **K2.5 / K2.6**: rewrites tool-enabled requests to `thinking: { type: "disabled" }`, `temperature: 0.6`, `top_p: 0.95`.
119
+ - For **K2.7 Code**: keeps thinking enabled (K2.7 rejects `thinking: disabled` with HTTP 400); rewrites to `temperature: 1`, `top_p: 0.95`.
120
+ - Preserves streaming responses (SSE).
166
121
  - Writes redacted request summaries to `debug_log/kimi-proxy.ndjson`.
167
122
 
168
- ## Configuration Reference
169
-
170
- ### Sampling parameters
171
-
172
- | Parameter | Value | Notes |
173
- | ------------- | ----------------------------- | -------------------------------- |
174
- | `temperature` | `1` (thinking) / `0.6` (tool) | Locked by model — proxy enforces |
175
- | `top_p` | `0.95` | Locked by model — proxy enforces |
176
-
177
- ### Thinking mode
178
-
179
- | Model | Turn type | Behavior |
180
- | ----------- | ------------ | -------------------------------------------------------------------------- |
181
- | K2.5 / K2.6 | Plain chat | Thinking enabled, `temperature: 1`, `top_p: 0.95` |
182
- | K2.5 / K2.6 | Tool-enabled | `thinking: { type: "disabled" }` forced, `temperature: 0.6`, `top_p: 0.95` |
183
- | K2.7 Code | All turns | Always-thinking, `temperature: 1`, `top_p: 0.95` |
184
-
185
- ### Capabilities
186
-
187
- - Native multimodal: text, image, video input.
188
- - Tool calling with `tool_choice: "auto"`.
189
- - Streaming (SSE).
190
- - `tools` / `tool_calls` only (deprecated `functions` not supported).
191
- - `tool_choice="required"` is **not** supported by the model.
192
-
193
123
  ## Troubleshooting
194
124
 
195
125
  | Symptom | Likely cause | Fix |
@@ -203,103 +133,11 @@ All can be set in a `.env` file at the repo root (both proxies `import 'dotenv/c
203
133
 
204
134
  ## Pricing
205
135
 
206
- For the cross-provider comparison, see [docs/pricing.md](../pricing.md). Kimi models on the **Moonshot direct platform**:
207
-
208
- | Model | Input (cache miss) | Cached input (cache hit) | Output |
209
- | ---------------- | ------------------ | ------------------------ | ---------- |
210
- | `kimi-k2.6` | $0.95 / 1M | $0.16 / 1M | $4.00 / 1M |
211
- | `kimi-k2.7-code` | $0.95 / 1M | $0.19 / 1M | $4.00 / 1M |
212
-
213
- > **K2.7:** No non-thinking mode — always-thinking. Cached input pricing applies.
214
- > Via DashScope, K2.6 is also available at $0.89 / 1M input and $3.71 / 1M output (same model, regional pricing).
215
-
216
- ---
217
-
218
- ## Background & Findings
219
-
220
- > This appendix preserves the validation narrative for future reference. It is not required to use the model.
221
-
222
- ### Why Kimi was a reasonable candidate
223
-
224
- Kimi documents an OpenAI-compatible Chat Completions API with Bearer-token auth, `model` selection, streaming, and `tools` / `tool_calls` — making VS Code Custom Endpoint `chat-completions` mode the lowest-risk starting point.
225
-
226
- ### Why direct integration failed
227
-
228
- Direct VS Code requests to Moonshot failed in stages:
229
-
230
- 1. Initial auth failure while the config still pointed at the older `api.moonshot.cn` endpoint.
231
- 2. `invalid temperature: only 1 is allowed for this model`.
232
- 3. `invalid top_p: only 0.95 is allowed for this model`.
233
- 4. After the first tool-enabled attempt, `thinking is enabled but reasoning_content is missing in assistant tool call message`.
234
-
235
- The model-level `requestBody.temperature = 1` override validated locally but was not sufficient in practice, which strongly suggests that VS Code's Custom Endpoint provider ignored or overwrote some model-specific request fields.
236
-
237
- ### Important caveats from research
238
-
239
- - Kimi documents `tools` / `tool_calls`, not deprecated `functions` / `function_call`.
240
- - `tool_choice="required"` is not supported.
241
- - Thinking controls are Kimi-specific through a `thinking` object and `reasoning_content` fields.
242
- - VS Code BYOK/custom endpoint support does not replace GitHub-hosted features such as inline completions or semantic search.
243
- - K2-family models use fixed sampling values, which made request rewriting necessary when VS Code sent incompatible values.
244
-
245
- ### Validation results
246
-
247
- | Check | Result |
248
- | ------------------------------------------------------- | ------------------------------------------------------- |
249
- | `GET /v1/models` against Moonshot | ✅ HTTP 200 |
250
- | Non-streaming chat against Moonshot | ✅ HTTP 200 |
251
- | Streaming chat against Moonshot | ✅ HTTP 200 |
252
- | Proxy-backed plain chat in VS Code | ✅ |
253
- | Proxy-backed streaming in VS Code | ✅ |
254
- | Proxy-backed integrated-browser tool use (post-rewrite) | ✅ |
255
- | Direct VS Code → Moonshot (no proxy) | ❌ — fails on temperature / top_p / `reasoning_content` |
256
-
257
- ### Tool-enabled validation details
258
-
259
- **Prompt:** "Please open kimi documentation site using vscode integrated browser"
260
-
261
- - First run: browser tool invocation succeeded, but the post-tool follow-up failed because thinking remained enabled and VS Code did not preserve `reasoning_content`.
262
- - Workaround: force `thinking: { "type": "disabled" }` plus `temperature: 0.6` on tool-enabled turns.
263
- - Rerun: both the tool turn and the follow-up model turn returned upstream `200` with `text/event-stream`.
264
-
265
- ### Proxy validation notes
266
-
267
- - Redacted proxy logs confirmed `temperature 0.1 -> 1` and `top_p 1 -> 0.95` for plain-chat requests.
268
- - Redacted proxy logs later confirmed `thinking undefined -> disabled` and `temperature 0.1 -> 0.6` for tool-enabled requests.
269
-
270
- ### K2.7 Code validation results (June 14, 2026)
271
-
272
- | Check | Result |
273
- | ----------------------------------------------------- | ------------------------------------------ |
274
- | `GET /v1/models` — slug confirmed | ✅ `kimi-k2.7-code` |
275
- | Plain chat via proxy | ✅ |
276
- | Tool turn with `thinking: disabled` | ❌ HTTP 400 — rejected by model |
277
- | Tool turn letting K2.7 think | ✅ |
278
- | Two-turn tool loop via proxy | ✅ No `reasoning_content is missing` error |
279
- | VS Code Agent mode — integrated browser opened Google | ✅ |
280
- | `maxOutputTokens` 24K–32K in agent mode | ❌ VS Code "Response too long" |
281
- | `maxOutputTokens` 4096 in agent mode | ✅ |
282
-
283
- ### Final verdict
284
-
285
- - Acceptable for plain chat: **yes** (proxy)
286
- - Acceptable for streaming chat: **yes** (proxy)
287
- - Acceptable for tool-enabled agent use: **yes**, with the local proxy workaround
288
- - K2.7 specifically: **yes**, but keep `maxOutputTokens` low (4096 validated) to avoid VS Code's response-size limit
289
- - Acceptable without a proxy: **no**
136
+ For the cross-provider comparison, see [docs/pricing.md](../pricing.md). Moonshot direct platform rates:
290
137
 
291
- ## References
138
+ | Model | Input (cache miss) | Cached input | Output |
139
+ | ---------------- | ------------------ | ------------ | ---------- |
140
+ | `kimi-k2.6` | $0.95 / 1M | $0.16 / 1M | $4.00 / 1M |
141
+ | `kimi-k2.7-code` | $0.95 / 1M | $0.19 / 1M | $4.00 / 1M |
292
142
 
293
- - VS Code custom endpoint docs: `https://code.visualstudio.com/docs/copilot/customization/language-models#_add-a-custom-endpoint-model`
294
- - Kimi docs index: `https://platform.kimi.ai/docs/llms.txt`
295
- - Kimi model catalog (includes deprecated models): `https://platform.kimi.ai/docs/models.md`
296
- - Kimi chat completion docs: `https://platform.kimi.ai/docs/api/chat.md`
297
- - Kimi models list: `https://platform.kimi.ai/docs/api/list-models.md`
298
- - Kimi model parameter reference: `https://platform.kimi.ai/docs/api/models-overview.md`
299
- - Kimi tool use docs: `https://platform.kimi.ai/docs/api/tool-use.md`
300
- - Kimi K2.6 quickstart: `https://platform.kimi.ai/docs/guide/kimi-k2-6-quickstart.md`
301
- - Kimi thinking guide: `https://platform.kimi.ai/docs/guide/use-kimi-k2-thinking-model.md`
302
- - Kimi web search guide: `https://platform.kimi.ai/docs/guide/use-web-search.md`
303
- - Kimi coding tools / agent guide: `https://platform.kimi.ai/docs/guide/agent-support.md`
304
- - Kimi K2.6 pricing: `https://platform.kimi.ai/docs/pricing/chat-k26`
305
- - Kimi K2.7 Code pricing: `https://platform.kimi.ai/docs/pricing/chat-k27-code`
143
+ > K2.7 has no non-thinking mode. Via DashScope, K2.6 is also available at $0.89 / 1M input and $3.71 / 1M output.