@jeffreycao/copilot-api 2.7.1 → 2.7.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.
Files changed (37) hide show
  1. package/dist/auth-C3_rHdk6.js +2 -0
  2. package/dist/{auth-2VWfdcpq.js → auth-DC-EO-eb.js} +68 -26
  3. package/dist/auth-DC-EO-eb.js.map +1 -0
  4. package/dist/{config-B2OaAnpL.js → config-DIDLVXMU.js} +24 -6
  5. package/dist/config-DIDLVXMU.js.map +1 -0
  6. package/dist/{config-store-CARrUljo.js → config-store-CMgB1mCV.js} +2 -1
  7. package/dist/config-store-CMgB1mCV.js.map +1 -0
  8. package/dist/{copilot-runtime-B7T_EuGD.js → copilot-runtime-CRTYwDWy.js} +3 -3
  9. package/dist/{copilot-runtime-B7T_EuGD.js.map → copilot-runtime-CRTYwDWy.js.map} +1 -1
  10. package/dist/{debug-CcfAczV9.js → debug-B0URJ4gT.js} +3 -3
  11. package/dist/{debug-CcfAczV9.js.map → debug-B0URJ4gT.js.map} +1 -1
  12. package/dist/{github-copilot-provider-DlQZgaCT.js → github-copilot-provider-CLEAHyT-.js} +2 -2
  13. package/dist/{github-copilot-provider-DlQZgaCT.js.map → github-copilot-provider-CLEAHyT-.js.map} +1 -1
  14. package/dist/main.js +6 -6
  15. package/dist/{mcp-Byz9h_xz.js → mcp-CuZyqwi8.js} +2 -2
  16. package/dist/{mcp-Byz9h_xz.js.map → mcp-CuZyqwi8.js.map} +1 -1
  17. package/dist/mcp-server-BH-SFdCD.js +2 -0
  18. package/dist/{mcp-server-D6uKVzo6.js → mcp-server-CKEydKaf.js} +2 -2
  19. package/dist/{mcp-server-D6uKVzo6.js.map → mcp-server-CKEydKaf.js.map} +1 -1
  20. package/dist/{provider-DktH3jcC.js → provider-C2Hs8Dua.js} +2 -2
  21. package/dist/{provider-DktH3jcC.js.map → provider-C2Hs8Dua.js.map} +1 -1
  22. package/dist/{provider-management-z3m7cUkp.js → provider-management-BjU3aJnC.js} +3 -3
  23. package/dist/{provider-management-z3m7cUkp.js.map → provider-management-BjU3aJnC.js.map} +1 -1
  24. package/dist/{server-BYG25POu.js → server-DbkseGH6.js} +96 -24
  25. package/dist/server-DbkseGH6.js.map +1 -0
  26. package/dist/{start-v0WnZYEn.js → start-C_Svr70X.js} +8 -8
  27. package/dist/{start-v0WnZYEn.js.map → start-C_Svr70X.js.map} +1 -1
  28. package/dist/{token-Cx07G8-R.js → token-BjzzuPSb.js} +604 -334
  29. package/dist/token-BjzzuPSb.js.map +1 -0
  30. package/package.json +1 -1
  31. package/dist/auth-2VWfdcpq.js.map +0 -1
  32. package/dist/auth-DFH2l7hT.js +0 -2
  33. package/dist/config-B2OaAnpL.js.map +0 -1
  34. package/dist/config-store-CARrUljo.js.map +0 -1
  35. package/dist/mcp-server-ouCaZXlw.js +0 -2
  36. package/dist/server-BYG25POu.js.map +0 -1
  37. package/dist/token-Cx07G8-R.js.map +0 -1
