copilot-custom-endpoint 1.0.3 → 1.0.5

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.
package/README.md CHANGED
@@ -43,6 +43,66 @@ The Kimi and Qwen setups require editing the same VS Code config file:
43
43
  | macOS | `~/Library/Application Support/Code/User/chatLanguageModels.json` |
44
44
  | Linux | `~/.config/Code/User/chatLanguageModels.json` |
45
45
 
46
+ ### Full example config
47
+
48
+ Here's a complete, real-world example of `chatLanguageModels.json` combining all the providers documented in this repo.
49
+
50
+ ```json
51
+ [
52
+ {
53
+ "name": "Qwen",
54
+ "vendor": "customendpoint",
55
+ "apiKey": "<your-dashscope-key>",
56
+ "apiType": "chat-completions",
57
+ "models": [
58
+ {
59
+ "id": "qwen3.7-max",
60
+ "name": "Qwen 3.7 Max",
61
+ "url": "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions",
62
+ "toolCalling": true,
63
+ "vision": false,
64
+ "streaming": true,
65
+ "requestBody": {
66
+ "enable_thinking": false
67
+ }
68
+ },
69
+ {
70
+ "id": "qwen3.6-plus",
71
+ "name": "Qwen 3.6 Plus",
72
+ "url": "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions",
73
+ "toolCalling": true,
74
+ "vision": true,
75
+ "streaming": true,
76
+ "requestBody": {
77
+ "enable_thinking": false
78
+ }
79
+ }
80
+ ]
81
+ },
82
+ {
83
+ "name": "Kimi",
84
+ "vendor": "customendpoint",
85
+ "apiKey": "<your-moonshot-key>",
86
+ "apiType": "chat-completions",
87
+ "models": [
88
+ {
89
+ "id": "kimi-k2.6",
90
+ "name": "Kimi K2.6",
91
+ "url": "http://127.0.0.1:3457/v1/chat/completions",
92
+ "requestBody": {
93
+ "temperature": 1
94
+ },
95
+ "toolCalling": true,
96
+ "vision": true,
97
+ "streaming": true,
98
+ "maxInputTokens": 262144,
99
+ "maxOutputTokens": 32768
100
+ }
101
+ ]
102
+ }
103
+ ]
104
+ ```
105
+
46
106
  ### Kimi K2.6 (Moonshot)
47
107
 
48
108
  #### 1. Grab a Moonshot API key
@@ -53,18 +113,32 @@ Sign up at [platform.moonshot.ai](https://platform.moonshot.ai) and create an AP
53
113
 
54
114
  The proxy rewrites VS Code's requests into shapes Kimi actually accepts (fixed `temperature`, `top_p`, and disabling "thinking" during tool calls).
55
115
 
116
+ > **Local config:** Create a `.env` file in this repo root to set environment variables like `KIMI_PROXY_PORT`, `KIMI_UPSTREAM_URL`, etc. It's loaded automatically via `dotenv` — no need to prefix commands.
117
+
118
+ Run Kimi proxy
119
+
56
120
  ```bash
57
- # from this repo — Kimi only
58
121
  npm run proxy:kimi
59
- # from this repo — both proxies concurrently
122
+ ```
123
+
124
+ Run all proxies
125
+
126
+ ```bash
60
127
  npm run proxy
61
- # or with npx
128
+ ```
129
+
130
+ Run globally (from any directory)
131
+
132
+ ```bash
133
+ # Kimi only
62
134
  npx copilot-custom-endpoint kimi
63
- npx copilot-custom-endpoint # starts both proxies
64
- # or directly
65
- node proxy/kimi-proxy.mjs
135
+ # All proxies
136
+ npx copilot-custom-endpoint
137
+ ```
138
+
139
+ Clean up debug logs
66
140
 
67
- # clean up debug logs
141
+ ```bash
68
142
  npm run clean:logs
69
143
  # or with npx
70
144
  npx copilot-custom-endpoint clean
@@ -155,18 +229,30 @@ Sign up at [dashscope.aliyun.com](https://dashscope.aliyun.com) and create an AP
155
229
 
156
230
  The proxy dynamically enables thinking in plain chat and disables it during tool calls:
157
231
 
232
+ Run Qwen proxy
233
+
158
234
  ```bash
159
- # from this repo — Qwen only
160
235
  npm run proxy:qwen
161
- # from this repo — both proxies concurrently
236
+ ```
237
+
238
+ Run all proxies
239
+
240
+ ```bash
162
241
  npm run proxy
163
- # or with npx
242
+ ```
243
+
244
+ Run globally (from any directory)
245
+
246
+ ```bash
247
+ # Qwen only
164
248
  npx copilot-custom-endpoint qwen
165
- npx copilot-custom-endpoint # starts both proxies
166
- # or directly
167
- node proxy/qwen-proxy.mjs
249
+ # All proxies
250
+ npx copilot-custom-endpoint
251
+ ```
168
252
 
169
- # clean up debug logs
253
+ Clean up debug logs
254
+
255
+ ```bash
170
256
  npm run clean:logs
171
257
  # or with npx
172
258
  npx copilot-custom-endpoint clean
package/cli.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import 'dotenv/config'
2
3
  import { fileURLToPath } from 'node:url'
3
4
  import { dirname, resolve } from 'node:path'
4
5
  import { fork } from 'node:child_process'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copilot-custom-endpoint",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Local proxies for VS Code Copilot custom endpoints — Kimi K2 & Qwen 3.x",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,5 +47,8 @@
47
47
  "eslint-config-prettier": "^10.1.8",
48
48
  "globals": "^17.6.0",
49
49
  "prettier": "^3.8.3"
50
+ },
51
+ "dependencies": {
52
+ "dotenv": "^17.4.2"
50
53
  }
