@jeffreycao/copilot-api 2.6.8 → 2.6.11

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/dist/main.js CHANGED
@@ -30,7 +30,7 @@ if (isMcpFastPath(process.argv)) {
30
30
  const { auth } = await import("./auth-BTdaexGw.js");
31
31
  const { debug } = await import("./debug-DXGZGaoU.js");
32
32
  const { mcp } = await import("./mcp-Byz9h_xz.js");
33
- const { start } = await import("./start-Ok-mpEDJ.js");
33
+ const { start } = await import("./start-CYq2v7cu.js");
34
34
  await runMain(defineCommand({
35
35
  meta: {
36
36
  name: "copilot-api",
@@ -535,37 +535,20 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
535
535
  }] } }
536
536
  },
537
537
  dashscope: {
538
- "glm-5.1": {
539
- contextWindow: 202752,
540
- inputModalities: ["text"],
541
- maxOutputTokens: 64e3,
542
- pricing: { tiers: [{
543
- cachedInput: 1.2,
544
- cacheCreationInput: 7.5,
545
- explicitCachedInput: .6,
546
- input: 6,
547
- maxInputTokens: 32e3,
548
- output: 24
549
- }, {
550
- cachedInput: 1.6,
551
- cacheCreationInput: 10,
552
- explicitCachedInput: .8,
553
- input: 8,
554
- maxInputTokens: 2e5,
555
- output: 28
556
- }] }
557
- },
558
- "glm-5.2": {
538
+ "glm-5.3": {
559
539
  contextWindow: 1e6,
560
540
  inputModalities: ["text"],
561
541
  maxOutputTokens: 64e3,
562
542
  pricing: {
563
543
  cachedInput: 2,
564
- cacheCreationInput: 10,
565
- explicitCachedInput: .8,
566
544
  input: 8,
567
545
  output: 28
568
- }
546
+ },
547
+ reasoningEfforts: [
548
+ "low",
549
+ "high",
550
+ "max"
551
+ ]
569
552
  },
570
553
  "ZHIPU/GLM-5.3": {
571
554
  contextWindow: 1048576,
@@ -597,17 +580,20 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
597
580
  "max"
598
581
  ]
599
582
  },
600
- "qwen3.7-max": {
601
- contextWindow: 1e6,
602
- inputModalities: ["text"],
603
- maxOutputTokens: 64e3,
583
+ "ZHIPU/GLM-5.3-FlashX": {
584
+ contextWindow: 1048576,
585
+ inputModalities: ["text", "image"],
586
+ maxOutputTokens: 131072,
604
587
  pricing: {
605
- cachedInput: 2.4,
606
- cacheCreationInput: 15,
607
- explicitCachedInput: 1.2,
608
- input: 12,
609
- output: 36
610
- }
588
+ cachedInput: .57,
589
+ input: 2,
590
+ output: 7
591
+ },
592
+ reasoningEfforts: [
593
+ "low",
594
+ "high",
595
+ "max"
596
+ ]
611
597
  },
612
598
  "qwen3.8-max": {
613
599
  contextWindow: 1e6,
@@ -645,22 +631,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
645
631
  output: 2.7
646
632
  }
647
633
  },
648
- "deepseek-v4-flash-0731": {
649
- contextWindow: 1e6,
650
- inputModalities: ["text"],
651
- maxOutputTokens: 64e3,
652
- pricing: {
653
- cachedInput: .3,
654
- input: 3,
655
- offPeak: {
656
- cachedInput: .15,
657
- input: 1.5,
658
- output: 4.5
659
- },
660
- output: 9,
661
- peakWindows: dashscopePeakWindows
662
- }
663
- },
664
634
  "deepseek-v4.1-flash": {
665
635
  contextWindow: 1e6,
666
636
  inputModalities: ["text", "image"],
@@ -753,17 +723,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
753
723
  }
754
724
  },
