@nick3/copilot-api 1.10.7 → 1.10.9
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 +1 -3
- package/README.zh-CN.md +1 -3
- package/dist/admin/assets/{index-DG4TRVMu.js → index-BAh4eOwM.js} +36 -36
- package/dist/admin/index.html +1 -1
- package/dist/main.js +1 -1
- package/dist/{proxy-YVh74m0I.js → proxy-_U-hgwIn.js} +1 -2
- package/dist/proxy-_U-hgwIn.js.map +1 -0
- package/dist/{server-DmDAepfa.js → server-GxNB5Syq.js} +39 -35
- package/dist/server-GxNB5Syq.js.map +1 -0
- package/dist/{start-D37Bi12h.js → start-DdrurmQ3.js} +3 -3
- package/dist/{start-D37Bi12h.js.map → start-DdrurmQ3.js.map} +1 -1
- package/package.json +1 -1
- package/dist/proxy-YVh74m0I.js.map +0 -1
- package/dist/server-DmDAepfa.js.map +0 -1
package/README.md
CHANGED
|
@@ -354,7 +354,6 @@ The `<target>` can be either the account ID (GitHub login) or a 1-based index.
|
|
|
354
354
|
"gpt-5.4": "xhigh"
|
|
355
355
|
},
|
|
356
356
|
"allowOriginalModelNamesForAliases": false,
|
|
357
|
-
"useFunctionApplyPatch": true,
|
|
358
357
|
"forceAgent": false,
|
|
359
358
|
"compactUseSmallModel": true,
|
|
360
359
|
"messageStartInputTokensFallback": false,
|
|
@@ -436,7 +435,7 @@ The `<target>` can be either the account ID (GitHub login) or a 1-based index.
|
|
|
436
435
|
- `temperature` (optional): Default temperature value used when the request does not specify one.
|
|
437
436
|
- `topP` (optional): Default top_p value used when the request does not specify one.
|
|
438
437
|
- `topK` (optional): Default top_k value used when the request does not specify one.
|
|
439
|
-
- `extraBody` (optional): Dynamic fields merged into the upstream request body for that model. Request body fields with the same name take precedence. OpenAI-compatible providers can use this for fields such as `enable_thinking`, `preserve_thinking`, `reasoning_effort`.
|
|
438
|
+
- `extraBody` (optional): Dynamic fields merged into the upstream request body for that model. Request body fields with the same name take precedence. OpenAI-compatible providers can use this for fields such as `enable_thinking`, `preserve_thinking`, `reasoning_effort`. `thinking_budget` is a special OpenAI-compatible provider override: when configured in `extraBody`, it is forced after Anthropic `thinking.budget_tokens` translation and overrides the request-derived budget.
|
|
440
439
|
- `contextCache` (optional): Defaults to `true` for OpenAI-compatible providers. This enables Alibaba Cloud Model Studio/DashScope explicit context cache by injecting `cache_control: { "type": "ephemeral" }` on up to 4 content blocks using the Context Cache format. The cache breakpoint strategy matches opencode's main provider flow: the first 2 system messages plus the last 2 non-system messages. Marked string content is converted to text content part arrays for `system` / `user` / `assistant` / `tool` messages; existing array content is marked on the last part. Set this to `false` when the model already supports implicit caching, or when the upstream does not accept this explicit-cache extension field.
|
|
441
440
|
- `supportPdf` (optional): Controls whether the model supports PDF/document content. Defaults to `false`; unsupported PDFs are converted to a text notice. Set it to `true` to send PDF/document blocks as OpenAI Chat Completions file parts.
|
|
442
441
|
- `toolContentSupportType` (optional): Tool result content capabilities for that model, as an array of `array`, `image`, and `pdf`. Provider routes default to string-only tool content when omitted. If `supportPdf` is `true` but this list does not include `pdf`, file parts in tool results are moved to user role messages. This provider default does not change the Copilot main flow, which continues to support array + image and not PDF.
|
|
@@ -446,7 +445,6 @@ The `<target>` can be either the account ID (GitHub login) or a 1-based index.
|
|
|
446
445
|
- **apiKey (deprecated):** Legacy single-key field kept for migration compatibility. Prefer `auth.apiKeys`. When `auth.apiKeys` is empty, the server falls back to `COPILOT_API_KEY` and then `apiKey`.- **modelReasoningEfforts:** Per-model `reasoning.effort` sent to the Copilot Responses API. Allowed values are `none`, `minimal`, `low`, `medium`, `high`, and `xhigh`. If a model isn’t listed, `high` is used by default.
|
|
447
446
|
- **modelAliases:** Map of `alias -> { target, allowOriginal? }` (legacy string values are still accepted). Alias keys are normalized (trim + lowercase) and must be non-empty; aliases cannot map to themselves (case-insensitive), and conflicting normalized aliases are rejected. `allowOriginal` overrides the global default per alias. If multiple aliases map to the same target, original names are allowed when any alias sets `allowOriginal: true` (allow-wins). Admin UI/API rejects blocked keys (`__proto__`, `constructor`, `prototype`). Aliases can be used in downstream requests, and targets may be configured `provider/model` aliases for top-level `/v1/messages` and `/v1/messages/count_tokens` routing.
|
|
448
447
|
- **allowOriginalModelNamesForAliases:** Global default for aliases that omit `allowOriginal`. When `false` (default), targets are blocked unless an alias explicitly allows them; when `true`, targets are allowed unless all aliases explicitly block them.
|
|
449
|
-
- **useFunctionApplyPatch:** When `true` (default), `POST /v1/responses` converts a `tools` entry with `{ "type": "custom", "name": "apply_patch" }` into an OpenAI-style `function` tool (with a parameter schema) for upstream compatibility. Set to `false` to leave custom tools untouched.
|
|
450
448
|
- **forceAgent:** When `true`, `POST /v1/responses` treats a request as agent-initiated if **any** input item has `role: "assistant"`. When `false` (default), only the **last** input item is checked.
|
|
451
449
|
- **compactUseSmallModel:** When `true`, detected "compact" requests (e.g., from Claude Code or opencode compact mode) will automatically use the configured `smallModel` to avoid consuming premium usage for short/background tasks. Defaults to `true`.
|
|
452
450
|
- **messageStartInputTokensFallback:** When `true`, the Anthropic streaming translation layer estimates `message_start.input_tokens` when upstream stream events do not provide it. Defaults to `false`.
|
package/README.zh-CN.md
CHANGED
|
@@ -363,7 +363,6 @@ Copilot API 现在使用子命令结构,主要命令包括:
|
|
|
363
363
|
"gpt-5.4": "xhigh"
|
|
364
364
|
},
|
|
365
365
|
"allowOriginalModelNamesForAliases": false,
|
|
366
|
-
"useFunctionApplyPatch": true,
|
|
367
366
|
"forceAgent": false,
|
|
368
367
|
"compactUseSmallModel": true,
|
|
369
368
|
"messageStartInputTokensFallback": false,
|
|
@@ -445,7 +444,7 @@ Copilot API 现在使用子命令结构,主要命令包括:
|
|
|
445
444
|
- `temperature`:可选,当请求未指定时使用的默认温度。
|
|
446
445
|
- `topP`:可选,当请求未指定时使用的默认 `top_p`。
|
|
447
446
|
- `topK`:可选,当请求未指定时使用的默认 `top_k`。
|
|
448
|
-
- `extraBody`:可选,按模型合入上游请求体的动态字段;请求体显式同名字段优先。OpenAI 兼容 provider 可用它配置 `enable_thinking`、`preserve_thinking`、`reasoning_effort`
|
|
447
|
+
- `extraBody`:可选,按模型合入上游请求体的动态字段;请求体显式同名字段优先。OpenAI 兼容 provider 可用它配置 `enable_thinking`、`preserve_thinking`、`reasoning_effort` 等字段。`thinking_budget` 是 OpenAI 兼容 provider 的特殊覆盖项:配置在 `extraBody` 后,会在 Anthropic `thinking.budget_tokens` 翻译之后强制写入,并覆盖请求派生出的预算值。
|
|
449
448
|
- `contextCache`:可选,OpenAI 兼容 provider 默认 `true`,用于启用阿里云百炼/DashScope 的显式缓存(explicit context cache),会按其 Context Cache 格式在最多 4 个 content block 上注入 `cache_control: { "type": "ephemeral" }`。缓存断点策略与 opencode 主链路保持一致:前 2 条 system 消息 + 最后 2 条非 system 消息。标记字符串 content 时会把 `system` / `user` / `assistant` / `tool` 消息转换为 text content part 数组;已有数组 content 则标记最后一个 part。如果模型本身已经支持隐式缓存,或上游不支持该显式缓存扩展字段,可在模型配置中设为 `false`。
|
|
450
449
|
- `supportPdf`:可选,控制该模型是否支持 PDF/document content。默认 `false`,不支持时会把 PDF 转成提示文本;设为 `true` 时会把 PDF/document 转成 OpenAI Chat Completions 的 file part。
|
|
451
450
|
- `toolContentSupportType`:可选,配置该模型的 tool result content 支持能力,值为 `array`、`image`、`pdf` 的数组。provider 侧未配置时默认只发送 string tool content。若 `supportPdf` 为 `true` 但这里不包含 `pdf`,tool result 里的 file part 会被转成 user role 消息。Copilot 主链路不使用这个 provider 默认,仍按 array + image 且不支持 PDF 的能力处理。
|
|
@@ -455,7 +454,6 @@ Copilot API 现在使用子命令结构,主要命令包括:
|
|
|
455
454
|
- **apiKey(已弃用):** 兼容迁移的旧单 key 字段。优先使用 `auth.apiKeys`。当 `auth.apiKeys` 为空时,服务端会回退到 `COPILOT_API_KEY`,再回退到 `apiKey`。- **modelReasoningEfforts:** 按模型配置发送到 Copilot Responses API 的 `reasoning.effort`。可选值包括 `none`、`minimal`、`low`、`medium`、`high` 和 `xhigh`。若某模型未配置,则默认使用 `high`。
|
|
456
455
|
- **modelAliases:** `alias -> { target, allowOriginal? }` 的映射(也仍然接受旧的字符串写法)。别名 key 会先做标准化(trim + lowercase),且不能为空;别名不能映射回自己(大小写不敏感),冲突的标准化别名会被拒绝。`allowOriginal` 可为单个别名覆盖全局默认值。如果多个别名映射到同一个 target,只要其中任意一个设置了 `allowOriginal: true`,原始模型名就会被允许(allow-wins)。Admin UI/API 会拒绝被屏蔽的键(`__proto__`、`constructor`、`prototype`)。下游请求可以直接使用这些别名,target 也可以是 `provider/model` 形式,用于顶层 `/v1/messages` 与 `/v1/messages/count_tokens` 路由。
|
|
457
456
|
- **allowOriginalModelNamesForAliases:** 对未显式设置 `allowOriginal` 的别名所采用的全局默认值。当其为 `false`(默认)时,target 原名默认被屏蔽,除非某个别名显式允许;当其为 `true` 时,target 原名默认可用,除非所有别名都显式阻止。
|
|
458
|
-
- **useFunctionApplyPatch:** 当为 `true`(默认)时,`POST /v1/responses` 会把 `tools` 中形如 `{ "type": "custom", "name": "apply_patch" }` 的条目转换为 OpenAI 风格的 `function` 工具(带参数 schema),以便与上游更好兼容。设为 `false` 则保留自定义工具原样。
|
|
459
457
|
- **forceAgent:** 当为 `true` 时,只要 `POST /v1/responses` 的任一 input item 带有 `role: "assistant"`,就会把请求视为由 agent 发起;当为 `false`(默认)时,只检查最后一个 input item。
|
|
460
458
|
- **compactUseSmallModel:** 当为 `true` 时,检测到的“compact”请求(例如 Claude Code 或 opencode 的 compact 模式)会自动改用配置中的 `smallModel`,以避免短后台任务消耗 premium 使用量。默认值为 `true`。
|
|
461
459
|
- **messageStartInputTokensFallback:** 当为 `true` 时,如果上游流式事件没有提供 `message_start.input_tokens`,Anthropic 流式翻译层会自行估算该值。默认值为 `false`。
|