51
54
  }
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import 'dotenv/config'
2
3
  import { fileURLToPath } from 'node:url'
3
4
  import { createProxy } from '../lib/create-proxy.mjs'
4
5
 
@@ -16,7 +17,10 @@ import { createProxy } from '../lib/create-proxy.mjs'
16
17
  */
17
18
  const upstreamUrl =
18
19
  process.env.KIMI_UPSTREAM_URL ?? 'https://api.moonshot.ai/v1/chat/completions'
19
- const port = Number.parseInt(process.env.PORT ?? '3457', 10)
20
+ const port = Number.parseInt(
21
+ process.env.KIMI_PROXY_PORT ?? process.env.PORT ?? '3457',
22
+ 10
23
+ )
20
24
  const forcedTemperature = Number(
21
25
  process.env.KIMI_PROXY_FORCE_TEMPERATURE ?? '1'
22
26
  )
@@ -37,7 +41,7 @@ if (process.argv.includes('--help')) {
37
41
  Starts a local HTTP proxy that rewrites the outbound chat-completions request body to use Kimi-compatible sampling values.
38
42
 
39
43
  Environment variables:
40
- PORT Local listen port. Default: 3457
44
+ KIMI_PROXY_PORT Local listen port. Default: 3457 (falls back to PORT)
41
45
  KIMI_UPSTREAM_URL Upstream Moonshot chat-completions URL.
42
46
  Default: https://api.moonshot.ai/v1/chat/completions
43
47
  KIMI_PROXY_FORCE_TEMPERATURE Temperature to force into the request body. Default: 1
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import 'dotenv/config'
2
3
  import { fileURLToPath } from 'node:url'
3
4
  import { createProxy } from '../lib/create-proxy.mjs'
4
5
 
@@ -14,7 +15,10 @@ import { createProxy } from '../lib/create-proxy.mjs'
14
15
  const upstreamUrl =
15
16
  process.env.QWEN_UPSTREAM_URL ??
16
17
  'https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions'
17
- const port = Number.parseInt(process.env.PORT ?? '3458', 10)
18
+ const port = Number.parseInt(
19
+ process.env.QWEN_PROXY_PORT ?? process.env.PORT ?? '3458',
20
+ 10
21
+ )
18
22
  const disableThinkingWithTools =
19
23
  (process.env.QWEN_PROXY_DISABLE_THINKING_WITH_TOOLS ?? '1') !== '0'
20
24
  const defaultLogPath = fileURLToPath(
@@ -30,7 +34,7 @@ when the request includes a tools array, letting Qwen hybrid-thinking models
30
34
  show reasoning in plain chat while keeping tool loops stable.
31
35
 
32
36
  Environment variables:
33
- PORT Local listen port. Default: 3458
37
+ QWEN_PROXY_PORT Local listen port. Default: 3458 (falls back to PORT)
34
38
  QWEN_UPSTREAM_URL Upstream DashScope chat-completions URL.
35
39
  Default: https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions
36
40
  QWEN_PROXY_DISABLE_THINKING_WITH_TOOLS