@jeffreycao/copilot-api 1.11.3 → 1.11.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/dist/main.js CHANGED
@@ -43,7 +43,7 @@ const { auth } = await import("./auth-D3ta3JW0.js");
43
43
  const { checkUsage } = await import("./check-usage-Dh0WqiLC.js");
44
44
  const { debug } = await import("./debug-BiX0ewij.js");
45
45
  const { mcp } = await import("./mcp-DZgcvqQY.js");
46
- const { start } = await import("./start-t4js93GE.js");
46
+ const { start } = await import("./start-Bxn62Q9K.js");
47
47
  await runMain(defineCommand({
48
48
  meta: {
49
49
  name: "copilot-api",
@@ -1918,6 +1918,18 @@ function getAnthropicToolUseBlocks(toolCalls) {
1918
1918
  }
1919
1919
  //#endregion
1920
1920
  //#region src/lib/models.ts
1921
+ /**
1922
+ * Converts a Copilot upstream model ID to a client-friendly ID that Claude Code
1923
+ * and Claude Desktop recognize (dots in version replaced with hyphens).
1924
+ * e.g. "claude-sonnet-4.6" -> "claude-sonnet-4-6"
1925
+ * Non-Claude models are returned unchanged.
1926
+ */
1927
+ const toClientModelId = (modelId) => {
1928
+ const normalized = normalizeSdkModelId(modelId);
1929
+ if (!normalized) return modelId;
1930
+ const versionHyphenated = normalized.version.replace(/\./g, "-");
1931
+ return `claude-${normalized.family}-${versionHyphenated}`;
1932
+ };
1921
1933
  const findEndpointModel = (sdkModelId) => {
1922
1934
  const models = state.models?.data ?? [];
1923
1935
  const exactMatch = models.find((m) => m.id === sdkModelId);
@@ -5666,10 +5678,11 @@ modelRoutes.get("/", async (c) => {
5666
5678
  try {
5667
5679
  if (!state.models) await cacheModels();
5668
5680
  const models = state.models?.data.map((model) => {
5669
- const is1m = model.capabilities.limits?.max_context_window_tokens === 1e6;
5681
+ const contextWindow = model.capabilities?.limits?.max_context_window_tokens ?? 0;
5682
+ const clientId = toClientModelId(model.id);
5670
5683
  return {
5671
5684
  ...model,
5672
- id: is1m ? `${model.id}[1m]` : model.id,
5685
+ id: contextWindow > 1e6 ? `${clientId}[1m]` : clientId,
5673
5686
  object: "model",
5674
5687
  type: "model",
5675
5688
  created: 0,
@@ -6156,4 +6169,4 @@ server.route("/:provider/v1/models", providerModelRoutes);
6156
6169
  //#endregion
6157
6170
  export { server };
6158
6171
 
6159
- //# sourceMappingURL=server-CSpOUSFF.js.map
6172
+ //# sourceMappingURL=server-BKXMXGoo.js.map