@jeffreycao/copilot-api 1.14.6 → 1.14.8
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 +14 -4
- package/README.zh-CN.md +12 -2
- package/dist/main.js +1 -1
- package/dist/{server-uQjD_RpA.js → server-BayMzJcy.js} +331 -101
- package/dist/server-BayMzJcy.js.map +1 -0
- package/dist/{start-DNPIXvm4.js → start-C-ugrdZG.js} +2 -2
- package/dist/{start-DNPIXvm4.js.map → start-C-ugrdZG.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-uQjD_RpA.js.map +0 -1
package/README.md
CHANGED
|
@@ -668,9 +668,15 @@ These endpoints mimic the OpenAI API structure.
|
|
|
668
668
|
|
|
669
669
|
### Codex Backend Proxy Endpoints
|
|
670
670
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
|
671
|
+
These endpoints require an active Codex login. Each endpoint is available both without a version prefix and under `/v1`.
|
|
672
|
+
|
|
673
|
+
| Endpoint | Method | Description |
|
|
674
|
+
| --- | --- | --- |
|
|
675
|
+
| `POST /alpha/search`<br>`POST /v1/alpha/search` | `POST` | Transparently forwards the JSON body and query parameters to the Codex Alpha Search upstream. |
|
|
676
|
+
| `POST /images/generations`<br>`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`. |
|
|
677
|
+
| `POST /images/edits`<br>`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. |
|
|
678
|
+
|
|
679
|
+
For every endpoint above, the gateway replaces client authorization and account headers with the active Codex login, preserves query parameters and compatible request headers, and returns the upstream status, headers, and body.
|
|
674
680
|
|
|
675
681
|
### Anthropic Compatible Endpoints
|
|
676
682
|
|
|
@@ -681,8 +687,12 @@ These endpoints are designed to be compatible with the Anthropic Messages API.
|
|
|
681
687
|
| `POST /v1/messages` | `POST` | Creates a model response for a given conversation. Supports `provider/model` aliases for configured providers, including translation through `openai-compatible` providers. |
|
|
682
688
|
| `POST /v1/messages/count_tokens` | `POST` | Calculates the number of tokens for a given set of messages. Supports `provider/model` aliases for configured providers. |
|
|
683
689
|
| `POST /:provider/v1/messages` | `POST` | Proxies Anthropic Messages requests to the configured Anthropic provider, translates them through an OpenAI-compatible provider, or translates them through an OpenAI Responses provider. |
|
|
684
|
-
| `GET /:provider/v1/models` | `GET` | Proxies model listing requests to the configured provider.
|
|
690
|
+
| `GET /:provider/v1/models` | `GET` | Proxies model listing requests to the configured provider. For `codex`, returns the built-in catalog by default; Codex clients (`User-Agent` starting with `codex`) are forwarded to the Codex Models upstream. |
|
|
685
691
|
| `POST /:provider/v1/messages/count_tokens` | `POST` | Calculates tokens locally for provider route requests. |
|
|
692
|
+
| `POST /:provider/v1/responses` | `POST` | Proxies OpenAI Responses requests to a configured `openai-responses` provider (including `codex`). |
|
|
693
|
+
| `POST /:provider/v1/alpha/search` | `POST` | Proxies alpha-search requests. For `codex`, forwards to the Codex Alpha Search upstream; for other providers, forwards to `{baseUrl}/v1/alpha/search`. |
|
|
694
|
+
| `POST /:provider/v1/images/generations` | `POST` | Proxies image generation. For `codex`, uses the Codex Images upstream; for other providers, forwards to `{baseUrl}/v1/images/generations` (15-minute timeout). |
|
|
695
|
+
| `POST /:provider/v1/images/edits` | `POST` | Proxies image edits. For `codex`, uses the Codex Images upstream; for other providers, forwards multipart/streamed bodies to `{baseUrl}/v1/images/edits` (15-minute timeout). |
|
|
686
696
|
|
|
687
697
|
### Usage Monitoring Endpoints
|
|
688
698
|
|
package/README.zh-CN.md
CHANGED
|
@@ -674,9 +674,15 @@ curl http://localhost:4141/admin/config/model-mappings \
|
|
|
674
674
|
|
|
675
675
|
### Codex 后端代理端点
|
|
676
676
|
|
|
677
|
+
这些端点要求已有可用的 Codex 登录态。每个端点同时提供无版本前缀和 `/v1` 两种路径。
|
|
678
|
+
|
|
677
679
|
| 端点 | 方法 | 说明 |
|
|
678
680
|
| --- | --- | --- |
|
|
679
|
-
| `POST /alpha/search` | `POST` | 将 JSON 请求体和查询参数透明转发到 Codex Alpha Search
|
|
681
|
+
| `POST /alpha/search`<br>`POST /v1/alpha/search` | `POST` | 将 JSON 请求体和查询参数透明转发到 Codex Alpha Search 上游。 |
|
|
682
|
+
| `POST /images/generations`<br>`POST /v1/images/generations` | `POST` | 将 JSON 图片生成请求转发到 Codex Images 上游。请求未携带 `Content-Type` 时,网关默认补充 `application/json`。 |
|
|
683
|
+
| `POST /images/edits`<br>`POST /v1/images/edits` | `POST` | 将图片编辑请求转发到 Codex Images 上游。请使用 `multipart/form-data`,并让 HTTP 客户端自动生成 `boundary`;网关会保留传入的 content type,并以流式方式转发上传请求体。 |
|
|
684
|
+
|
|
685
|
+
对于以上所有端点,网关都会使用当前 Codex 登录态覆盖客户端的 authorization 和 account header,保留查询参数及兼容的请求头,并返回上游状态码、响应头和响应体。
|
|
680
686
|
|
|
681
687
|
### Anthropic 兼容端点
|
|
682
688
|
|
|
@@ -687,8 +693,12 @@ curl http://localhost:4141/admin/config/model-mappings \
|
|
|
687
693
|
| `POST /v1/messages` | `POST` | 为给定对话创建模型响应。支持已配置 provider 的 `provider/model` 别名,包括通过 `openai-compatible` provider 做翻译。 |
|
|
688
694
|
| `POST /v1/messages/count_tokens` | `POST` | 计算一组消息的 token 数。支持已配置 provider 的 `provider/model` 别名。 |
|
|
689
695
|
| `POST /:provider/v1/messages` | `POST` | 将 Anthropic Messages 请求代理到已配置的 Anthropic provider,或翻译到 OpenAI 兼容 / OpenAI Responses provider。 |
|
|
690
|
-
| `GET /:provider/v1/models` | `GET` | 将模型列表请求代理到已配置的 provider
|
|
696
|
+
| `GET /:provider/v1/models` | `GET` | 将模型列表请求代理到已配置的 provider。对 `codex` 默认返回内置模型目录;Codex 客户端(`User-Agent` 以 `codex` 开头)会转发到 Codex Models 上游。 |
|
|
691
697
|
| `POST /:provider/v1/messages/count_tokens` | `POST` | 为 provider 路由请求在本地计算 token 数。 |
|
|
698
|
+
| `POST /:provider/v1/responses` | `POST` | 将 OpenAI Responses 请求代理到已配置的 `openai-responses` provider(含 `codex`)。 |
|
|
699
|
+
| `POST /:provider/v1/alpha/search` | `POST` | 代理 alpha-search 请求。对 `codex` 转发到 Codex Alpha Search 上游;其他 provider 转发到 `{baseUrl}/v1/alpha/search`。 |
|
|
700
|
+
| `POST /:provider/v1/images/generations` | `POST` | 代理图片生成。对 `codex` 使用 Codex Images 上游;其他 provider 转发到 `{baseUrl}/v1/images/generations`(15 分钟超时)。 |
|
|
701
|
+
| `POST /:provider/v1/images/edits` | `POST` | 代理图片编辑。对 `codex` 使用 Codex Images 上游;其他 provider 以 multipart/流式方式转发到 `{baseUrl}/v1/images/edits`(15 分钟超时)。 |
|
|
692
702
|
|
|
693
703
|
### 使用量监控端点
|
|
694
704
|
|
package/dist/main.js
CHANGED
|
@@ -25,7 +25,7 @@ bindElectronFetch();
|
|
|
25
25
|
const { auth } = await import("./auth-DvJ8r_tN.js");
|
|
26
26
|
const { debug } = await import("./debug-Bb5hamXX.js");
|
|
27
27
|
const { mcp } = await import("./mcp-BseuqgHR.js");
|
|
28
|
-
const { start } = await import("./start-
|
|
28
|
+
const { start } = await import("./start-C-ugrdZG.js");
|
|
29
29
|
await runMain(defineCommand({
|
|
30
30
|
meta: {
|
|
31
31
|
name: "copilot-api",
|