755
725
  "opencode-go": {
756
- hy3: {
757
- contextWindow: 256e3,
758
- inputModalities: ["text"],
759
- maxOutputTokens: 64e3,
760
- pricing: {
761
- cachedInput: .035,
762
- input: .14,
763
- output: .58
764
- },
765
- reasoningField: "reasoning"
766
- },
767
726
  "hy4-preview": {
768
727
  contextWindow: 1024e3,
769
728
  inputModalities: ["text"],
@@ -776,28 +735,18 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
776
735
  reasoningEfforts: ["high"],
777
736
  reasoningField: "reasoning"
778
737
  },
779
- "gpt-5.6-luna": { pricing: { tiers: [{
738
+ "gpt-6-luna": { pricing: { tiers: [{
780
739
  cacheCreationInput: .125,
781
740
  cachedInput: .01,
782
741
  input: .1,
783
742
  maxInputTokens: 272e3,
784
- output: .6
743
+ output: .5
785
744
  }, {
786
745
  cacheCreationInput: .25,
787
746
  cachedInput: .02,
788
747
  input: .2,
789
- output: .9
748
+ output: .75
790
749
  }] } },
791
- "glm-5.2": {
792
- contextWindow: 1e6,
793
- inputModalities: ["text"],
794
- maxOutputTokens: 64e3,
795
- pricing: {
796
- cachedInput: .26,
797
- input: 1.4,
798
- output: 4.4
799
- }
800
- },
801
750
  "glm-5.3": {
802
751
  contextWindow: 1e6,
803
752
  inputModalities: ["text"],
@@ -823,23 +772,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
823
772
  "max"
824
773
  ]
825
774
  },
826
- "muse-spark-1.2-contributor": {
827
- contextWindow: 1048576,
828
- inputModalities: ["text", "image"],
829
- maxOutputTokens: 131072,
830
- pricing: {
831
- cachedInput: .002,
832
- input: .1,
833
- output: .2
834
- },
835
- reasoningEfforts: [
836
- "minimal",
837
- "low",
838
- "medium",
839
- "high",
840
- "xhigh"
841
- ]
842
- },
843
775
  "muse-spark-1.3-contributor": {
844
776
  contextWindow: 1048576,
845
777
  inputModalities: ["text", "image"],
@@ -857,49 +789,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
857
789
  "xhigh"
858
790
  ]
859
791
  },
860
- "grok-4.5": {
861
- contextWindow: 5e5,
862
- defaultReasoningEffort: "high",
863
- inputModalities: ["text", "image"],
864
- maxOutputTokens: 64e3,
865
- pricing: { tiers: [{
866
- cachedInput: .5,
867
- input: 2,
868
- maxInputTokens: 2e5,
869
- output: 6
870
- }, {
871
- cachedInput: 1,
872
- input: 4,
873
- output: 12
874
- }] },
875
- reasoningEfforts: [
876
- "low",
877
- "medium",
878
- "high"
879
- ]
880
- },
881
- "grok-4.6": {
882
- contextWindow: 5e5,
883
- defaultReasoningEffort: "high",
884
- inputModalities: ["text", "image"],
885
- maxOutputTokens: 64e3,
886
- pricing: { tiers: [{
887
- cachedInput: .5,
888
- input: 2,
889
- maxInputTokens: 2e5,
890
- output: 6
891
- }, {
892
- cachedInput: 1,
893
- input: 4,
894
- output: 12
895
- }] },
896
- reasoningEfforts: [
897
- "low",
898
- "medium",
899
- "high",
900
- "xhigh"
901
- ]
902
- },
903
792
  "grok-4.7": {
904
793
  contextWindow: 5e5,
905
794
  defaultReasoningEffort: "high",
@@ -943,43 +832,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
943
832
  "max"
944
833
  ]
945
834
  },
946
- "deepseek-v4-flash": {
947
- contextWindow: 1e6,
948
- inputModalities: ["text"],
949
- maxOutputTokens: 64e3,
950
- pricing: {
951
- cachedInput: .006,
952
- input: .3,
953
- offPeak: {
954
- cachedInput: .003,
955
- input: .15,
956
- output: .6
957
- },
958
- output: 1.2,
959
- peakWindows: deepseekPeakWindows
960
- }
961
- },
962
- "deepseek-v4-flash-vision-exp": {
963
- contextWindow: 1e6,
964
- inputModalities: ["text", "image"],
965
- maxOutputTokens: 384e3,
966
- pricing: {
967
- cachedInput: .006,
968
- input: .3,
969
- offPeak: {
970
- cachedInput: .003,
971
- input: .15,
972
- output: .6
973
- },
974
- output: 1.2,
975
- peakWindows: deepseekPeakWindows
976
- },
977
- reasoningEfforts: [
978
- "low",
979
- "high",
980
- "max"
981
- ]
982
- },
983
835
  "deepseek-v4-pro": {
984
836
  contextWindow: 1e6,
985
837
  inputModalities: ["text"],
@@ -996,16 +848,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
996
848
  peakWindows: deepseekPeakWindows
997
849
  }
998
850
  },
999
- "kimi-k2.7-code": {
1000
- contextWindow: 262144,
1001
- inputModalities: ["text", "image"],
1002
- maxOutputTokens: 64e3,
1003
- pricing: {
1004
- cachedInput: .19,
1005
- input: .95,
1006
- output: 4
1007
- }
1008
- },
1009
851
  "kimi-k3": {
1010
852
  contextWindow: 1048576,
1011
853
  inputModalities: ["text", "image"],
@@ -1016,26 +858,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
1016
858
  output: 15
1017
859
  }
1018
860
  },
