@jeffreycao/copilot-api 1.14.15 → 1.14.16
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 -1
- package/README.zh-CN.md +1 -1
- package/dist/main.js +1 -1
- package/dist/{server-CssRFP_e.js → server-DhmRDx8F.js} +6 -3
- package/dist/{server-CssRFP_e.js.map → server-DhmRDx8F.js.map} +1 -1
- package/dist/{start-LL-rZ-Mu.js → start-DMc8jFHG.js} +2 -2
- package/dist/{start-LL-rZ-Mu.js.map → start-DMc8jFHG.js.map} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -628,7 +628,7 @@ Use `copilot-api auth login --provider custom` to add or update another third-pa
|
|
|
628
628
|
}
|
|
629
629
|
```
|
|
630
630
|
Built-in token prices cover Codex GPT models in USD, DashScope `qwen3.7-max`, `qwen3.7-plus`, `glm-5.1`, `glm-5.2` in CNY, DeepSeek `deepseek-v4-flash`, `deepseek-v4-pro`, `deepseek-chat`, `deepseek-reasoner` in CNY, and OpenCode Go models (`glm-5.2`, `grok-4.5`, `deepseek-v4-flash`, `deepseek-v4-pro`, `kimi-k2.7-code`, `kimi-k3`, `mimo-v2.5`, `mimo-v2.5-pro`, `qwen3.7-plus`, `qwen3.7-max`, `minimax-m2.7`, `minimax-m3`) in USD. User `pricing` entries override built-ins. For DashScope, cached tokens are charged as explicit cache reads when the upstream usage includes `cache_creation_input_tokens`; otherwise `cachedInput` is used as the implicit cache read price. For DeepSeek, `prompt_cache_hit_tokens` map to cached input and `prompt_cache_miss_tokens` map to regular input.
|
|
631
|
-
- **smallModel:** Fallback model used for tool-less warmup messages (e.g., Claude Code probe requests); defaults to gpt-5-mini.
|
|
631
|
+
- **smallModel:** Fallback model used for tool-less warmup messages (e.g., Claude Code probe requests); defaults to gpt-5-mini. The gateway forces this small model on no-tool warmup or probe requests to avoid consuming premium requests. This behavior only applies to non-token-based-billing GitHub Copilot accounts (`token_based_billing` is false); for token-based-billing accounts the warmup small-model fallback is skipped since there is no premium-request quota to preserve.
|
|
632
632
|
- **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.
|
|
633
633
|
- **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.
|
|
634
634
|
- **modelReasoningEfforts:** Per-model fallback reasoning effort for `/v1/messages` requests. It is used only when the request does not provide `output_config.effort`.
|
package/README.zh-CN.md
CHANGED
|
@@ -634,7 +634,7 @@ Copilot API 现在使用子命令结构,主要命令包括:
|
|
|
634
634
|
}
|
|
635
635
|
```
|
|
636
636
|
内置 token 价格覆盖 Codex GPT 模型(USD)、DashScope `qwen3.7-max`、`qwen3.7-plus`、`glm-5.1`、`glm-5.2`(CNY),DeepSeek `deepseek-v4-flash`、`deepseek-v4-pro`、`deepseek-chat`、`deepseek-reasoner`(CNY),以及 OpenCode Go 模型(`glm-5.2`、`grok-4.5`、`deepseek-v4-flash`、`deepseek-v4-pro`、`kimi-k2.7-code`、`kimi-k3`、`mimo-v2.5`、`mimo-v2.5-pro`、`qwen3.7-plus`、`qwen3.7-max`、`minimax-m2.7`、`minimax-m3`,USD)。用户配置的 `pricing` 优先于内置价格。DashScope 若上游 usage 中出现 `cache_creation_input_tokens` 字段,cached tokens 按显式缓存读价计费;否则 `cachedInput` 作为隐式缓存读价。DeepSeek 的 `prompt_cache_hit_tokens` 会归入 cached input,`prompt_cache_miss_tokens` 会归入普通 input。
|
|
637
|
-
- **smallModel:** 无工具预热消息的回退模型(例如 Claude Code 的探测请求);默认是 `gpt-5-mini
|
|
637
|
+
- **smallModel:** 无工具预热消息的回退模型(例如 Claude Code 的探测请求);默认是 `gpt-5-mini`。网关会对无工具的预热或探测请求强制使用该小模型,以避免消耗 premium 请求。该行为仅在 GitHub Copilot 账户为非 token-based 计费时生效(`token_based_billing` 为 false);对于 token-based 计费账户,预热小模型回退会被跳过,因为不存在需要节省的 premium 请求配额。
|
|
638
638
|
- **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` 配置。
|
|
639
639
|
- **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`)。未列出的模型继续使用原有兜底逻辑。
|
|
640
640
|
- **modelReasoningEfforts:** `/v1/messages` 请求的模型级默认推理强度。仅当请求没有传入 `output_config.effort` 时,该配置才会生效。
|
package/dist/main.js
CHANGED
|
@@ -25,7 +25,7 @@ bindElectronFetch();
|
|
|
25
25
|
const { auth } = await import("./auth-BR4eK87z.js");
|
|
26
26
|
const { debug } = await import("./debug-Bb5hamXX.js");
|
|
27
27
|
const { mcp } = await import("./mcp-BG6fpi6q.js");
|
|
28
|
-
const { start } = await import("./start-
|
|
28
|
+
const { start } = await import("./start-DMc8jFHG.js");
|
|
29
29
|
await runMain(defineCommand({
|
|
30
30
|
meta: {
|
|
31
31
|
name: "copilot-api",
|
|
@@ -6334,8 +6334,11 @@ async function handleCompletion(c) {
|
|
|
6334
6334
|
const compactType = getCompactType(anthropicPayload);
|
|
6335
6335
|
const anthropicBeta = c.req.header("anthropic-beta");
|
|
6336
6336
|
logger$8.debug("Anthropic Beta header:", anthropicBeta);
|
|
6337
|
-
|
|
6338
|
-
|
|
6337
|
+
if (!state.tokenBasedBilling) {
|
|
6338
|
+
const tools = anthropicPayload.tools;
|
|
6339
|
+
const noTools = !tools || tools.length === 0;
|
|
6340
|
+
if (anthropicBeta && noTools && compactType === 0) anthropicPayload.model = getSmallModel();
|
|
6341
|
+
}
|
|
6339
6342
|
if (compactType) logger$8.debug("Compact request type:", compactType);
|
|
6340
6343
|
if (!state.tokenBasedBilling) {
|
|
6341
6344
|
const lastMessageCacheControl = getLastMessageContentCacheControl(anthropicPayload.messages.at(-1));
|
|
@@ -7114,4 +7117,4 @@ server.route("/:provider/images", providerImageRoutes);
|
|
|
7114
7117
|
//#endregion
|
|
7115
7118
|
export { server };
|
|
7116
7119
|
|
|
7117
|
-
//# sourceMappingURL=server-
|
|
7120
|
+
//# sourceMappingURL=server-DhmRDx8F.js.map
|