@@ -1,10 +1,10 @@
1
- import { a as getAnthropicApiKey, c as getConfig, f as isAlphaSearchCodexPriorityEnabled, h as isResponsesApiWebSocketEnabled, i as getAlphaSearchModel, l as getMessageApiWebSearchModel, m as isResponsesApiWebSearchEnabled, o as getClaudeAutoModel, p as isMessagesApiEnabled, s as getClaudeTokenMultiplier, u as getUpstreamTransportConfig, v as reloadConfig, x as PATHS } from "./config-store-CARrUljo.js";
2
- import { C as resolveMappedModel, S as isGpt56OrAbove, _ as getReasoningEffortForModel, b as isContextManagementEnabledForMessages, d as getOpencodeGoModelRecords, g as getModelResponsesApiCompactThreshold$1, h as getModelMappings, i as listEnabledProviders, l as getOpencodeGoModelConfig, m as getExtraPromptForModel, n as getRawProviderConfig, o as resolveEffectiveProviderType, s as resolveProviderConfigForModel, t as getProviderConfig, u as getOpencodeGoModelIds, v as getSmallModel, w as setModelMappings, x as isContextManagementEnabledForResponses, y as getSmallModelForProvider } from "./config-B2OaAnpL.js";
3
- import { i as HTTPError, r as isGitHubCopilotEnabled, s as forwardError } from "./github-copilot-provider-DlQZgaCT.js";
4
- import { $ as state, A as compactAutoContinuePromptStarts, B as CODEX_API_BASE_URL, C as copilotHeaders, D as prepareInteractionHeaders, E as prepareForCompact, F as createAuthMiddleware, G as resolveTraceId$1, H as forwardCodexResponses, I as getConfiguredAdminApiKeys, J as createResponsesSafeStream, K as fetchUpstreamWithLifecycle, N as compactSystemPromptStarts, O as prepareMessageProxyHeaders, P as compactTextOnlyGuard, Q as createWebSocketUrl, S as copilotBaseUrl, T as copilotWebSocketHeaders, U as generateTraceId, V as buildCodexRequestHeaders, W as requestContext, X as getResponsesStreamTerminalDisposition, Y as encodePoolKeyPart, Z as createPooledWebSocketStream, _ as parseUserIdMetadata, b as readGitHubToken, d as generateRequestIdFromPayload, f as getRootSessionId, g as isResponsesStream, h as isNullish, j as compactMessageSections, m as isAsyncIterable, n as invalidateCodexRuntime, p as getUUID, q as createResponsesHttpEventStream, s as setupCodexToken, tt as stripInternalRequestHeaders, u as stopCopilotRefreshLoop, v as getCopilotUsage, x as readGitHubTokenFromEnv } from "./token-Cx07G8-R.js";
1
+ import { a as getAnthropicApiKey, c as getConfig, f as isAlphaSearchCodexPriorityEnabled, h as isResponsesApiWebSocketEnabled, i as getAlphaSearchModel, l as getMessageApiWebSearchModel, m as isResponsesApiWebSearchEnabled, o as getClaudeAutoModel, p as isMessagesApiEnabled, s as getClaudeTokenMultiplier, u as getUpstreamTransportConfig, v as reloadConfig, x as PATHS } from "./config-store-CMgB1mCV.js";
2
+ import { C as isGpt56OrAbove, S as isContextManagementEnabledForResponses, T as setModelMappings, _ as getModelResponsesApiCompactThreshold$1, b as getSmallModelForProvider, d as getOpencodeGoModelIds, f as getOpencodeGoModelRecords, g as getModelMappings, h as getExtraPromptForModel, i as listEnabledProviders, l as getModelsDevModelMaxOutputTokens, n as getRawProviderConfig, o as resolveEffectiveProviderType, s as resolveProviderConfigForModel, t as getProviderConfig, u as getOpencodeGoModelConfig, v as getReasoningEffortForModel, w as resolveMappedModel, x as isContextManagementEnabledForMessages, y as getSmallModel } from "./config-DIDLVXMU.js";
3
+ import { i as HTTPError, r as isGitHubCopilotEnabled, s as forwardError } from "./github-copilot-provider-CLEAHyT-.js";
4
+ import { $ as createResponsesHttpEventStream, A as compactSystemPromptStarts, C as prepareForCompact, D as compactAutoContinuePromptStarts, H as readGitHubToken, I as getXaiAccessToken, J as forwardCodexResponses, K as CODEX_API_BASE_URL, M as createAuthMiddleware, N as getConfiguredAdminApiKeys, O as compactMessageSections, Q as fetchUpstreamWithLifecycle, S as copilotWebSocketHeaders, T as prepareMessageProxyHeaders, U as readGitHubTokenFromEnv, X as requestContext, Y as generateTraceId, Z as resolveTraceId$1, _ as parseUserIdMetadata, at as state, b as copilotHeaders, d as generateRequestIdFromPayload, et as createResponsesSafeStream, f as getRootSessionId, g as isResponsesStream, h as isNullish, it as createWebSocketUrl, j as compactTextOnlyGuard, m as isAsyncIterable, n as invalidateCodexRuntime, nt as getResponsesStreamTerminalDisposition, p as getUUID, q as buildCodexRequestHeaders, rt as createPooledWebSocketStream, s as setupCodexToken, st as stripInternalRequestHeaders, tt as encodePoolKeyPart, u as stopCopilotRefreshLoop, v as getCopilotUsage, w as prepareInteractionHeaders, y as copilotBaseUrl } from "./token-BjzzuPSb.js";
5
5
  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-BgFcDbNQ.js";
