@jeffreycao/copilot-api 1.14.0 → 1.14.2
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 +5 -3
- package/README.zh-CN.md +5 -3
- package/dist/main.js +1 -1
- package/dist/{server-BMEABwl7.js → server-HvdtsRfY.js} +8 -4
- package/dist/server-HvdtsRfY.js.map +1 -0
- package/dist/{start-jNRGYGpo.js → start-BUCPPobx.js} +2 -2
- package/dist/{start-jNRGYGpo.js.map → start-BUCPPobx.js.map} +1 -1
- package/package.json +1 -1
- package/dist/server-BMEABwl7.js.map +0 -1
package/README.md
CHANGED
|
@@ -288,7 +288,6 @@ Add the following `[model_providers.copilot_api]` section to your Codex `~/.code
|
|
|
288
288
|
```toml
|
|
289
289
|
model_provider = "copilot_api"
|
|
290
290
|
model_reasoning_summary = "auto"
|
|
291
|
-
model_verbosity = "medium"
|
|
292
291
|
model_context_window = 272000
|
|
293
292
|
model_auto_compact_token_limit = 244800
|
|
294
293
|
|
|
@@ -311,7 +310,7 @@ enabled = false
|
|
|
311
310
|
```
|
|
312
311
|
|
|
313
312
|
> [!NOTE]
|
|
314
|
-
> This configuration is specific to Codex and the GitHub Copilot provider. `name` must be set to `"OpenAI"`. It can help mitigate Codex local compact cache miss issues.
|
|
313
|
+
> This configuration is specific to Codex and the GitHub Copilot provider. `name` must be set to `"OpenAI"`. It can help mitigate Codex local compact cache miss issues.
|
|
315
314
|
|
|
316
315
|
## GPT Tool Search
|
|
317
316
|
|
|
@@ -615,7 +614,10 @@ Use `copilot-api auth login --provider custom` to add or update another third-pa
|
|
|
615
614
|
- **smallModel:** Fallback model used for tool-less warmup messages (e.g., Claude Code probe requests); defaults to gpt-5-mini.
|
|
616
615
|
- **contextManagement:** Controls whether the proxy adds Responses API `context_management` compaction instructions. `messages` applies when Anthropic-style `/v1/messages` requests are translated to Responses API, including `openai-responses` provider message routes, and defaults to `true`. `responses` applies to native `/v1/responses` traffic, including `provider/model` aliases and the built-in `codex` provider, and defaults to `false`. Enable `responses` only after checking that your client supports context management compaction. When enabled, the request includes `context_management` in the body and keeps only the latest compaction carrier on follow-up turns. **Note:** Context management is forcibly disabled for GPT-5.6 and above models (e.g. `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna`) because enabling it breaks prompt cache hits on those models. This override takes precedence over the `contextManagement` and `modelResponsesApiCompactThresholds` settings.
|
|
617
616
|
- **modelResponsesApiCompactThresholds:** Per-model Responses API `compact_threshold` overrides used when the proxy adds `context_management`. These values take precedence over the fallback threshold from `resolveResponsesCompactThreshold` (`max_prompt_tokens * ratio`, or the default fallback). Defaults set `gpt-5.4` and `gpt-5.5` to `217600` (`272000 * 0.8`), and `gpt-5.6-sol`, `gpt-5.6-terra`, `gpt-5.6-luna` to `231200` (`272000 * 0.85`). Models not listed continue to use the normal fallback logic.
|
|
618
|
-
- **modelReasoningEfforts:** Per-model reasoning effort
|
|
617
|
+
- **modelReasoningEfforts:** Per-model fallback reasoning effort for `/v1/messages` requests. It is used only when the request does not provide `output_config.effort`.
|
|
618
|
+
- **Priority:** request `output_config.effort` > `modelReasoningEfforts[model]` > built-in default (`xhigh` for GPT-5.3+ models, otherwise `high`).
|
|
619
|
+
- **Forwarding:** the resolved value remains `output_config.effort` for the Copilot native Messages API and becomes `reasoning.effort` when translated to the Responses API.
|
|
620
|
+
- **Configuration values:** `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.
|
|
619
621
|
- **useMessagesApi:** When `true`, Claude-family models that support Copilot's native `/v1/messages` endpoint will use the Messages API; otherwise they fall back to `/chat/completions`. Set to `false` to disable Messages API routing and always use `/chat/completions`. Defaults to `true`.
|
|
620
622
|
- **useResponsesApiWebSocket:** When `true`, Responses API requests use Copilot's websocket transport for models that advertise `ws:/responses`; models that only advertise `/responses` continue to use HTTP. Set to `false` to disable websocket routing and use HTTP `/responses` whenever the selected model supports it. Defaults to `true`.
|
|
621
623
|
- **useResponsesApiWebSearch:** When `true`, the server keeps Responses API tools with `type: "web_search"` and forwards them upstream. Set to `false` to strip those tools from `/responses` payloads. Defaults to `true`.
|
package/README.zh-CN.md
CHANGED
|
@@ -290,7 +290,6 @@ npx @jeffreycao/copilot-api@latest start
|
|
|
290
290
|
```toml
|
|
291
291
|
model_provider = "copilot_api"
|
|
292
292
|
model_reasoning_summary = "auto"
|
|
293
|
-
model_verbosity = "medium"
|
|
294
293
|
model_context_window = 272000
|
|
295
294
|
model_auto_compact_token_limit = 244800
|
|
296
295
|
|
|
@@ -313,7 +312,7 @@ enabled = false
|
|
|
313
312
|
```
|
|
314
313
|
|
|
315
314
|
> [!NOTE]
|
|
316
|
-
> 此配置仅限于 Codex 与 GitHub Copilot provider。`name` 一定要配置为 `"OpenAI"`。它可以缓解 Codex local compact
|
|
315
|
+
> 此配置仅限于 Codex 与 GitHub Copilot provider。`name` 一定要配置为 `"OpenAI"`。它可以缓解 Codex local compact 不命中缓存的问题。
|
|
317
316
|
|
|
318
317
|
## GPT Tool Search
|
|
319
318
|
|
|
@@ -621,7 +620,10 @@ Copilot API 现在使用子命令结构,主要命令包括:
|
|
|
621
620
|
- **smallModel:** 无工具预热消息的回退模型(例如 Claude Code 的探测请求);默认是 `gpt-5-mini`。
|
|
622
621
|
- **contextManagement:** 控制代理是否为 Responses API 附加 `context_management` 压缩指令。`messages` 作用于被翻译成 Responses API 的 Anthropic 风格 `/v1/messages` 请求,包括 `openai-responses` provider 的 Messages 路由,默认值为 `true`。`responses` 作用于 native `/v1/responses` 流量,包括 `provider/model` 别名和内置 `codex` provider,默认值为 `false`。只有在确认客户端支持 context management compaction 后,才建议在 Responses API 下启用 `responses`。启用后,请求体会带上 `context_management`,并在后续轮次中仅保留最新的压缩承载内容。**注意:** 对于 GPT-5.6 及以上模型(如 `gpt-5.6-sol`、`gpt-5.6-terra`、`gpt-5.6-luna`),context management 功能会被强制禁用,因为开启后会破坏这些模型的 prompt 缓存命中。此强制覆盖优先于 `contextManagement` 和 `modelResponsesApiCompactThresholds` 配置。
|
|
623
622
|
- **modelResponsesApiCompactThresholds:** 按模型覆盖 Responses API 的 `compact_threshold`,仅在代理自动附加 `context_management` 时使用。它的优先级高于 `resolveResponsesCompactThreshold` 基于 `max_prompt_tokens * ratio` 的兜底阈值。默认将 `gpt-5.4` 和 `gpt-5.5` 设为 `217600`(`272000 * 0.8`),将 `gpt-5.6-sol`、`gpt-5.6-terra`、`gpt-5.6-luna` 设为 `231200`(`272000 * 0.85`)。未列出的模型继续使用原有兜底逻辑。
|
|
624
|
-
- **modelReasoningEfforts:**
|
|
623
|
+
- **modelReasoningEfforts:** `/v1/messages` 请求的模型级默认推理强度。仅当请求没有传入 `output_config.effort` 时,该配置才会生效。
|
|
624
|
+
- **优先级:** 请求中的 `output_config.effort` > `modelReasoningEfforts[model]` > 内置默认值(GPT-5.3+ 模型为 `xhigh`,其他模型为 `high`)。
|
|
625
|
+
- **转发字段:** 走 Copilot 原生 Messages API 时,最终值写入 `output_config.effort`;转换为 Responses API 时,最终值写入 `reasoning.effort`。
|
|
626
|
+
- **配置可选值:** `none`、`minimal`、`low`、`medium`、`high`、`xhigh`、`max`。
|
|
625
627
|
- **useMessagesApi:** 当为 `true` 时,支持 Copilot 原生 `/v1/messages` 的 Claude 系模型会走 Messages API;否则回退到 `/chat/completions`。设为 `false` 可禁用 Messages API 路由,始终使用 `/chat/completions`。默认值为 `true`。
|
|
626
628
|
- **useResponsesApiWebSocket:** 当为 `true` 时,Responses API 请求会优先对声明了 `ws:/responses` 的模型使用 Copilot websocket transport;仅声明 `/responses` 的模型仍走 HTTP。设为 `false` 可禁用 websocket 路由,并在模型支持 `/responses` 时使用 HTTP `/responses`。默认值为 `true`。
|
|
627
629
|
- **useResponsesApiWebSearch:** 当为 `true` 时,服务端会保留 Responses API 中 `type: "web_search"` 的工具并透传到上游。设为 `false` 则会从 `/responses` payload 中移除这些工具。默认值为 `true`。
|
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-BUCPPobx.js");
|
|
29
29
|
await runMain(defineCommand({
|
|
30
30
|
meta: {
|
|
31
31
|
name: "copilot-api",
|
|
@@ -3568,6 +3568,7 @@ const MESSAGE_TYPE = "message";
|
|
|
3568
3568
|
const COMPACTION_SIGNATURE_PREFIX = "cm1#";
|
|
3569
3569
|
const COMPACTION_SIGNATURE_SEPARATOR = "@";
|
|
3570
3570
|
const THINKING_TEXT = "Thinking...";
|
|
3571
|
+
const resolveReasoningEffort = (payload) => payload.output_config?.effort ?? getReasoningEffortForModel(payload.model);
|
|
3571
3572
|
const buildPromptCacheKey = (basePromptCacheKey, subagentAgentId) => {
|
|
3572
3573
|
if (!basePromptCacheKey) return null;
|
|
3573
3574
|
const normalizedSubagentAgentId = subagentAgentId?.trim() || null;
|
|
@@ -3607,7 +3608,7 @@ const translateAnthropicMessagesToResponsesPayload = (payload, subagentAgentId)
|
|
|
3607
3608
|
store: false,
|
|
3608
3609
|
parallel_tool_calls: true,
|
|
3609
3610
|
reasoning: {
|
|
3610
|
-
effort:
|
|
3611
|
+
effort: resolveReasoningEffort(payload),
|
|
3611
3612
|
summary: "detailed",
|
|
3612
3613
|
context: "all_turns"
|
|
3613
3614
|
},
|
|
@@ -6696,13 +6697,16 @@ const removeWebSearchTool = (payload) => {
|
|
|
6696
6697
|
});
|
|
6697
6698
|
};
|
|
6698
6699
|
const COPILOT_UNSUPPORTED_TOOL_TYPES = new Set(["image_generation"]);
|
|
6700
|
+
const COPILOT_UNSUPPORTED_TOOL_NAMESPACES = new Set(["image_gen"]);
|
|
6699
6701
|
const removeUnsupportedTools = (payload) => {
|
|
6700
6702
|
if (!Array.isArray(payload.tools) || payload.tools.length === 0) return;
|
|
6701
6703
|
const dropped = [];
|
|
6702
6704
|
payload.tools = payload.tools.filter((t) => {
|
|
6703
6705
|
const type = t.type;
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
+
const name = "name" in t && typeof t.name === "string" ? t.name : void 0;
|
|
6707
|
+
const isUnsupportedNamespace = type === "namespace" && name !== void 0 && COPILOT_UNSUPPORTED_TOOL_NAMESPACES.has(name);
|
|
6708
|
+
if (COPILOT_UNSUPPORTED_TOOL_TYPES.has(type) || isUnsupportedNamespace) {
|
|
6709
|
+
dropped.push(isUnsupportedNamespace ? `${type}:${name}` : type);
|
|
6706
6710
|
return false;
|
|
6707
6711
|
}
|
|
6708
6712
|
return true;
|
|
@@ -6847,4 +6851,4 @@ server.route("/:provider/v1/models", providerModelRoutes);
|
|
|
6847
6851
|
//#endregion
|
|
6848
6852
|
export { server };
|
|
6849
6853
|
|
|
6850
|
-
//# sourceMappingURL=server-
|
|
6854
|
+
//# sourceMappingURL=server-HvdtsRfY.js.map
|