1019
- "mimo-v2.5": {
1020
- contextWindow: 1e6,
1021
- inputModalities: ["text", "image"],
1022
- maxOutputTokens: 64e3,
1023
- pricing: {
1024
- cachedInput: .0028,
1025
- input: .14,
1026
- output: .28
1027
- }
1028
- },
1029
- "mimo-v2.5-pro": {
1030
- contextWindow: 1048576,
1031
- inputModalities: ["text"],
1032
- maxOutputTokens: 64e3,
1033
- pricing: {
1034
- cachedInput: .0145,
1035
- input: 1.74,
1036
- output: 3.48
1037
- }
1038
- },
1039
861
  "mimo-v2.6-flash": {
1040
862
  contextWindow: 1048576,
1041
863
  inputModalities: ["text", "image"],
@@ -1074,17 +896,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
1074
896
  output: 4.8
1075
897
  }] }
1076
898
  },
1077
- "qwen3.7-max": {
1078
- contextWindow: 1e6,
1079
- inputModalities: ["text"],
1080
- maxOutputTokens: 64e3,
1081
- pricing: {
1082
- cacheCreationInput: 3.125,
1083
- cachedInput: .5,
1084
- input: 2.5,
1085
- output: 7.5
1086
- }
1087
- },
1088
899
  "qwen3.8-max": {
1089
900
  contextWindow: 1e6,
1090
901
  inputModalities: ["text", "image"],
@@ -1112,16 +923,6 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
1112
923
  "xhigh"
1113
924
  ]
1114
925
  },
