Skip to content

Commit eaab4c6

Browse files
committed
Merge czy-all into dev
2 parents 6968389 + b629324 commit eaab4c6

23 files changed

Lines changed: 5447 additions & 3004 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
bun-version: latest
2525

2626
- name: Install dependencies
27-
run: bun install
27+
run: bun install --frozen-lockfile
2828

2929
- name: Run linter
3030
run: bun run lint:all

.github/workflows/release-desktop.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
bun-version: latest
2222

2323
- name: Install root dependencies
24-
run: bun install
24+
run: bun install --frozen-lockfile
2525

2626
- name: Build server
2727
run: bun run build
@@ -32,7 +32,7 @@ jobs:
3232

3333
- name: Install desktop dependencies
3434
working-directory: desktop
35-
run: npm install
35+
run: npm ci
3636

3737
- name: Build macOS arm64 package
3838
working-directory: desktop
@@ -58,7 +58,7 @@ jobs:
5858
bun-version: latest
5959

6060
- name: Install root dependencies
61-
run: bun install
61+
run: bun install --frozen-lockfile
6262

6363
- name: Build server
6464
run: bun run build
@@ -69,7 +69,7 @@ jobs:
6969

7070
- name: Install desktop dependencies
7171
working-directory: desktop
72-
run: npm install
72+
run: npm ci
7373

7474
- name: Build Windows package
7575
working-directory: desktop

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
bun-version: latest
2323

2424
- name: Install dependencies
25-
run: bun install
25+
run: bun install --frozen-lockfile
2626

