@jeffreycao/copilot-api 2.5.4 → 2.5.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 +23 -14
- package/README.zh-CN.md +23 -14
- package/dist/main.js +1 -1
- package/dist/{server-Cqju93ku.js → server-DJl6uDKl.js} +14 -4
- package/dist/server-DJl6uDKl.js.map +1 -0
- package/dist/{start-R_GdLsiW.js → start-r3xnAtBs.js} +2 -2
- package/dist/{start-R_GdLsiW.js.map → start-r3xnAtBs.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-Cqju93ku.js.map +0 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://www.npmjs.com/package/@jeffreycao/copilot-api"><img src="https://img.shields.io/npm/v/@jeffreycao/copilot-api.svg" alt="npm version"></a>
|
|
15
|
-
<a href="https://github.com/caozhiyuan/copilot-api/blob/
|
|
15
|
+
<a href="https://github.com/caozhiyuan/copilot-api/blob/dev/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
16
16
|
<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>
|
|
17
17
|
<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>
|
|
18
18
|
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node-%3E%3D22.13.0-green.svg" alt="Node >= 22.13.0"></a>
|
|
@@ -425,30 +425,39 @@ npx @jeffreycao/copilot-api@latest start
|
|
|
425
425
|
|
|
426
426
|
## Using with Docker
|
|
427
427
|
|
|
428
|
-
|
|
428
|
+
The supplied Compose file uses the current published `ghcr.io/caozhiyuan/copilot-api:latest` image. No local image build is required. It stores gateway state in `/data` and runs the server as the non-root `bun` user.
|
|
429
|
+
|
|
430
|
+
### Quick start with Docker Compose
|
|
431
|
+
|
|
432
|
+
Run these commands from the repository root. Replace `YOUR_GATEWAY_API_KEY` with a strong key for clients connecting to this gateway:
|
|
429
433
|
|
|
430
434
|
```sh
|
|
431
|
-
|
|
435
|
+
mkdir -p copilot-data
|
|
436
|
+
docker compose pull
|
|
437
|
+
docker compose run --rm copilot-api --auth keys --add YOUR_GATEWAY_API_KEY
|
|
438
|
+
docker compose run --rm copilot-api --auth login
|
|
439
|
+
docker compose up -d
|
|
440
|
+
docker compose ps
|
|
432
441
|
```
|
|
433
442
|
|
|
434
|
-
|
|
443
|
+
If `COPILOT_API_GITHUB_TOKEN` or the legacy `GH_TOKEN` is already available in your environment or a private `.env` file, you can skip `--auth login`. A GitHub token authorizes access to GitHub Copilot; it does not replace the gateway API key configured above.
|
|
435
444
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
445
|
+
Before every server or authentication run, the one-shot `data-init` service repairs ownership of the mounted data directory. This lets the non-root server reuse files written by an earlier root container, including mode `0600` configuration files. The host directory defaults to `./copilot-data`, matching the earlier Docker instructions; Compose mounts it at `/data` and sets `COPILOT_API_HOME` accordingly. Set `COPILOT_API_DATA_DIR` in the environment or your own `.env` to use an existing directory elsewhere.
|
|
446
|
+
|
|
447
|
+
```dotenv
|
|
448
|
+
COPILOT_API_DATA_DIR=/absolute/path/to/copilot-data
|
|
440
449
|
```
|
|
441
450
|
|
|
442
|
-
|
|
443
|
-
The image explicitly listens on `0.0.0.0` so Docker port publishing works and refuses to start until at least one gateway API key is configured. Non-loopback listeners also restrict CORS to the request's own origin.
|
|
451
|
+
Create the host directory before the first run. Compose does not auto-create a missing host directory (`create_host_path: false`), so a typo in `COPILOT_API_DATA_DIR` fails fast instead of starting with empty state. The one-shot `data-init` service also refuses unsafe values such as `/` before touching ownership.
|
|
444
452
|
|
|
445
|
-
|
|
453
|
+
The local endpoint is `http://127.0.0.1:4141`. To publish the gateway on every host interface after configuring a gateway API key, add this to your `.env`:
|
|
446
454
|
|
|
447
|
-
```
|
|
448
|
-
|
|
455
|
+
```dotenv
|
|
456
|
+
COPILOT_API_BIND=0.0.0.0
|
|
457
|
+
COPILOT_API_PORT=4141
|
|
449
458
|
```
|
|
450
459
|
|
|
451
|
-
|
|
460
|
+
Token and proxy variables can be overridden in the same file. Proxy addresses must be reachable from inside the container. Keep the internal port at `4141` so the health check remains valid.
|
|
452
461
|
|
|
453
462
|
## Electron Desktop App
|
|
454
463
|
|
package/README.zh-CN.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://www.npmjs.com/package/@jeffreycao/copilot-api"><img src="https://img.shields.io/npm/v/@jeffreycao/copilot-api.svg" alt="npm version"></a>
|
|
15
|
-
<a href="https://github.com/caozhiyuan/copilot-api/blob/
|
|
15
|
+
<a href="https://github.com/caozhiyuan/copilot-api/blob/dev/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
16
16
|
<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>
|
|
17
17
|
<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>
|
|
18
18
|
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node-%3E%3D22.13.0-green.svg" alt="Node >= 22.13.0"></a>
|
|
@@ -455,30 +455,39 @@ npx @jeffreycao/copilot-api@latest start
|
|
|
455
455
|
|
|
456
456
|
## 配合 Docker 使用
|
|
457
457
|
|
|
458
|
-
|
|
458
|
+
仓库提供的 Compose 文件使用当前已发布的 `ghcr.io/caozhiyuan/copilot-api:latest` 镜像,无需在用户机器上构建镜像。它将 gateway 状态保存在 `/data`,并以非 root 的 `bun` 用户运行服务。
|
|
459
|
+
|
|
460
|
+
### 使用 Docker Compose 快速启动
|
|
461
|
+
|
|
462
|
+
在仓库根目录执行以下命令。将 `YOUR_GATEWAY_API_KEY` 替换为客户端访问 gateway 时使用的强密钥:
|
|
459
463
|
|
|
460
464
|
```sh
|
|
461
|
-
|
|
465
|
+
mkdir -p copilot-data
|
|
466
|
+
docker compose pull
|
|
467
|
+
docker compose run --rm copilot-api --auth keys --add YOUR_GATEWAY_API_KEY
|
|
468
|
+
docker compose run --rm copilot-api --auth login
|
|
469
|
+
docker compose up -d
|
|
470
|
+
docker compose ps
|
|
462
471
|
```
|
|
463
472
|
|
|
464
|
-
|
|
473
|
+
如果环境变量或用户自己创建的私有 `.env` 中已经设置 `COPILOT_API_GITHUB_TOKEN` 或旧变量 `GH_TOKEN`,可以跳过 `--auth login`。GitHub token 用于访问 GitHub Copilot,不能替代上面配置的 gateway API Key。
|
|
465
474
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
475
|
+
每次启动服务或执行认证命令前,一次性的 `data-init` 服务都会修复挂载数据目录的所有权。因此非 root 服务可以直接复用旧 root 容器写入的数据,包括权限为 `0600` 的配置文件。宿主机目录仍默认使用旧 Docker 文档中的 `./copilot-data`;Compose 将它挂载到 `/data`,并设置对应的 `COPILOT_API_HOME`。如需复用其他位置的已有目录,可在环境变量或用户自己的 `.env` 中设置 `COPILOT_API_DATA_DIR`。
|
|
476
|
+
|
|
477
|
+
```dotenv
|
|
478
|
+
COPILOT_API_DATA_DIR=/absolute/path/to/copilot-data
|
|
470
479
|
```
|
|
471
480
|
|
|
472
|
-
|
|
473
|
-
镜像会显式监听 `0.0.0.0` 以支持 Docker 端口映射,并在未配置网关 API Key 时拒绝启动。非回环监听还会将 CORS 限制为请求自身的同源地址。
|
|
481
|
+
首次运行前请先建好宿主机目录。Compose 不会自动创建缺失的宿主机目录(`create_host_path: false`),因此 `COPILOT_API_DATA_DIR` 写错会直接报错,而不会以空状态启动。一次性的 `data-init` 服务在改归属前也会拒绝 `/` 这类危险路径。
|
|
474
482
|
|
|
475
|
-
|
|
483
|
+
默认本地地址为 `http://127.0.0.1:4141`。配置好 gateway API Key 后,如需监听宿主机所有网卡,可在用户自己的 `.env` 中设置:
|
|
476
484
|
|
|
477
|
-
```
|
|
478
|
-
|
|
485
|
+
```dotenv
|
|
486
|
+
COPILOT_API_BIND=0.0.0.0
|
|
487
|
+
COPILOT_API_PORT=4141
|
|
479
488
|
```
|
|
480
489
|
|
|
481
|
-
|
|
490
|
+
Token 和代理变量也可以在同一文件中覆盖。代理地址必须能从容器内部访问。容器内部端口保持 `4141`,以便健康检查正常工作。
|
|
482
491
|
|
|
483
492
|
<a id="electron-desktop-app"></a>
|
|
484
493
|
|
package/dist/main.js
CHANGED
|
@@ -30,7 +30,7 @@ if (isMcpFastPath(process.argv)) {
|
|
|
30
30
|
const { auth } = await import("./auth-BKEWjsYR.js");
|
|
31
31
|
const { debug } = await import("./debug-CcgIYPL-.js");
|
|
32
32
|
const { mcp } = await import("./mcp-fpSlKZxK.js");
|
|
33
|
-
const { start } = await import("./start-
|
|
33
|
+
const { start } = await import("./start-r3xnAtBs.js");
|
|
34
34
|
await runMain(defineCommand({
|
|
35
35
|
meta: {
|
|
36
36
|
name: "copilot-api",
|
|
@@ -644,7 +644,12 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
644
644
|
cachedInput: .04,
|
|
645
645
|
input: 2,
|
|
646
646
|
output: 8
|
|
647
|
-
}
|
|
647
|
+
},
|
|
648
|
+
reasoningEfforts: [
|
|
649
|
+
"low",
|
|
650
|
+
"high",
|
|
651
|
+
"max"
|
|
652
|
+
]
|
|
648
653
|
},
|
|
649
654
|
"deepseek-v4-pro": {
|
|
650
655
|
contextWindow: 1e6,
|
|
@@ -654,7 +659,12 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
654
659
|
cachedInput: .3,
|
|
655
660
|
input: 9,
|
|
656
661
|
output: 27
|
|
657
|
-
}
|
|
662
|
+
},
|
|
663
|
+
reasoningEfforts: [
|
|
664
|
+
"low",
|
|
665
|
+
"high",
|
|
666
|
+
"max"
|
|
667
|
+
]
|
|
658
668
|
}
|
|
659
669
|
},
|
|
660
670
|
"opencode-go": {
|
|
@@ -805,7 +815,7 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
805
815
|
"xhigh"
|
|
806
816
|
]
|
|
807
817
|
},
|
|
808
|
-
"deepseek-flash": {
|
|
818
|
+
"deepseek-v4.1-flash": {
|
|
809
819
|
contextWindow: 1e6,
|
|
810
820
|
inputModalities: ["text", "image"],
|
|
811
821
|
maxOutputTokens: 384e3,
|
|
@@ -12543,4 +12553,4 @@ createServer();
|
|
|
12543
12553
|
//#endregion
|
|
12544
12554
|
export { createServer };
|
|
12545
12555
|
|
|
12546
|
-
//# sourceMappingURL=server-
|
|
12556
|
+
//# sourceMappingURL=server-DJl6uDKl.js.map
|