1115
- "minimax-m2.7": {
1116
- contextWindow: 204800,
1117
- inputModalities: ["text"],
1118
- maxOutputTokens: 64e3,
1119
- pricing: {
1120
- cachedInput: .06,
1121
- input: .3,
1122
- output: 1.2
1123
- }
1124
- },
1125
926
  "minimax-m3": {
1126
927
  contextWindow: 1e6,
1127
928
  inputModalities: ["text", "image"],
@@ -3366,8 +3167,17 @@ const applyDashScopePreserveThinkingDefault = (payload, providerConfig) => {
3366
3167
  if (!isDashScopeAliyunProvider(providerConfig)) return;
3367
3168
  if (!Object.hasOwn(payload, "preserve_thinking")) payload.preserve_thinking = true;
3368
3169
  };
3170
+ const normalizeDashScopeAssistantTextContent = (messages) => {
3171
+ for (const message of messages) {
3172
+ if (message.role !== "assistant" || !Array.isArray(message.content)) continue;
3173
+ const textParts = message.content.filter((part) => part.type === "text");
3174
+ if (textParts.length === 0 || textParts.length !== message.content.length) continue;
3175
+ message.content = textParts.map((part) => part.text).join("");
3176
+ }
3177
+ };
3369
3178
  const applyOpenAICompatibleContextCache = (payload) => {
3370
3179
  if (payload.model.includes("/")) return;
3180
+ if (!payload.model.toLowerCase().includes("qwen")) return;
3371
3181
  const messageIndexes = selectContextCacheMessageIndexes(payload.messages);
3372
3182
  for (const messageIndex of messageIndexes) applyContextCacheControl(payload.messages[messageIndex]);
3373
3183
  };
@@ -5528,7 +5338,7 @@ function handleReasoningOpaqueInToolCalls(state, events, delta) {
5528
5338
  function handleContent(delta, state, events) {
5529
5339
  if (delta.content && delta.content.length > 0) {
5530
5340
  closeThinkingBlockIfOpen(state, events);
5531
- if (isToolBlockOpen(state) || hasToolCallDelta(delta)) {
5341
+ if (isToolBlockOpen(state)) {
5532
5342
  state.deferredContent = `${state.deferredContent ?? ""}${delta.content}`;
5533
5343
  return;
5534
5344
  }
@@ -5568,9 +5378,6 @@ function handleContent(delta, state, events) {
5568
5378
  state.thinkingBlockOpen = false;
5569
5379
  }
5570
5380
  }
5571
- function hasToolCallDelta(delta) {
5572
- return Boolean(delta.tool_calls && delta.tool_calls.length > 0);
5573
- }
5574
5381
  function flushDeferredContent(state, events) {
5575
5382
  if (!state.deferredContent) return;
5576
5383
  if (!state.contentBlockOpen) {
@@ -8547,6 +8354,7 @@ const createOpenAICompatiblePayload = (payload, modelConfig, providerConfig) =>
8547
8354
  applyMiMoThinking(openAIPayload, payload);
8548
8355
  applyDashScopePreserveThinkingDefault(openAIPayload, providerConfig);
8549
8356
  if (!Object.hasOwn(openAIPayload, "parallel_tool_calls")) openAIPayload.parallel_tool_calls = true;
8357
+ if (isDashScopeProvider) normalizeDashScopeAssistantTextContent(openAIPayload.messages);
8550
8358
  if (modelConfig?.contextCache ?? isDashScopeProvider) applyOpenAICompatibleContextCache(openAIPayload);
8551
8359
  return openAIPayload;
8552
8360
  };
@@ -10840,10 +10648,11 @@ async function handleCodexModelsProxy(c, resolvedProviderConfig) {
10840
10648
  return createProviderProxyResponse(await forwardCodexModels(c.req.url, c.req.raw.headers));
10841
10649
  }
10842
10650
  async function handleMergedCodexModels(c, candidatesRequest, options = {}) {
10843
- const [upstreamCatalog, candidates] = await Promise.all([tryGetCodexCatalog(c), Promise.resolve(candidatesRequest).catch((error) => {
10651
+ const [upstreamCatalogResult, candidates] = await Promise.all([tryGetCodexCatalog(c), Promise.resolve(candidatesRequest).catch((error) => {
10844
10652
  logger$8.warn("models.codex.candidates_error", { error });
10845
10653
  return [];
10846
10654
  })]);
10655
+ const upstreamCatalog = upstreamCatalogResult?.catalog;
10847
10656
  const upstreamModels = upstreamCatalog?.models ?? FALLBACK_CODEX_MODELS;
10848
10657
  const template = selectTemplate(upstreamModels);
10849
10658
  const catalogModelsBySlug = new Map(upstreamModels.map((model) => [model.slug, model]));
@@ -10876,7 +10685,12 @@ async function handleMergedCodexModels(c, candidatesRequest, options = {}) {
10876
10685
  ...upstreamCatalog ?? {},
10877
10686
  models
10878
10687
  };
10879
- return c.json(response);
10688
+ const result = c.json(response);
10689
+ if (upstreamCatalogResult?.etag) {
10690
+ result.headers.set("ETag", upstreamCatalogResult.etag);
10691
+ result.headers.set("Cache-Control", "private, no-store");
10692
+ }
10693
+ return result;
10880
10694
  }
10881
10695
  function createCatalogAlias(model, slug, providerName) {
10882
10696
  const alias = {
@@ -10964,7 +10778,10 @@ async function tryGetCodexCatalog(c) {
10964
10778
  logger$8.warn("models.codex.catalog_invalid");
10965
10779
  return null;
10966
10780
  }
10967
- return body;
10781
+ return {
10782
+ catalog: body,
10783
+ etag: response.headers.get("ETag")
10784
+ };
10968
10785
  } catch (error) {
10969
10786
  logger$8.warn("models.codex.catalog_error", { error });
10970
10787
  return null;
@@ -12267,6 +12084,7 @@ const logger$3 = createHandlerLogger("responses-messages-handler");
12267
12084
  const responsesMessagesDependencies = { handleCompletionPayload };
12268
12085
  async function handleResponsesViaMessages(c, options) {
12269
12086
  try {
12087
+ if (isCodexUserAgent(c.req.header("user-agent")) && options.targetModel.toLowerCase().includes("mimo-v2.6")) throw new ResponsesMessagesTranslationError("MiMo v2.6 cannot return valid Codex custom tool responses. Please switch models.");
12270
12088
  const translation = translateResponsesToMessages({
12271
12089
  ...options.payload,
12272
12090
  model: options.publicModel
@@ -12875,4 +12693,4 @@ createServer();
12875
12693
  //#endregion
12876
12694
  export { createServer };
12877
12695
 
12878
- //# sourceMappingURL=server-Dj5GGJWN.js.map
12696
+ //# sourceMappingURL=server-Biyjjk2W.js.map