2727
- name: Run linter
2828
run: bun run lint:all

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Compared with routing everything through plain Chat Completions compatibility, t
6262
- **Opencode OAuth Support**: Use opencode GitHub Copilot authentication by setting `COPILOT_API_OAUTH_APP=opencode` environment variable or using `--oauth-app=opencode` command line option.
6363
- **GitHub Enterprise Support**: Connect to GHE.com by setting `COPILOT_API_ENTERPRISE_URL` environment variable (e.g., `company.ghe.com`) or using `--enterprise-url=company.ghe.com` command line option.
6464
- **Custom Data Directory**: Change the default data directory (where tokens and config are stored) by setting `COPILOT_API_HOME` environment variable or using `--api-home=/path/to/dir` command line option.
65-
- **Multi-Provider Messages Proxy Routes**: Add global provider configs and call external Anthropic-compatible or OpenAI-compatible APIs via `/:provider/v1/messages` and `/:provider/v1/models`.
65+
- **Multi-Provider Messages Proxy Routes**: Add global provider configs and call external Anthropic-compatible or OpenAI-compatible APIs via `/:provider/v1/messages` and `/:provider/v1/models`, or send `model: "provider/model"` to the top-level `/v1/messages` API.
6666
- **Accurate Claude Token Counting**: Optionally forward `/v1/messages/count_tokens` requests for Claude models to Anthropic's free token counting endpoint for exact counts instead of GPT tokenizer estimation.
6767
- **GPT Context Management**: Configurable context compaction for long-running GPT conversations via `responsesApiContextManagementModels`, reducing unnecessary premium requests when approaching token limits. See [Configuration](#configuration-configjson) for details.
6868
@@ -357,7 +357,7 @@ The following command line options are available for the `start` command:
357357
```
358358
- **auth.apiKeys:** API keys used for request authentication. Supports multiple keys for rotation. Requests can authenticate with either `x-api-key: <key>` or `Authorization: Bearer <key>`. If empty or omitted, authentication is disabled.
359359
- **extraPrompts:** Map of `model -> prompt` appended to the first system prompt when translating Anthropic-style requests to Copilot. Use this to inject guardrails or guidance per model. Missing default entries are auto-added without overwriting your custom prompts. The built-in prompts for `gpt-5.3-codex` and `gpt-5.4` enable phase-aware commentary, which lets the model emit a short user-facing progress update before tools or deeper reasoning.
360-
- **providers:** Global upstream provider map. Each provider key (for example `custom`) becomes a route prefix (`/custom/v1/messages`). Supports `type: "anthropic"` and `type: "openai-compatible"`.
360+
- **providers:** Global upstream provider map. Each provider key (for example `custom`) becomes a route prefix (`/custom/v1/messages`). Supports `type: "anthropic"` and `type: "openai-compatible"`. Top-level Anthropic clients can also use `model: "custom/model-id"` with `/v1/messages` and `/v1/messages/count_tokens`; the proxy strips the `custom/` prefix before forwarding upstream. `GET /v1/models` does not aggregate provider models; use `GET /custom/v1/models` for provider model lists.
361361
- `enabled` defaults to `true` if omitted.
362362
- `baseUrl` should be provider API base URL without the final endpoint. For Anthropic providers, omit `/v1/messages`; for OpenAI-compatible providers, omit `/v1/chat/completions`.
363363
- `apiKey` is used as the upstream credential value.
@@ -419,8 +419,8 @@ These endpoints are designed to be compatible with the Anthropic Messages API.
419419

420420
| Endpoint | Method | Description |
421421
| -------------------------------- | ------ | ------------------------------------------------------------ |
422-
| `POST /v1/messages` | `POST` | Creates a model response for a given conversation. |
423-
| `POST /v1/messages/count_tokens` | `POST` | Calculates the number of tokens for a given set of messages. |
422+
| `POST /v1/messages` | `POST` | Creates a model response for a given conversation. Supports `provider/model` aliases for configured providers. |
423+
| `POST /v1/messages/count_tokens` | `POST` | Calculates the number of tokens for a given set of messages. Supports `provider/model` aliases for configured providers. |
424424
| `POST /:provider/v1/messages` | `POST` | Proxies Anthropic Messages requests to the configured Anthropic or OpenAI-compatible provider. |
425425
| `GET /:provider/v1/models` | `GET` | Proxies model listing requests to the configured provider. |
426426
| `POST /:provider/v1/messages/count_tokens` | `POST` | Calculates tokens locally for provider route requests. |

README.zh-CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
- **支持 opencode OAuth**:可通过设置环境变量 `COPILOT_API_OAUTH_APP=opencode` 或使用命令行参数 `--oauth-app=opencode` 来启用 opencode GitHub Copilot 认证。
6363
- **支持 GitHub Enterprise**:可通过设置环境变量 `COPILOT_API_ENTERPRISE_URL`(例如 `company.ghe.com`)或命令行参数 `--enterprise-url=company.ghe.com` 连接到 GHE.com。
6464
- **自定义数据目录**:可通过环境变量 `COPILOT_API_HOME` 或命令行参数 `--api-home=/path/to/dir` 修改默认数据目录(存放 token 和配置)。
65-
- **多 Provider Messages 代理路由**:可以添加全局 provider 配置,并通过 `/:provider/v1/messages``/:provider/v1/models` 调用外部 Anthropic 或 OpenAI 兼容 API。
65+
- **多 Provider Messages 代理路由**:可以添加全局 provider 配置,并通过 `/:provider/v1/messages``/:provider/v1/models` 调用外部 Anthropic 或 OpenAI 兼容 API,也可以把 `model` 写成 `"provider/model"` 后直接发到顶层 `/v1/messages`
6666
- **精确的 Claude Token 计数**:可以选择将 Claude 模型的 `/v1/messages/count_tokens` 请求转发到 Anthropic 的免费 token counting 端点,以获得精确计数,而不是依赖 GPT tokenizer 估算。
6767
- **GPT 上下文管理**:可通过 `responsesApiContextManagementModels` 为长上下文 GPT 对话启用可配置的上下文压缩,在接近 token 限制时减少不必要的 Premium 请求。详见 [配置](#configuration-configjson)。
6868
@@ -361,7 +361,7 @@ Copilot API 现在使用子命令结构,主要命令包括:
361361
```
362362
- **auth.apiKeys:** 用于请求认证的 API key。支持多个 key 轮换使用。请求可通过 `x-api-key: <key>``Authorization: Bearer <key>` 进行认证。若为空或省略,则禁用认证。
363363
- **extraPrompts:** `model -> prompt` 的映射。把 Anthropic 风格请求翻译给 Copilot 时,会将其附加到第一条 system prompt 后面。你可以借此为不同模型注入护栏或指引。缺失的默认项会自动补齐,但不会覆盖你自定义的 prompt。内置的 `gpt-5.3-codex``gpt-5.4` prompt 会启用带阶段感知的 commentary,让模型在工具调用或更深层推理前先发出简短的用户可见进度说明。
364-
- **providers:** 全局上游 provider 映射。每个 provider key(例如 `custom`)都会变成一个路由前缀(`/custom/v1/messages`)。支持 `type: "anthropic"``type: "openai-compatible"`
364+
- **providers:** 全局上游 provider 映射。每个 provider key(例如 `custom`)都会变成一个路由前缀(`/custom/v1/messages`)。支持 `type: "anthropic"``type: "openai-compatible"`顶层 Anthropic 客户端也可以在 `/v1/messages``/v1/messages/count_tokens` 中使用 `model: "custom/model-id"`;代理会在转发上游前移除 `custom/` 前缀。`GET /v1/models` 不聚合 provider 模型;provider 模型列表请使用 `GET /custom/v1/models`
365365
- `enabled`:可选,若省略则默认为 `true`
366366
- `baseUrl`:provider API 的基础 URL,不要带结尾的 endpoint。Anthropic provider 不要带 `/v1/messages`;OpenAI 兼容 provider 不要带 `/v1/chat/completions`
367367
- `apiKey`:作为上游凭据值使用。
@@ -423,8 +423,8 @@ curl http://localhost:4141/v1/models \
423423
424424
| 端点 | 方法 | 说明 |
425425
| --- | --- | --- |
426-
| `POST /v1/messages` | `POST` | 为给定对话创建模型响应。 |
427-
| `POST /v1/messages/count_tokens` | `POST` | 计算一组消息的 token 数。 |
426+
| `POST /v1/messages` | `POST` | 为给定对话创建模型响应。支持已配置 provider 的 `provider/model` 别名。 |
427+
| `POST /v1/messages/count_tokens` | `POST` | 计算一组消息的 token 数。支持已配置 provider 的 `provider/model` 别名。 |
428428
| `POST /:provider/v1/messages` | `POST` | 将 Anthropic Messages 请求代理到已配置的 Anthropic 或 OpenAI 兼容 provider。 |
429429
| `GET /:provider/v1/models` | `GET` | 将模型列表请求代理到已配置的 provider。 |
430430
| `POST /:provider/v1/messages/count_tokens` | `POST` | 为 provider 路由请求在本地计算 token 数。 |

0 commit comments

Comments
 (0)