6
- import { n as isProviderCodexModelVisible, t as getProviderCodexModels } from "./provider-management-z3m7cUkp.js";
7
- import { a as normalizeSdkModelId, n as stopModelsRefreshLoop, o as toClientModelId, r as findEndpointModel, t as setupCopilotRuntime } from "./copilot-runtime-B7T_EuGD.js";
6
+ import { n as isProviderCodexModelVisible, t as getProviderCodexModels } from "./provider-management-BjU3aJnC.js";
7
+ import { a as normalizeSdkModelId, n as stopModelsRefreshLoop, o as toClientModelId, r as findEndpointModel, t as setupCopilotRuntime } from "./copilot-runtime-CRTYwDWy.js";
8
8
  import consola from "consola";
9
9
  import { createHash } from "node:crypto";
10
10
  import fs, { createWriteStream, readFileSync, rmSync } from "node:fs";
@@ -351,6 +351,13 @@ async function resolveProviderConfig(providerName, getAzureAccessToken = getDefa
351
351
  };
352
352
  }
353
353
  const providerConfig = getProviderConfig(normalizedProviderName);
354
+ if (providerConfig?.name === "xai" && providerConfig.authType === "oauth2") {
355
+ const accessToken = await getXaiAccessToken();
356
+ return accessToken ? {
357
+ ...providerConfig,
358
+ apiKey: accessToken
359
+ } : null;
360
+ }
354
361
  if (providerConfig?.authType !== "azure-entra") return providerConfig;
