@jeffreycao/copilot-api 2.5.2 → 2.5.4
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 +15 -12
- package/README.zh-CN.md +14 -15
- package/dist/auth-BKEWjsYR.js +2 -0
- package/dist/{auth-DQZ-A7MU.js → auth-LJ5y6v6e.js} +3 -3
- package/dist/{auth-DQZ-A7MU.js.map → auth-LJ5y6v6e.js.map} +1 -1
- package/dist/{config-Dj2ZvQuL.js → config-DYtohLpX.js} +4 -8
- package/dist/config-DYtohLpX.js.map +1 -0
- package/dist/{debug-g1B6CGzU.js → debug-CcgIYPL-.js} +2 -2
- package/dist/{debug-g1B6CGzU.js.map → debug-CcgIYPL-.js.map} +1 -1
- package/dist/main.js +3 -3
- package/dist/{models-12Y1nB8k.js → models-uKftaEt_.js} +2 -2
- package/dist/{models-12Y1nB8k.js.map → models-uKftaEt_.js.map} +1 -1
- package/dist/{server-B4-mT5EU.js → server-Cqju93ku.js} +84 -31
- package/dist/server-Cqju93ku.js.map +1 -0
- package/dist/{start-BcGt4v2F.js → start-R_GdLsiW.js} +6 -6
- package/dist/{start-BcGt4v2F.js.map → start-R_GdLsiW.js.map} +1 -1
- package/dist/{token-CaFzyRJX.js → token-DZDtQb7h.js} +2 -2
- package/dist/{token-CaFzyRJX.js.map → token-DZDtQb7h.js.map} +1 -1
- package/package.json +1 -1
- package/dist/auth-GHhmC1D5.js +0 -2
- package/dist/config-Dj2ZvQuL.js.map +0 -1
- package/dist/server-B4-mT5EU.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as isResponsesApiWebSocketEnabled, C as getClaudeTokenMultiplier, D as isAlphaSearchCodexPriorityEnabled, E as getUpstreamTransportConfig, N as PATHS, O as isMessagesApiEnabled, S as getClaudeAutoModel, T as getMessageApiWebSearchModel, _ as resolveMappedModel, b as getAlphaSearchModel, d as getModelResponsesApiCompactThreshold$1, f as getReasoningEffortForModel, g as isGpt56OrAbove, h as isContextManagementEnabledForResponses, i as listEnabledProviders, k as isResponsesApiWebSearchEnabled, l as getExtraPromptForModel, m as isContextManagementEnabledForMessages, n as getRawProviderConfig, o as resolveEffectiveProviderType, p as getSmallModel, s as resolveProviderAuthType, t as getProviderConfig, u as getModelMappings, v as setModelMappings, x as getAnthropicApiKey } from "./config-
|
|
2
|
-
import { A as createAuthMiddleware, B as resolveTraceId$1, C as prepareMessageProxyHeaders, E as compactMessageSections, F as CODEX_API_BASE_URL, G as isTerminalResponsesStreamChunk, H as createResponsesHttpEventStream, I as buildCodexRequestHeaders, J as state, K as createPooledWebSocketStream, L as forwardCodexResponses, O as compactSystemPromptStarts, R as generateTraceId, S as prepareInteractionHeaders, T as compactAutoContinuePromptStarts, U as createResponsesSafeStream, V as fetchUpstreamWithLifecycle, W as encodePoolKeyPart, X as forwardError, Y as HTTPError, _ as copilotBaseUrl, b as copilotWebSocketHeaders, c as getUUID, d as isResponsesStream, f as parseUserIdMetadata, j as getConfiguredAdminApiKeys, k as compactTextOnlyGuard, l as isAsyncIterable, o as generateRequestIdFromPayload, p as getCopilotUsage, q as createWebSocketUrl, r as setupCodexToken, s as getRootSessionId, u as isNullish, v as copilotHeaders, x as prepareForCompact, z as requestContext } from "./token-
|
|
1
|
+
import { A as isResponsesApiWebSocketEnabled, C as getClaudeTokenMultiplier, D as isAlphaSearchCodexPriorityEnabled, E as getUpstreamTransportConfig, N as PATHS, O as isMessagesApiEnabled, S as getClaudeAutoModel, T as getMessageApiWebSearchModel, _ as resolveMappedModel, b as getAlphaSearchModel, d as getModelResponsesApiCompactThreshold$1, f as getReasoningEffortForModel, g as isGpt56OrAbove, h as isContextManagementEnabledForResponses, i as listEnabledProviders, k as isResponsesApiWebSearchEnabled, l as getExtraPromptForModel, m as isContextManagementEnabledForMessages, n as getRawProviderConfig, o as resolveEffectiveProviderType, p as getSmallModel, s as resolveProviderAuthType, t as getProviderConfig, u as getModelMappings, v as setModelMappings, x as getAnthropicApiKey } from "./config-DYtohLpX.js";
|
|
2
|
+
import { A as createAuthMiddleware, B as resolveTraceId$1, C as prepareMessageProxyHeaders, E as compactMessageSections, F as CODEX_API_BASE_URL, G as isTerminalResponsesStreamChunk, H as createResponsesHttpEventStream, I as buildCodexRequestHeaders, J as state, K as createPooledWebSocketStream, L as forwardCodexResponses, O as compactSystemPromptStarts, R as generateTraceId, S as prepareInteractionHeaders, T as compactAutoContinuePromptStarts, U as createResponsesSafeStream, V as fetchUpstreamWithLifecycle, W as encodePoolKeyPart, X as forwardError, Y as HTTPError, _ as copilotBaseUrl, b as copilotWebSocketHeaders, c as getUUID, d as isResponsesStream, f as parseUserIdMetadata, j as getConfiguredAdminApiKeys, k as compactTextOnlyGuard, l as isAsyncIterable, o as generateRequestIdFromPayload, p as getCopilotUsage, q as createWebSocketUrl, r as setupCodexToken, s as getRootSessionId, u as isNullish, v as copilotHeaders, x as prepareForCompact, z as requestContext } from "./token-DZDtQb7h.js";
|
|
3
3
|
import { a as isDeferredToolName, c as parseMcpToolSearchSentinel, d as shouldEnableResponsesToolSearch, i as isBridgeToolSearchName, l as resolveBridgeToolSearchName, o as listDeferredToolNames, r as formatToolSearchBridgeArguments, s as normalizeToolSearchBridgeArguments, t as BRIDGE_TOOL_SEARCH_NAME, u as selectDeferredToolsByNames } from "./tool-search-Ds1vbmGG.js";
|
|
4
|
-
import { i as toClientModelId, r as normalizeSdkModelId, t as findEndpointModel } from "./models-
|
|
4
|
+
import { i as toClientModelId, r as normalizeSdkModelId, t as findEndpointModel } from "./models-uKftaEt_.js";
|
|
5
5
|
import consola from "consola";
|
|
6
6
|
import { createHash } from "node:crypto";
|
|
7
7
|
import fs, { createWriteStream, readFileSync, rmSync } from "node:fs";
|
|
@@ -516,6 +516,36 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
516
516
|
output: 28
|
|
517
517
|
}
|
|
518
518
|
},
|
|
519
|
+
"ZHIPU/GLM-5.3": {
|
|
520
|
+
contextWindow: 1048576,
|
|
521
|
+
inputModalities: ["text"],
|
|
522
|
+
maxOutputTokens: 131072,
|
|
523
|
+
pricing: {
|
|
524
|
+
cachedInput: 2,
|
|
525
|
+
input: 8,
|
|
526
|
+
output: 28
|
|
527
|
+
},
|
|
528
|
+
reasoningEfforts: [
|
|
529
|
+
"low",
|
|
530
|
+
"high",
|
|
531
|
+
"max"
|
|
532
|
+
]
|
|
533
|
+
},
|
|
534
|
+
"ZHIPU/GLM-5.3-Flash": {
|
|
535
|
+
contextWindow: 1048576,
|
|
536
|
+
inputModalities: ["text", "image"],
|
|
537
|
+
maxOutputTokens: 131072,
|
|
538
|
+
pricing: {
|
|
539
|
+
cachedInput: .23,
|
|
540
|
+
input: .8,
|
|
541
|
+
output: 2.8
|
|
542
|
+
},
|
|
543
|
+
reasoningEfforts: [
|
|
544
|
+
"low",
|
|
545
|
+
"high",
|
|
546
|
+
"max"
|
|
547
|
+
]
|
|
548
|
+
},
|
|
519
549
|
"qwen3.7-max": {
|
|
520
550
|
contextWindow: 1e6,
|
|
521
551
|
inputModalities: ["text"],
|
|
@@ -540,6 +570,30 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
540
570
|
output: 36
|
|
541
571
|
}
|
|
542
572
|
},
|
|
573
|
+
"qwen3.8-max-0902": {
|
|
574
|
+
contextWindow: 1e6,
|
|
575
|
+
inputModalities: ["text", "image"],
|
|
576
|
+
maxOutputTokens: 131072,
|
|
577
|
+
pricing: {
|
|
578
|
+
cachedInput: 1.5,
|
|
579
|
+
cacheCreationInput: 15,
|
|
580
|
+
explicitCachedInput: 1,
|
|
581
|
+
input: 12,
|
|
582
|
+
output: 36
|
|
583
|
+
}
|
|
584
|
+
},
|
|
585
|
+
"qwen3.8-flash": {
|
|
586
|
+
contextWindow: 1e6,
|
|
587
|
+
inputModalities: ["text", "image"],
|
|
588
|
+
maxOutputTokens: 131072,
|
|
589
|
+
pricing: {
|
|
590
|
+
cachedInput: .1,
|
|
591
|
+
cacheCreationInput: 1.25,
|
|
592
|
+
explicitCachedInput: .1,
|
|
593
|
+
input: .8,
|
|
594
|
+
output: 2.7
|
|
595
|
+
}
|
|
596
|
+
},
|
|
543
597
|
"deepseek-v4-flash-0731": {
|
|
544
598
|
contextWindow: 1e6,
|
|
545
599
|
inputModalities: ["text"],
|
|
@@ -582,24 +636,14 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
582
636
|
}
|
|
583
637
|
},
|
|
584
638
|
deepseek: {
|
|
585
|
-
"deepseek-
|
|
586
|
-
contextWindow: 1e6,
|
|
587
|
-
inputModalities: ["text"],
|
|
588
|
-
maxOutputTokens: 64e3,
|
|
589
|
-
pricing: {
|
|
590
|
-
cachedInput: .1,
|
|
591
|
-
input: 3,
|
|
592
|
-
output: 9
|
|
593
|
-
}
|
|
594
|
-
},
|
|
595
|
-
"deepseek-v4-flash-vision-exp": {
|
|
639
|
+
"deepseek-flash": {
|
|
596
640
|
contextWindow: 1e6,
|
|
597
641
|
inputModalities: ["text", "image"],
|
|
598
|
-
maxOutputTokens:
|
|
642
|
+
maxOutputTokens: 384e3,
|
|
599
643
|
pricing: {
|
|
600
|
-
cachedInput: .
|
|
601
|
-
input:
|
|
602
|
-
output:
|
|
644
|
+
cachedInput: .04,
|
|
645
|
+
input: 2,
|
|
646
|
+
output: 8
|
|
603
647
|
}
|
|
604
648
|
},
|
|
605
649
|
"deepseek-v4-pro": {
|
|
@@ -761,6 +805,21 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
761
805
|
"xhigh"
|
|
762
806
|
]
|
|
763
807
|
},
|
|
808
|
+
"deepseek-flash": {
|
|
809
|
+
contextWindow: 1e6,
|
|
810
|
+
inputModalities: ["text", "image"],
|
|
811
|
+
maxOutputTokens: 384e3,
|
|
812
|
+
pricing: {
|
|
813
|
+
cachedInput: .006,
|
|
814
|
+
input: .3,
|
|
815
|
+
output: 1.2
|
|
816
|
+
},
|
|
817
|
+
reasoningEfforts: [
|
|
818
|
+
"low",
|
|
819
|
+
"high",
|
|
820
|
+
"max"
|
|
821
|
+
]
|
|
822
|
+
},
|
|
764
823
|
"deepseek-v4-flash": {
|
|
765
824
|
contextWindow: 1e6,
|
|
766
825
|
inputModalities: ["text"],
|
|
@@ -947,7 +1006,8 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
|
|
|
947
1006
|
this.modelCatalog = BuiltinProviderModelRegistry.catalog;
|
|
948
1007
|
}
|
|
949
1008
|
getModelConfig(providerName, modelName) {
|
|
950
|
-
|
|
1009
|
+
const models = this.modelCatalog[this.normalizeKey(providerName)];
|
|
1010
|
+
return models?.[modelName.trim()] ?? models?.[this.normalizeKey(modelName)];
|
|
951
1011
|
}
|
|
952
1012
|
getModelIds(providerName) {
|
|
953
1013
|
return Object.keys(this.modelCatalog[this.normalizeKey(providerName)] ?? {});
|
|
@@ -10443,12 +10503,6 @@ const FALLBACK_BASE_INSTRUCTIONS = FALLBACK_CODEX_MODELS.find((model) => model.b
|
|
|
10443
10503
|
function isCodexUserAgent(userAgent) {
|
|
10444
10504
|
return CODEX_USER_AGENT_PATTERN.test(userAgent?.trim() ?? "");
|
|
10445
10505
|
}
|
|
10446
|
-
function isDeepSeekModelId(modelId) {
|
|
10447
|
-
return modelId.toLowerCase().includes("deepseek");
|
|
10448
|
-
}
|
|
10449
|
-
function shouldInjectMessagesToolCallTips(userAgent, targetModel) {
|
|
10450
|
-
return isCodexUserAgent(userAgent) && !isDeepSeekModelId(targetModel);
|
|
10451
|
-
}
|
|
10452
10506
|
/**
|
|
10453
10507
|
* Proxies a models request to the fixed Codex upstream models endpoint.
|
|
10454
10508
|
* Returns a 404 JSON response when the codex provider is unavailable.
|
|
@@ -10518,7 +10572,6 @@ function createSyntheticCodexModel(candidate, template, priority) {
|
|
|
10518
10572
|
const defaultReasoningEffort = reasoningEfforts.includes(candidate.defaultReasoningEffort) ? candidate.defaultReasoningEffort : reasoningEfforts[0];
|
|
10519
10573
|
const supportsReasoning = reasoningEfforts.some((effort) => effort !== "none");
|
|
10520
10574
|
const inputModalities = [...new Set(candidate.inputModalities)];
|
|
10521
|
-
const isDeepSeekModel = isDeepSeekModelId(candidate.slug);
|
|
10522
10575
|
return {
|
|
10523
10576
|
...template,
|
|
10524
10577
|
slug: candidate.slug,
|
|
@@ -10534,11 +10587,11 @@ function createSyntheticCodexModel(candidate, template, priority) {
|
|
|
10534
10587
|
apply_patch_tool_type: "freeform",
|
|
10535
10588
|
web_search_tool_type: "text_and_image",
|
|
10536
10589
|
supports_search_tool: false,
|
|
10537
|
-
use_responses_lite:
|
|
10538
|
-
tool_mode:
|
|
10590
|
+
use_responses_lite: true,
|
|
10591
|
+
tool_mode: "code_mode_only",
|
|
10539
10592
|
multi_agent_version: "v2",
|
|
10540
10593
|
multi_agent_reasoning_effort: null,
|
|
10541
|
-
shell_type:
|
|
10594
|
+
shell_type: template.shell_type,
|
|
10542
10595
|
experimental_supported_tools: [],
|
|
10543
10596
|
input_modalities: inputModalities,
|
|
10544
10597
|
supports_image_detail_original: false,
|
|
@@ -11892,7 +11945,7 @@ async function handleResponsesViaMessages(c, options) {
|
|
|
11892
11945
|
}, {
|
|
11893
11946
|
model: options.targetModel,
|
|
11894
11947
|
publicModel: options.publicModel,
|
|
11895
|
-
toolCallTips:
|
|
11948
|
+
toolCallTips: isCodexUserAgent(c.req.header("user-agent"))
|
|
11896
11949
|
});
|
|
11897
11950
|
const context = translation;
|
|
11898
11951
|
debugJson(logger$3, "Translated Messages request:", {
|
|
@@ -12490,4 +12543,4 @@ createServer();
|
|
|
12490
12543
|
//#endregion
|
|
12491
12544
|
export { createServer };
|
|
12492
12545
|
|
|
12493
|
-
//# sourceMappingURL=server-
|
|
12546
|
+
//# sourceMappingURL=server-Cqju93ku.js.map
|