xiaodcs-copilot-api 2.3.9-public.1 → 2.3.9-public.3

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
@@ -10,13 +10,15 @@
10
10
  Chat Completions · OpenAI Responses · Anthropic Messages
11
11
  </p>
12
12
 
13
- > **XiaoDcs downstream build:** this public npm artifact is built from a
14
- > private downstream repository and adds Responses image-body budgeting,
15
- > stale compaction recovery, and Codex Fast tier routing. The original
16
- > MIT-licensed project is [caozhiyuan/copilot-api](https://github.com/caozhiyuan/copilot-api).
13
+ > **XiaoDcs package channels:** `xiaodcs-copilot-api-edge` and
14
+ > `xiaodcs-copilot-api` are currently built from the same Edge source. Only the
15
+ > npm identity and executable name differ, so either package runs the same
16
+ > gateway code. The original MIT-licensed project is
17
+ > [caozhiyuan/copilot-api](https://github.com/caozhiyuan/copilot-api).
17
18
 
18
19
  <p align="center">
19
- <a href="https://www.npmjs.com/package/xiaodcs-copilot-api"><img src="https://img.shields.io/npm/v/xiaodcs-copilot-api.svg" alt="npm version"></a>
20
+ <a href="https://www.npmjs.com/package/xiaodcs-copilot-api-edge"><img src="https://img.shields.io/npm/v/xiaodcs-copilot-api-edge.svg" alt="npm version"></a>
21
+ <a href="https://www.npmjs.com/package/xiaodcs-copilot-api"><img src="https://img.shields.io/npm/v/xiaodcs-copilot-api.svg" alt="ordinary npm version"></a>
20
22
  <a href="https://github.com/caozhiyuan/copilot-api/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
21
23
  <a href="https://github.com/caozhiyuan/copilot-api/stargazers"><img src="https://img.shields.io/github/stars/caozhiyuan/copilot-api.svg" alt="GitHub stars"></a>
22
24
  <a href="https://bun.sh"><img src="https://img.shields.io/badge/Bun-%3E%3D1.2.x-orange.svg" alt="Bun >= 1.2.x"></a>
@@ -31,6 +33,12 @@
31
33
 
32
34
  The fastest way to get a working gateway:
33
35
 
36
+ ```sh
37
+ npx xiaodcs-copilot-api-edge@latest start
38
+ ```
39
+
40
+ The ordinary package name is an equivalent compatibility channel:
41
+
34
42
  ```sh
35
43
  npx xiaodcs-copilot-api@latest start
36
44
  ```
@@ -38,7 +46,7 @@ npx xiaodcs-copilot-api@latest start
38
46
  The server listens on `http://localhost:4141` by default. Optionally authenticate with GitHub Copilot or configure a third-party provider first:
39
47
 
40
48
  ```sh
41
- npx xiaodcs-copilot-api@latest auth login
49
+ npx xiaodcs-copilot-api-edge@latest auth login
42
50
  ```
43
51
 
44
52
  Verify the gateway is up:
@@ -50,19 +58,6 @@ curl http://localhost:4141/v1/models
50
58
  > [!NOTE]
51
59
  > Token usage storage requires Node.js >= 22.13.0 or Bun. See [Using with npx](#using-with-npx) for details.
52
60
 
53
- ### Public package traffic policy
54
-
55
- The `xiaodcs-copilot-api` public package applies a fixed, process-local policy before any model upstream request begins:
56
-
57
- - at most 4 active upstream model requests;
58
- - at most 1 request start per second and 20 starts per rolling minute;
59
- - 300–900 ms of admission jitter;
60
- - a FIFO queue of 16 requests with a 45-second wait limit;
61
- - 5% pre-upstream load shedding, returned as HTTP `429` with `Retry-After`;
62
- - image generation and editing endpoints are not registered. Image inputs to Chat Completions, Responses, and Messages remain supported where the model supports vision.
63
-
64
- The counters are local to one running process. Separate machines or gateway processes have independent limits.
65
-
66
61
  From here, jump to the guide for your client: [Claude Code](#using-with-claude-code), [OpenCode](#using-with-opencode), [Codex](#using-with-codex), or run it with [Docker](#using-with-docker).
67
62
 
68
63
  ## Highlights
@@ -111,7 +106,7 @@ There are two ways to configure Claude Code to use this AI gateway:
111
106
  To get started, run the `start` command with the `--claude-code` flag:
112
107
 
113
108
  ```sh
114
- npx xiaodcs-copilot-api@latest start --claude-code
109
+ npx xiaodcs-copilot-api-edge@latest start --claude-code
115
110
  ```
116
111
 
117
112
  You will no longer be prompted to pick models manually. The gateway automatically detects the latest available model for each Claude Code size tier — opus maps to the newest Opus model, sonnet to the newest Sonnet model, and haiku to the newest Haiku model — and generates a command that sets `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, and `ANTHROPIC_DEFAULT_HAIKU_MODEL` accordingly. Any tier without a matching model available is omitted. The command is copied to your clipboard and sets the environment variables needed for Claude Code to use the gateway.
@@ -180,8 +175,8 @@ OpenCode already has a direct GitHub Copilot provider. Use this section when you
180
175
  Start the AI gateway with the OpenCode OAuth app:
181
176
 
182
177
  ```sh
183
- npx xiaodcs-copilot-api@latest auth --oauth-app=opencode
184
- npx xiaodcs-copilot-api@latest start
178
+ npx xiaodcs-copilot-api-edge@latest auth --oauth-app=opencode
179
+ npx xiaodcs-copilot-api-edge@latest start
185
180
  ```
186
181
 
187
182
  Then point OpenCode at the gateway with `@ai-sdk/anthropic`.
@@ -381,7 +376,7 @@ On the GitHub Copilot path, the gateway prefers Copilot's native Anthropic-style
381
376
  >
382
377
  > 3. **OpenCode configuration:** When using with OpenCode, configure `~/.config/opencode/opencode.json` with `@ai-sdk/anthropic`. See [Using with OpenCode](#using-with-opencode).
383
378
  >
384
- > 4. **Built-in `copilot`, `codex` and third-party providers:** Run `npx xiaodcs-copilot-api@latest auth` and choose `copilot`, `codex`, `deepseek`, `custom`, or other providers.
379
+ > 4. **Built-in `copilot`, `codex` and third-party providers:** Run `npx xiaodcs-copilot-api-edge@latest auth` and choose `copilot`, `codex`, `deepseek`, `custom`, or other providers.
385
380
  >
386
381
  > 5. **Note:** See [GitHub Copilot Security Notice](./NOTICE.md#github-copilot-security-notice) for the warning removed from the README header.
387
382
 
@@ -425,29 +420,29 @@ You can run the project directly using npx:
425
420
  > [!IMPORTANT]
426
421
  > Token usage storage uses Node's built-in `node:sqlite` module when running with `npx`. It is enabled on Node.js >= 22.13.0. On Node.js < 22.13.0, the CLI still starts, but token usage storage is disabled.
427
422
  >
428
- > If you want token usage storage without upgrading Node.js, run the published CLI with Bun instead: `bunx --bun xiaodcs-copilot-api@latest start`.
423
+ > If you want token usage storage without upgrading Node.js, run the published CLI with Bun instead: `bunx --bun xiaodcs-copilot-api-edge@latest start`.
429
424
 
430
425
  ```sh
431
- npx xiaodcs-copilot-api@latest start
426
+ npx xiaodcs-copilot-api-edge@latest start
432
427
  ```
433
428
 
434
429
  With options:
435
430
 
436
431
  ```sh
437
- npx xiaodcs-copilot-api@latest start --port 8080
432
+ npx xiaodcs-copilot-api-edge@latest start --port 8080
438
433
  ```
439
434
 
440
435
  For authentication or provider configuration only:
441
436
 
442
437
  ```sh
443
- npx xiaodcs-copilot-api@latest auth
438
+ npx xiaodcs-copilot-api-edge@latest auth
444
439
  ```
445
440
 
446
441
  To run without GitHub Copilot, configure at least one provider first, then start the server normally:
447
442
 
448
443
  ```sh
449
- npx xiaodcs-copilot-api@latest auth login --provider dashscope
450
- npx xiaodcs-copilot-api@latest start
444
+ npx xiaodcs-copilot-api-edge@latest auth login --provider dashscope
445
+ npx xiaodcs-copilot-api-edge@latest start
451
446
  ```
452
447
 
453
448
  ## Using with Docker
@@ -508,7 +503,7 @@ Add the tool search bridge to the MCP config used by Claude Code:
508
503
  "tool_search": {
509
504
  "type": "stdio",
510
505
  "command": "npx",
511
- "args": ["-y", "xiaodcs-copilot-api@latest", "mcp"]
506
+ "args": ["-y", "xiaodcs-copilot-api-edge@latest", "mcp"]
512
507
  }
513
508
  }
514
509
  }
@@ -521,7 +516,7 @@ Add the tool search bridge to the MCP config used by opencode:
521
516
  "mcp": {
522
517
  "tool_search": {
523
518
  "type": "local",
524
- "command": ["npx", "-y", "xiaodcs-copilot-api@latest", "mcp"]
519
+ "command": ["npx", "-y", "xiaodcs-copilot-api-edge@latest", "mcp"]
525
520
  }
526
521
  }
527
522
  }
@@ -601,7 +596,7 @@ After starting the server, a URL to the Copilot Usage Dashboard will be displaye
601
596
 
602
597
  1. Start the server. For example, using npx:
603
598
  ```sh
604
- npx xiaodcs-copilot-api@latest start
599
+ npx xiaodcs-copilot-api-edge@latest start
605
600
  ```
606
601
  2. The server will output a URL to the usage viewer. Copy and paste this URL into your browser. It will look something like this:
607
602
  `http://localhost:4141/usage-viewer?endpoint=http://localhost:4141/usage`
@@ -816,11 +811,13 @@ These endpoints mimic the OpenAI API structure.
816
811
 
817
812
  ### Codex Backend Endpoints
818
813
 
819
- These endpoints implement the supported Codex backend APIs. Alpha search can use either the Codex backend or a Responses web-search adapter. Image generation and editing are disabled in this public package.
814
+ These endpoints implement Codex backend APIs. Top-level image requests require an active Codex login; alpha search can use either the Codex backend or a Responses web-search adapter.
820
815
 
821
816
  | Endpoint | Method | Description |
822
817
  | -------------------------------------------------------------- | ------ | --------------------------------------------------------------- |
823
818
  | `POST /v1/alpha/search` | `POST` | Routes Codex alpha-search requests to the Codex backend, or handles supported commands locally and through Responses web search. |
819
+ | `POST /v1/images/generations` | `POST` | Forwards a JSON image generation request to the Codex Images upstream. When the request omits `Content-Type`, the gateway defaults it to `application/json`. |
820
+ | `POST /v1/images/edits` | `POST` | Forwards an image edit request to the Codex Images upstream. Send this request as `multipart/form-data` and let the HTTP client generate the `boundary`; the gateway preserves the incoming content type and streams the upload body. |
824
821
 
825
822
  For requests routed to the Codex backend, the gateway replaces client authorization and account headers with the active Codex login and preserves compatible request metadata. Responses-backed alpha search instead follows the selected Copilot or provider route.
826
823
 
@@ -856,23 +853,23 @@ Common `npx` commands:
856
853
 
857
854
  ```sh
858
855
  # Start the gateway
859
- npx xiaodcs-copilot-api@latest start
856
+ npx xiaodcs-copilot-api-edge@latest start
860
857
 
861
858
  # Start on a custom port with verbose logging
862
- npx xiaodcs-copilot-api@latest start --port 8080 --verbose
859
+ npx xiaodcs-copilot-api-edge@latest start --port 8080 --verbose
863
860
 
864
861
  # Run the auth flow
865
- npx xiaodcs-copilot-api@latest auth login
862
+ npx xiaodcs-copilot-api-edge@latest auth login
866
863
 
867
864
  # Configure a third-party provider, then run without GitHub Copilot
868
- npx xiaodcs-copilot-api@latest auth login --provider dashscope
869
- npx xiaodcs-copilot-api@latest start
865
+ npx xiaodcs-copilot-api-edge@latest auth login --provider dashscope
866
+ npx xiaodcs-copilot-api-edge@latest start
870
867
 
871
868
  # Print debug information as JSON
872
- npx xiaodcs-copilot-api@latest debug --json
869
+ npx xiaodcs-copilot-api-edge@latest debug --json
873
870
 
874
871
  # Run the published CLI with Bun instead of Node.js
875
- bunx --bun xiaodcs-copilot-api@latest start
872
+ bunx --bun xiaodcs-copilot-api-edge@latest start
876
873
  ```
877
874
 
878
875
  OpenAI-compatible provider examples after configuring `dashscope`:
package/README.zh-CN.md CHANGED
@@ -10,12 +10,14 @@
10
10
  Chat Completions &middot; OpenAI Responses &middot; Anthropic Messages
11
11
  </p>
12
12
 
13
- > **XiaoDcs 下游构建:** 这个公开 npm 产物由私有下游仓库构建,增加了
14
- > Responses 图片请求体预算、失效 compaction 恢复和 Codex Fast 档位路由。
15
- > 原始 MIT 开源项目为 [caozhiyuan/copilot-api](https://github.com/caozhiyuan/copilot-api)。
13
+ > **XiaoDcs 双包名:** `xiaodcs-copilot-api-edge`
14
+ > `xiaodcs-copilot-api` 目前都从同一份 Edge 源码构建,只有 npm 身份和命令名不同,
15
+ > 实际运行的网关代码一致。原始 MIT 开源项目为
16
+ > [caozhiyuan/copilot-api](https://github.com/caozhiyuan/copilot-api)。
16
17
 
17
18
  <p align="center">
18
- <a href="https://www.npmjs.com/package/xiaodcs-copilot-api"><img src="https://img.shields.io/npm/v/xiaodcs-copilot-api.svg" alt="npm version"></a>
19
+ <a href="https://www.npmjs.com/package/xiaodcs-copilot-api-edge"><img src="https://img.shields.io/npm/v/xiaodcs-copilot-api-edge.svg" alt="npm version"></a>
20
+ <a href="https://www.npmjs.com/package/xiaodcs-copilot-api"><img src="https://img.shields.io/npm/v/xiaodcs-copilot-api.svg" alt="普通版 npm version"></a>
19
21
  <a href="https://github.com/caozhiyuan/copilot-api/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
20
22
  <a href="https://github.com/caozhiyuan/copilot-api/stargazers"><img src="https://img.shields.io/github/stars/caozhiyuan/copilot-api.svg" alt="GitHub stars"></a>
21
23
  <a href="https://bun.sh"><img src="https://img.shields.io/badge/Bun-%3E%3D1.2.x-orange.svg" alt="Bun >= 1.2.x"></a>
@@ -32,6 +34,12 @@
32
34
 
33
35
  最快启动一个可用网关的方式:
34
36
 
37
+ ```sh
38
+ npx xiaodcs-copilot-api-edge@latest start
39
+ ```
40
+
41
+ 普通包名是内容相同的兼容发布通道:
42
+
35
43
  ```sh
36
44
  npx xiaodcs-copilot-api@latest start
37
45
  ```
@@ -39,7 +47,7 @@ npx xiaodcs-copilot-api@latest start
39
47
  服务默认监听 `http://localhost:4141`。也可以先登录 GitHub Copilot 或配置第三方 provider:
40
48
 
41
49
  ```sh
42
- npx xiaodcs-copilot-api@latest auth login
50
+ npx xiaodcs-copilot-api-edge@latest auth login
43
51
  ```
44
52
 
45
53
  验证网关已启动:
@@ -51,19 +59,6 @@ curl http://localhost:4141/v1/models
51
59
  > [!NOTE]
52
60
  > token usage 存储需要 Node.js >= 22.13.0 或 Bun。详见[通过 npx 使用](#using-with-npx)。
53
61
 
54
- ### 公共包流量策略
55
-
56
- 公开的 `xiaodcs-copilot-api` 包会在任何模型上游请求开始前执行固定的进程内策略:
57
-
58
- - 最多同时运行 4 个上游模型请求;
59
- - 每秒最多启动 1 个请求,滚动一分钟内最多启动 20 个请求;
60
- - 准入前增加 300–900ms 抖动;
61
- - FIFO 队列最多等待 16 个请求,单个请求最多等待 45 秒;
62
- - 5% 的请求会在访问上游前被负载丢弃,并以带 `Retry-After` 的 HTTP `429` 返回;
63
- - 不注册图片生成和图片编辑端点。Chat Completions、Responses 和 Messages 中的图片输入仍会在模型支持视觉时正常工作。
64
-
65
- 计数器只作用于单个运行中的进程。不同电脑或不同网关进程会各自计算限额。
66
-
67
62
  接下来可按你的客户端选择指南:[与 Claude Code 一起使用](#using-with-claude-code)、[与 OpenCode 一起使用](#using-with-opencode)、[与 Codex 一起使用](#using-with-codex),或通过 [Docker](#using-with-docker) 运行。
68
63
 
69
64
  <a id="highlights"></a>
@@ -120,7 +115,7 @@ Windows x64(`.exe`)、macOS Apple Silicon(`.dmg`)和 Linux x64(`.AppIm
120
115
  执行带 `--claude-code` 的 `start` 命令开始:
121
116
 
122
117
  ```sh
123
- npx xiaodcs-copilot-api@latest start --claude-code
118
+ npx xiaodcs-copilot-api-edge@latest start --claude-code
124
119
  ```
125
120
 
126
121
  你不再需要手动选择模型。Gateway 会自动检测每个 Claude Code 尺寸档位对应的最新可用模型——opus 映射到最新的 Opus 模型,sonnet 映射到最新的 Sonnet 模型,haiku 映射到最新的 Haiku 模型——并生成相应设置 `ANTHROPIC_DEFAULT_OPUS_MODEL`、`ANTHROPIC_DEFAULT_SONNET_MODEL` 和 `ANTHROPIC_DEFAULT_HAIKU_MODEL` 的命令。若某个档位没有匹配的可用模型,则会被省略。该命令会被复制到剪贴板,并设置 Claude Code 使用这个 AI gateway 所需的环境变量。
@@ -193,8 +188,8 @@ OpenCode 已经有直接的 GitHub Copilot provider。本节适用于你希望
193
188
  使用 OpenCode OAuth app 启动 AI gateway:
194
189
 
195
190
  ```sh
196
- npx xiaodcs-copilot-api@latest auth --oauth-app=opencode
197
- npx xiaodcs-copilot-api@latest start
191
+ npx xiaodcs-copilot-api-edge@latest auth --oauth-app=opencode
192
+ npx xiaodcs-copilot-api-edge@latest start
198
193
  ```
199
194
 
200
195
  然后让 OpenCode 通过 `@ai-sdk/anthropic` 指向这个 AI gateway。
@@ -399,7 +394,7 @@ AI gateway 会从同一个本地端点暴露 OpenAI / Anthropic 兼容 API,让
399
394
  >
400
395
  > 3. **OpenCode 配置:** 与 OpenCode 搭配使用时,请使用 `@ai-sdk/anthropic` 配置 `~/.config/opencode/opencode.json`,详见 [与 OpenCode 一起使用](#与-opencode-一起使用)。
401
396
  >
402
- > 4. **内置 `copilot`、`codex` 与第三方 provider:** 执行 `npx xiaodcs-copilot-api@latest auth`,可选择 `copilot`、`codex`、`deepseek`、`custom` 等 provider。
397
+ > 4. **内置 `copilot`、`codex` 与第三方 provider:** 执行 `npx xiaodcs-copilot-api-edge@latest auth`,可选择 `copilot`、`codex`、`deepseek`、`custom` 等 provider。
403
398
  >
404
399
  > 5. **注意事项:** README 顶部移除的 GitHub Copilot warning 见 [GitHub Copilot 安全提示](./NOTICE.md#github-copilot-security-notice)。
405
400
 
@@ -451,29 +446,29 @@ bun run start start
451
446
  > [!IMPORTANT]
452
447
  > 通过 `npx` 运行时,token usage 存储会使用 Node 内置的 `node:sqlite` 模块。该能力会在 Node.js >= 22.13.0 时启用;Node.js < 22.13.0 时 CLI 仍可启动,但会禁用 token usage 存储。
453
448
  >
454
- > 如果不升级 Node.js 但仍需要 token usage 存储,可以改用 Bun 运行已发布 CLI:`bunx --bun xiaodcs-copilot-api@latest start`。
449
+ > 如果不升级 Node.js 但仍需要 token usage 存储,可以改用 Bun 运行已发布 CLI:`bunx --bun xiaodcs-copilot-api-edge@latest start`。
455
450
 
456
451
  ```sh
457
- npx xiaodcs-copilot-api@latest start
452
+ npx xiaodcs-copilot-api-edge@latest start
458
453
  ```
459
454
 
460
455
  带参数示例:
461
456
 
462
457
  ```sh
463
- npx xiaodcs-copilot-api@latest start --port 8080
458
+ npx xiaodcs-copilot-api-edge@latest start --port 8080
464
459
  ```
465
460
 
466
461
  如果只想做认证或 provider 配置:
467
462
 
468
463
  ```sh
469
- npx xiaodcs-copilot-api@latest auth
464
+ npx xiaodcs-copilot-api-edge@latest auth
470
465
  ```
471
466
 
472
467
  如果要不依赖 GitHub Copilot 运行,先配置至少一个 provider,然后正常启动服务:
473
468
 
474
469
  ```sh
475
- npx xiaodcs-copilot-api@latest auth login --provider dashscope
476
- npx xiaodcs-copilot-api@latest start
470
+ npx xiaodcs-copilot-api-edge@latest auth login --provider dashscope
471
+ npx xiaodcs-copilot-api-edge@latest start
477
472
  ```
478
473
 
479
474
  <a id="using-with-docker"></a>
@@ -540,7 +535,7 @@ GPT 模型不要设置 Claude Code 原生的 `ENABLE_TOOL_SEARCH`。这个开关
540
535
  "tool_search": {
541
536
  "type": "stdio",
542
537
  "command": "npx",
543
- "args": ["-y", "xiaodcs-copilot-api@latest", "mcp"]
538
+ "args": ["-y", "xiaodcs-copilot-api-edge@latest", "mcp"]
544
539
  }
545
540
  }
546
541
  }
@@ -553,7 +548,7 @@ GPT 模型不要设置 Claude Code 原生的 `ENABLE_TOOL_SEARCH`。这个开关
553
548
  "mcp": {
554
549
  "tool_search": {
555
550
  "type": "local",
556
- "command": ["npx", "-y", "xiaodcs-copilot-api@latest", "mcp"]
551
+ "command": ["npx", "-y", "xiaodcs-copilot-api-edge@latest", "mcp"]
557
552
  }
558
553
  }
559
554
  }
@@ -637,7 +632,7 @@ cp plugin/opencode/subagent-marker.js ~/.config/opencode/plugins/
637
632
 
638
633
  1. 启动服务。例如使用 npx:
639
634
  ```sh
640
- npx xiaodcs-copilot-api@latest start
635
+ npx xiaodcs-copilot-api-edge@latest start
641
636
  ```
642
637
  2. 服务会输出一个 usage viewer 的 URL。将它复制到浏览器中打开,形式大致如下:
643
638
  `http://localhost:4141/usage-viewer?endpoint=http://localhost:4141/usage`
@@ -862,11 +857,13 @@ curl http://localhost:4141/admin/config/model-mappings \
862
857
 
863
858
  ### Codex 后端端点
864
859
 
865
- 这些端点实现公共包支持的 Codex 后端 APIalpha-search 可以使用 Codex 后端或 Responses web-search 适配器;公共包不提供图片生成和图片编辑。
860
+ 这些端点实现 Codex 后端 API。顶层图片请求要求已有可用的 Codex 登录态;alpha-search 则可以使用 Codex 后端或 Responses web-search 适配器。
866
861
 
867
862
  | 端点 | 方法 | 说明 |
868
863
  | ---------------------------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------- |
869
864
  | `POST /v1/alpha/search` | `POST` | 将 Codex alpha-search 请求路由到 Codex 后端,或在本地及通过 Responses web search 处理支持的命令。 |
865
+ | `POST /v1/images/generations` | `POST` | 将 JSON 图片生成请求转发到 Codex Images 上游。请求未携带 `Content-Type` 时,网关默认补充 `application/json`。 |
866
+ | `POST /v1/images/edits` | `POST` | 将图片编辑请求转发到 Codex Images 上游。请使用 `multipart/form-data`,并让 HTTP 客户端自动生成 `boundary`;网关会保留传入的 content type,并以流式方式转发上传请求体。 |
870
867
 
871
868
  对于路由到 Codex 后端的请求,网关会使用当前 Codex 登录态覆盖客户端的 authorization 和 account header,并保留兼容的请求元数据。基于 Responses 的 alpha-search 则遵循所选 Copilot 或 provider 的路由。
872
869
 
@@ -904,23 +901,23 @@ curl http://localhost:4141/admin/config/model-mappings \
904
901
 
905
902
  ```sh
906
903
  # 基础启动
907
- npx xiaodcs-copilot-api@latest start
904
+ npx xiaodcs-copilot-api-edge@latest start
908
905
 
909
906
  # 自定义端口并开启详细日志
910
- npx xiaodcs-copilot-api@latest start --port 8080 --verbose
907
+ npx xiaodcs-copilot-api-edge@latest start --port 8080 --verbose
911
908
 
912
909
  # 执行认证流程
913
- npx xiaodcs-copilot-api@latest auth login
910
+ npx xiaodcs-copilot-api-edge@latest auth login
914
911
 
915
912
  # 配置第三方 provider,然后不依赖 GitHub Copilot 启动
916
- npx xiaodcs-copilot-api@latest auth login --provider dashscope
917
- npx xiaodcs-copilot-api@latest start
913
+ npx xiaodcs-copilot-api-edge@latest auth login --provider dashscope
914
+ npx xiaodcs-copilot-api-edge@latest start
918
915
 
919
916
  # 以 JSON 格式输出调试信息
920
- npx xiaodcs-copilot-api@latest debug --json
917
+ npx xiaodcs-copilot-api-edge@latest debug --json
921
918
 
922
919
  # 用 Bun 而不是 Node.js 运行已发布 CLI
923
- bunx --bun xiaodcs-copilot-api@latest start
920
+ bunx --bun xiaodcs-copilot-api-edge@latest start
924
921
  ```
925
922
 
926
923
  配置 `dashscope` 后的 OpenAI 兼容 provider 调用示例:
@@ -1,5 +1,5 @@
1
1
  import { F as ensurePaths, N as setConfiguredApiKeys, P as PATHS, a as normalizeProviderBaseUrl, c as setProviderConfig, n as getRawProviderConfig, r as isSupportedProviderType, y as SUPPORTED_PROVIDER_TYPES } from "./config-SytZjLq8.js";
2
- import { C as getConfiguredApiKeys, T as loginCodex, a as setupGitHubToken, n as persistCodexCredentials, q as state } from "./token-rjUSsykd.js";
2
+ import { A as getConfiguredApiKeys, K as state, M as loginCodex, a as setupGitHubToken, n as persistCodexCredentials } from "./token-D9svRIYW.js";
3
3
  import { defineCommand } from "citty";
4
4
  import consola from "consola";
5
5
  //#region src/lib/quick-providers.ts
@@ -0,0 +1,2 @@
1
+ import { t as auth } from "./auth-BiVetBYt.js";
2
+ export { auth };
package/dist/main.js CHANGED
@@ -27,10 +27,10 @@ if (isMcpFastPath(process.argv)) {
27
27
  if (process.platform === "win32" && process.stdout.isTTY && !process.env.WT_SESSION) process.env.WT_SESSION = "copilot-api";
28
28
  const { bindElectronFetch } = await import("./electron-fetch-BRX-ug5E.js");
29
29
  bindElectronFetch();
30
- const { auth } = await import("./auth-GVwXd8KL.js");
30
+ const { auth } = await import("./auth-Bu4MXadr.js");
31
31
  const { debug } = await import("./debug-BFadhEB4.js");
32
32
  const { mcp } = await import("./mcp-fpSlKZxK.js");
33
- const { start } = await import("./start-CoLFu4xs.js");
33
+ const { start } = await import("./start-FFVCi8su.js");
34
34
  await runMain(defineCommand({
35
35
  meta: {
36
36
  name: "copilot-api",
@@ -1,4 +1,4 @@
1
- import { q as state } from "./token-rjUSsykd.js";
1
+ import { K as state } from "./token-D9svRIYW.js";
2
2
  //#region src/lib/models.ts
3
3
  /**
4
4
  * Converts a Copilot upstream model ID to a client-friendly ID that Claude Code