355
362
  try {
356
363
  return {
@@ -442,6 +449,28 @@ const CODEX_LUNA_PRICING = { tiers: [{
442
449
  }] };
443
450
  const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
444
451
  static catalog = {
452
+ xai: { "grok-4.7": {
453
+ contextWindow: 5e5,
454
+ maxOutputTokens: 5e5,
455
+ inputModalities: ["text", "image"],
456
+ reasoningEfforts: [
457
+ "low",
458
+ "medium",
459
+ "high",
460
+ "xhigh"
461
+ ],
462
+ defaultReasoningEffort: "high",
463
+ pricing: { tiers: [{
464
+ cachedInput: .5,
465
+ input: 2,
466
+ output: 6,
467
+ maxInputTokens: 2e5
468
+ }, {
469
+ cachedInput: 1,
470
+ input: 4,
471
+ output: 12
472
+ }] }
473
+ } },
445
474
  codex: {
446
475
  "codex-auto-review": { pricing: CODEX_LUNA_PRICING },
447
476
  "gpt-reserve": { pricing: CODEX_LUNA_PRICING },
@@ -759,6 +788,20 @@ const builtinProviderModelRegistry = new class BuiltinProviderModelRegistry {
759
788
  return value.trim().toLowerCase();
760
789
  }
761
790
  }();
791
+ function getBuiltinProviderModelRecords(provider) {
792
+ return builtinProviderModelRegistry.getModelIds(provider).map((id) => {
793
+ const config = builtinProviderModelRegistry.getModelConfig(provider, id);
794
+ return {
795
+ id,
796
+ name: id,
797
+ object: "model",
798
+ context_window: config?.contextWindow,
799
+ max_output_tokens: config?.maxOutputTokens,
800
+ input_modalities: config?.inputModalities,
801
+ reasoning_efforts: config?.reasoningEfforts
802
+ };
803
+ });
804
+ }
762
805
  //#endregion
763
806
  //#region src/lib/sqlite.ts
764
807
  const MINIMUM_NODE_SQLITE_VERSION = "22.13.0";
@@ -4141,6 +4184,7 @@ function translateToOpenAI(payload, options = {}) {
4141
4184
  toolContentSupportType: options.toolContentSupportType ?? []
4142
4185
  };
4143
4186
  const tools = translateAnthropicToolsToOpenAI(payload.tools);
4187
+ const parallelToolCalls = translateParallelToolCalls(payload.tool_choice);
4144
4188
  return {
4145
4189
  model: modelId,
4146
4190
  messages: translateAnthropicMessagesToOpenAI(payload, modelId, capabilities),
@@ -4154,7 +4198,8 @@ function translateToOpenAI(payload, options = {}) {
4154
4198
  tool_choice: tools && tools.length > 0 ? translateAnthropicToolChoiceToOpenAI(payload.tool_choice) : void 0,
4155
4199
  thinking_budget: thinkingBudget,
4156
4200
  ...reasoningEffort ? { reasoning_effort: reasoningEffort } : {},
4157
- ...promptCacheKey ? { prompt_cache_key: promptCacheKey } : {}
4201
+ ...promptCacheKey ? { prompt_cache_key: promptCacheKey } : {},
4202
+ ...parallelToolCalls === void 0 ? {} : { parallel_tool_calls: parallelToolCalls }
4158
4203
  };
4159
4204
  }
4160
4205
  function getReasoningEffort(payload, options) {
@@ -4394,6 +4439,10 @@ function translateAnthropicToolChoiceToOpenAI(anthropicToolChoice) {
4394
4439
  default: return;
4395
4440
  }
4396
4441
  }
4442
+ function translateParallelToolCalls(toolChoice) {
4443
+ if (typeof toolChoice?.disable_parallel_tool_use !== "boolean") return;
4444
+ return !toolChoice.disable_parallel_tool_use;
4445
+ }
4397
4446
  function translateToAnthropic(response) {
4398
4447
  const assistantContentBlocks = [];
4399
4448
  let stopReason = response.choices[0]?.finish_reason ?? null;
@@ -5427,17 +5476,24 @@ const translateAnthropicMessagesToResponsesPayload = (payload, subagentAgentId)
5427
5476
  metadata: payload.metadata ? { ...payload.metadata } : null,
5428
5477
  stream: payload.stream ?? null,
5429
5478
  store: false,
5430
- parallel_tool_calls: true,
5479
+ parallel_tool_calls: !payload.tool_choice?.disable_parallel_tool_use,
5431
5480
  reasoning: {
5432
5481
  effort: resolveReasoningEffort(payload),
5433
- summary: "auto",
5482
+ summary: payload.model.includes("grok") ? "concise" : "auto",
5434
5483
  context: isSupportAllTurns(payload) ? "all_turns" : "auto"
5435
5484
  },
5436
5485
  include: ["reasoning.encrypted_content"]
5437
5486
  };
5438
5487
  if (translatedTools && translatedTools.length > 0) responsesPayload.tool_choice = toolChoice;
5439
5488
  if (hasOriginalTools) responsesPayload.prompt_cache_key = promptCacheKey;
5440
- if (responsesPayload.model.includes("grok")) delete responsesPayload.metadata;
5489
+ if (responsesPayload.model.includes("grok")) {
5490
+ delete responsesPayload.metadata;
5491
+ delete responsesPayload.temperature;
5492
+ delete responsesPayload.top_p;
5493
+ delete responsesPayload.max_output_tokens;
5494
+ if (responsesPayload.instructions) input.unshift(createMessage("system", responsesPayload.instructions));
5495
+ delete responsesPayload.instructions;
5496
+ }
5441
5497
  return responsesPayload;
5442
5498
  };
5443
5499
  const encodeCompactionCarrierSignature = (compaction) => {
@@ -6552,6 +6608,7 @@ const MESSAGES_TOOL_CALL_TIPS = [
6552
6608
  "- For long-running commands, keep the returned `session_id` and poll it with `tools.write_stdin` until the command finishes; do not redirect output to a temp file and read it back in a second call.",
6553
6609
  "- If `functions__exec` returns `aborted`, retry at most 3 times. After 3 failures, terminate immediately and inform the user that `functions__exec` is unavailable."
6554
6610
  ].join("\n");
6611
+ const MESSAGES_BATCH_TOOL_CALL_TIPS = ["- Parallel tool calls are disabled for this request. Batch independent commands in one functions__exec call; keep dependent operations sequential.", "const results = await Promise.allSettled([tools.exec_command({cmd: \"git status --short\"})]); for (const result of results) text(JSON.stringify(result.status === \"fulfilled\" ? result.value : {error: String(result.reason)}))"].join("\n");
6555
6612
  const JSON_OUTPUT_CONSTRAINT = "Do not wrap the JSON in markdown code fences and do not add any text outside the JSON object.";
6556
6613
  const buildOutputFormatInstruction = (format) => {
6557
6614
  if (!format) return null;
@@ -6588,6 +6645,7 @@ function translateResponsesToMessages(payload, options) {
6588
6645
  const normalized = normalizeResponsesInput(payload.input);
6589
6646
  const outputFormatInstruction = buildOutputFormatInstruction(payload.text?.format);
6590
6647
  const { messages, system } = translateInputToAnthropic(normalized.input, registry, payload.instructions, payload.input, options.toolCallTips ?? false);
6648
+ if (options.toolCallTips && payload.parallel_tool_calls === false) appendToolCallTips(system, MESSAGES_BATCH_TOOL_CALL_TIPS);
6591
6649
  if (normalized.compaction) messages.push({
6592
6650
  role: "user",
6593
6651
  content: MESSAGES_COMPACTION_PROMPT
@@ -6603,7 +6661,7 @@ function translateResponsesToMessages(payload, options) {
6603
6661
  const messagesPayload = {
6604
6662
  model: options.model,
6605
6663
  messages,
6606
- max_tokens: Math.max(1, payload.max_output_tokens ?? 32e3),
6664
+ max_tokens: Math.max(1, payload.max_output_tokens ?? resolveDefaultMaxOutputTokens(options.model)),
6607
6665
  stream: payload.stream ?? false,
6608
6666
  temperature: payload.temperature ?? void 0,
6609
6667
  top_p: payload.top_p ?? void 0,
@@ -6614,6 +6672,10 @@ function translateResponsesToMessages(payload, options) {
6614
6672
  ...payload.service_tier === "auto" || payload.service_tier === "standard_only" ? { service_tier: payload.service_tier } : {},
6615
6673
  ...metadataUserId ? { metadata: { user_id: metadataUserId } } : {}
6616
6674
  };
6675
+ if (payload.parallel_tool_calls != null && registry.tools.length > 0 && messagesPayload.tool_choice?.type !== "none") messagesPayload.tool_choice = {
6676
+ ...messagesPayload.tool_choice ?? { type: "auto" },
6677
+ disable_parallel_tool_use: !payload.parallel_tool_calls
6678
+ };
6617
6679
  return {
6618
6680
  compaction: normalized.compaction,
6619
6681
  messagesPayload,
@@ -6622,6 +6684,17 @@ function translateResponsesToMessages(payload, options) {
6622
6684
  registry
6623
6685
  };
6624
6686
  }
6687
+ function resolveDefaultMaxOutputTokens(model) {
6688
+ const alias = parseProviderModelAlias(model);
6689
+ const providerConfig = alias ? getRawProviderConfig(alias.provider) : null;
6690
+ const catalogMaxOutputTokens = alias ? getModelsDevModelMaxOutputTokens(providerConfig?.modelsDevProviderId || alias.provider, alias.model) : void 0;
6691
+ const builtinModelConfig = alias ? builtinProviderModelRegistry.getModelConfig(alias.provider, alias.model) : void 0;
6692
+ return (alias && (providerConfig || builtinModelConfig || catalogMaxOutputTokens) ? [
6693
+ providerConfig?.models?.[alias.model]?.maxOutputTokens,
6694
+ catalogMaxOutputTokens,
6695
+ builtinModelConfig?.maxOutputTokens
6696
+ ] : [findEndpointModel(model)?.capabilities.limits.max_output_tokens]).find((limit) => typeof limit === "number" && Number.isInteger(limit) && limit > 0) ?? 32e3;
6697
+ }
6625
6698
  function translateAnthropicToResponses(response, context) {
6626
6699
  const finish = translateStopReason(response.stop_reason);
6627
6700
  const output = context.compaction ? translateCompactionOutput(response) : translateAssistantOutput(response, context.registry);
@@ -6826,16 +6899,16 @@ function translateInputToAnthropic(input, registry, instructions, originalInput,
6826
6899
  system
6827
6900
  };
6828
6901
  }
6829
- function appendToolCallTips(system) {
6902
+ function appendToolCallTips(system, tips = MESSAGES_TOOL_CALL_TIPS) {
6830
6903
  const lastSystemBlock = system.at(-1);
6831
6904
  if (!lastSystemBlock) {
6832
6905
  system.push({
6833
6906
  type: "text",
6834
- text: MESSAGES_TOOL_CALL_TIPS
6907
+ text: tips
6835
6908
  });
6836
6909
  return;
6837
6910
  }
6838
- lastSystemBlock.text = `${lastSystemBlock.text}\n\n${MESSAGES_TOOL_CALL_TIPS}`;
6911
+ lastSystemBlock.text = `${lastSystemBlock.text}\n\n${tips}`;
6839
6912
  }
6840
6913
  function translateInputItems(input, messages, system, registry) {
6841
6914
  let userMessageSeen = false;
@@ -10983,13 +11056,6 @@ function getStringField(model, field) {
10983
11056
  const value = model[field];
10984
11057
  return typeof value === "string" && value.trim() ? value : void 0;
10985
11058
  }
10986
- function getBuiltinProviderModelRecords(provider) {
10987
- return builtinProviderModelRegistry.getModelIds(provider).map((id) => ({
10988
- id,
10989
- name: id,
10990
- object: "model"
10991
- }));
10992
- }
10993
11059
  function getFallbackProviderModelRecords(provider, reason, details = {}) {
10994
11060
  const fallbackModels = getBuiltinProviderModelRecords(provider);
10995
11061
  logger$7.warn(`models.provider.fallback_${reason}`, {
@@ -11022,6 +11088,7 @@ function normalizeProviderModels(provider, models) {
11022
11088
  }
11023
11089
  async function getProviderModelRecords(providerConfig, requestHeaders) {
11024
11090
  if (providerConfig.name === "opencode-go") return getOpencodeGoModelRecords();
11091
+ if (providerConfig.name === "xai" && providerConfig.authType === "oauth2") return getBuiltinProviderModelRecords("xai");
11025
11092
  try {
11026
11093
  const response = await forwardProviderModels(providerConfig, requestHeaders);
11027
11094
  if (!response.ok) return getFallbackProviderModelRecords(providerConfig.name, "non_ok", { statusCode: response.status });
@@ -11128,7 +11195,7 @@ async function getProviderCodexCandidates(provider, requestHeaders) {
11128
11195
  const id = getStringField(model, "id");
11129
11196
  return id ? [[id, model]] : [];
11130
11197
  }));
11131
- const modelIds = /* @__PURE__ */ new Set([...remoteById.keys(), ...Object.keys(providerConfig.models ?? {})]);
11198
+ const modelIds = /* @__PURE__ */ new Set([...remoteById.keys(), ...providerConfig.name === "xai" && providerConfig.authType === "oauth2" ? [] : Object.keys(providerConfig.models ?? {})]);
11132
11199
  const candidates = [];
11133
11200
  for (const modelId of modelIds) {
11134
11201
  const effectiveType = resolveEffectiveProviderType(providerConfig, modelId);
@@ -11178,7 +11245,7 @@ function createProviderCodexCandidate(providerConfig, modelId, remoteModel, mode
11178
11245
  "max_context_length",
11179
11246
  "max_model_len"
11180
11247
  ]) ?? builtinModelConfig?.contextWindow, 256e3),
11181
- maxOutputTokens: positiveNumber(modelConfig?.maxOutputTokens ?? getFirstPositiveNumber(remoteModel, ["max_output_tokens"]) ?? builtinModelConfig?.maxOutputTokens, 32e3),
11248
+ maxOutputTokens: positiveNumber(modelConfig?.maxOutputTokens ?? getFirstPositiveNumber(remoteModel, ["max_output_tokens"]) ?? getModelsDevModelMaxOutputTokens(providerConfig.modelsDevProviderId || providerConfig.name, modelId) ?? builtinModelConfig?.maxOutputTokens, 32e3),
11182
11249
  inputModalities: resolveInputModalities(providerConfig.name, configuredModalities, remoteModalities, builtinModalities),
11183
11250
  reasoningEfforts,
11184
11251
  defaultReasoningEffort: selectDefaultReasoningEffort(reasoningEfforts, modelConfig?.defaultReasoningEffort ?? builtinModelConfig?.defaultReasoningEffort)
@@ -11362,6 +11429,11 @@ providerModelRoutes.get("/", async (c) => {
11362
11429
  has_more: false
11363
11430
  });
11364
11431
  }
11432
+ if (providerConfig.name === "xai" && providerConfig.authType === "oauth2") return c.json({
11433
+ object: "list",
11434
+ data: getBuiltinProviderModelRecords("xai"),
11435
+ has_more: false
11436
+ });
11365
11437
  const upstreamResponse = await forwardProviderModels(providerConfig, c.req.raw.headers);
11366
11438
  logger$4.debug("provider.models.response", {
11367
11439
  provider,
@@ -12878,4 +12950,4 @@ createServer();
12878
12950
  //#endregion
12879
12951
  export { createServer };
12880
12952
 
12881
- //# sourceMappingURL=server-BYG25POu.js.map
12953
+ //# sourceMappingURL=server-DbkseGH6.js.map