@xopcai/xopc 0.0.132 → 0.0.133
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/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CnZIdUyv.js → agent-avatar-dicebear-Ab81VpCx.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-C-rdLOrb.js → agents-HCGFJG8I.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BcvaXb7T.js → app-management-settings-panel-DMI_sbnc.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CuxzNz-I.js → appearance-settings-oQiCWQIQ.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-_VJm0o44.js → apps-page-CRYuPIdb.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CcXXh0X9.js → archive-plugin-BaKuWJws.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BYhYBw17.js → attachment-load-DYCFtbAA.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-ByjDtlOw.js → automation-suggestion-card-C6ZIz_B1.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DUFct5t3.js → automations-page-DjbtV2VP.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-B1A5KhWX.js → binary-plugins-Bdg1hfhV.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DWpXiVTf.js → block-editor-CEgvbzpG.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-Cff75b5Z.js → browser-settings-page-KcwlS_iE.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-api-DFWL6PJ0.js → capability-presets-api-CC3vmrm5.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CBT89nI-.js → capability-presets-settings-panel-Di4uiKbv.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-DHBjZ2fa.js → channels-settings-DMa0BEWf.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-B4CGNErH.js → connectors-page-DIZKYaMj.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CDD29oYv.js → desktop-pet-CNnlqbkx.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CEkfvSnb.js → desktop-pet-settings-ukJCc0LA.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-JbVQ2_md.js → directory-picker-path-field-8hoieEyt.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-C-fzh8SN.js → dreaming-settings-BOrBSNLL.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-B4jZ0Yim.js → extension-debug-page-D6Jc0hYZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Bi0GmOZ2.js → extension-page-CJMhBASX.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BJpxz8Dq.js → extension-settings-page-Dt-FWyMN.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-Ci1tJtJ4.js → gateway-config-api-CyYi-a3k.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-C-YBJHLX.js → gateway-settings-yJvCmOBC.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-DhfNsglx.js → goal-create-dialog-B3PLFUAl.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-9WeYgD-u.js → goal-detail-page-BQXW29kk.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-DRJGqa_W.js → goals-config-api-FU_bdYvR.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-DXEQqzEX.js → goals-page-BmppU6mC.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-5pFGRkD6.js → goals-settings-BsXWV6CN.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CGX78-fM.js → heartbeat-settings-BqwSCZLD.js} +1 -1
- package/dist/gateway/static/root/assets/index-DXUkWmeK.css +1 -0
- package/dist/gateway/static/root/assets/{index-BjGnv8uJ.js → index-DqFBdoK-.js} +31 -31
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D23eHsli.js → keyboard-shortcuts-settings-D8J0hkTt.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-jMLLOxWk.js → logs-page-Cr5ptDtc.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-Dn7rJV-v.js → markdown-split-w-hIAZ9S.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DOnTRGyE.js → media-plugins-DjFnDy3R.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-panel-Br6l-Di9.js → models-hub-panel-DEsMnITi.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BiXfX1he.js → notes-page-D7bHXaeR.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-DjaTvXj3.js → notes-workbench-DiuG4Ov7.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-CYEVap7D.js → page-tabs-smjfSAwc.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dk7Cjd6E.js → preview-open-alternatives-v02THugE.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-B6UccBNl.js → project-detail-page-Us3zDRE6.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-B56s8p-Q.js → projects-page-BcvW8R0Z.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-D3ekwIaB.js → remote-access-hub-Bun2k0V-.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-D7FzAPOc.js → save-bar-controls-CD7LPbLU.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-BZP1-U9M.js → schedule-field-Cf3p_M0z.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-1NNFTrvK.js → schema-form-D8XdvcNH.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-08vT4R9X.js → sessions-page-Bh44TVld.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BhyLZ0IW.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-CX5IUGk1.js → settings-collapsible-section-BVpPSgMs.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-a71ujXN4.js → settings-form-section-GAwBG9Vp.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-D4mq628A.js → settings-loading-skeleton-CGxa3aCb.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DSQWZsZt.js → settings-page-bZKl6uRR.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BG-k3_CF.js → settings-page-layout-DfbMLJgN.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CFBgxLKm.js → setup-status-panel-DBIruh16.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Cz4X3Vcf.js → share-preview-page-BglBMvA0.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BHjEkA9t.js → shares-settings-C0fR-Oto.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BG-FEo9B.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-C0KVNC0o.js → skills-page-CwwZOoCH.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Bo9mLewC.js → system-settings-panel-CTT0BkbS.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-Bp6wXydR.js → typed-models-lib-Fa9PjI0-.js} +1 -1
- package/dist/gateway/static/root/assets/{user-profile-settings-panel-NcG1KFUf.js → user-profile-settings-panel-pCK-aMqu.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-BNtcPshb.js → utils-aleluS3U.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-ByppRAVD.js → voice-api-key-field-Fh4mqUIK.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-5wdg0Xmy.js → work-item-detail-page-C0_3nId3.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-eKBZIV-N.js → workflow-run-setup-panel-r969H1r2.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-start-dialog-B6qfU5GE.js → workflow-start-dialog-C1GbcWN0.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-BtLILZtw.js → workflows-page-DsPM3HEI.js} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +5 -5
- package/dist/src/agent/image/tool-model-config.js.map +1 -1
- package/dist/src/agent/transcript/thinking-types.js +2 -0
- package/dist/src/agent/transcript/thinking-types.js.map +1 -1
- package/dist/src/auth/oauth/google-oauth/google-gemini-cli.d.ts +1 -1
- package/dist/src/auth/oauth/google-oauth/google-gemini-cli.js.map +1 -1
- package/dist/src/chat-commands/builtins/model.js +3 -3
- package/dist/src/chat-commands/builtins/model.js.map +1 -1
- package/dist/src/cli/commands/models.js +9 -0
- package/dist/src/cli/commands/models.js.map +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/status.js +2 -2
- package/dist/src/gateway/hono/routes/status.js.map +1 -1
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js.map +1 -1
- package/dist/src/providers/domestic-presets.d.ts +5 -15
- package/dist/src/providers/domestic-presets.js +31 -49
- package/dist/src/providers/domestic-presets.js.map +1 -1
- package/dist/src/providers/index.js +19 -5
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/model-registry.js.map +1 -1
- package/dist/src/providers/model-supplements.d.ts +6 -0
- package/dist/src/providers/model-supplements.js +22 -0
- package/dist/src/providers/model-supplements.js.map +1 -0
- package/dist/src/providers/presentation.js +25 -26
- package/dist/src/providers/presentation.js.map +1 -1
- package/dist/src/voice/tts/summarize.js +1 -1
- package/dist/src/voice/tts/summarize.js.map +1 -1
- package/package.json +5 -5
- package/dist/gateway/static/root/assets/index-W4ogAiHt.css +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-IsaFJ6ZC.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CfHG_ekm.js +0 -1
|
@@ -328,28 +328,19 @@ const DOMESTIC_PROVIDER_PRESETS = [
|
|
|
328
328
|
}],
|
|
329
329
|
defaultBaseUrlPreset: "cn",
|
|
330
330
|
defaultModel: "kimi-k2.7-code",
|
|
331
|
-
models: [
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
input: ["text"]
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
id: "kimi-k2.5",
|
|
348
|
-
name: "Kimi K2.5",
|
|
349
|
-
contextWindow: 128e3,
|
|
350
|
-
input: ["text"]
|
|
351
|
-
}
|
|
352
|
-
],
|
|
331
|
+
models: [{
|
|
332
|
+
id: "kimi-k2.7-code",
|
|
333
|
+
name: "Kimi K2.7 Code",
|
|
334
|
+
contextWindow: 262144,
|
|
335
|
+
maxTokens: 32768,
|
|
336
|
+
reasoning: true,
|
|
337
|
+
input: ["text", "image"]
|
|
338
|
+
}, {
|
|
339
|
+
id: "kimi-k2.6",
|
|
340
|
+
name: "Kimi K2.6",
|
|
341
|
+
contextWindow: 128e3,
|
|
342
|
+
input: ["text"]
|
|
343
|
+
}],
|
|
353
344
|
aliases: [
|
|
354
345
|
"kimi",
|
|
355
346
|
"moonshot",
|
|
@@ -373,28 +364,19 @@ const DOMESTIC_PROVIDER_PRESETS = [
|
|
|
373
364
|
}],
|
|
374
365
|
defaultBaseUrlPreset: "intl",
|
|
375
366
|
defaultModel: "kimi-k2.7-code",
|
|
376
|
-
models: [
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
input: ["text"]
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
id: "kimi-k2.5",
|
|
393
|
-
name: "Kimi K2.5",
|
|
394
|
-
contextWindow: 128e3,
|
|
395
|
-
input: ["text"]
|
|
396
|
-
}
|
|
397
|
-
],
|
|
367
|
+
models: [{
|
|
368
|
+
id: "kimi-k2.7-code",
|
|
369
|
+
name: "Kimi K2.7 Code",
|
|
370
|
+
contextWindow: 262144,
|
|
371
|
+
maxTokens: 32768,
|
|
372
|
+
reasoning: true,
|
|
373
|
+
input: ["text", "image"]
|
|
374
|
+
}, {
|
|
375
|
+
id: "kimi-k2.6",
|
|
376
|
+
name: "Kimi K2.6",
|
|
377
|
+
contextWindow: 128e3,
|
|
378
|
+
input: ["text"]
|
|
379
|
+
}],
|
|
398
380
|
aliases: [
|
|
399
381
|
"kimi intl",
|
|
400
382
|
"moonshot intl",
|
|
@@ -411,16 +393,16 @@ const DOMESTIC_PROVIDER_PRESETS = [
|
|
|
411
393
|
pricingUrl: "https://platform.kimi.com/docs/pricing/chat",
|
|
412
394
|
envVars: ["KIMI_API_KEY", "MOONSHOT_API_KEY"],
|
|
413
395
|
api: "anthropic-messages",
|
|
414
|
-
headers: { "User-Agent": "
|
|
396
|
+
headers: { "User-Agent": "KimiCLI/1.5" },
|
|
415
397
|
baseUrlPresets: [{
|
|
416
398
|
id: "coding",
|
|
417
399
|
label: "Coding endpoint",
|
|
418
|
-
baseUrl: "https://api.kimi.com/coding
|
|
400
|
+
baseUrl: "https://api.kimi.com/coding"
|
|
419
401
|
}],
|
|
420
402
|
defaultBaseUrlPreset: "coding",
|
|
421
|
-
defaultModel: "
|
|
403
|
+
defaultModel: "k2p7",
|
|
422
404
|
models: [{
|
|
423
|
-
id: "
|
|
405
|
+
id: "k2p7",
|
|
424
406
|
name: "Kimi K2.7 Code",
|
|
425
407
|
contextWindow: 262144,
|
|
426
408
|
maxTokens: 32768,
|
|
@@ -428,7 +410,7 @@ const DOMESTIC_PROVIDER_PRESETS = [
|
|
|
428
410
|
input: ["text", "image"]
|
|
429
411
|
}, {
|
|
430
412
|
id: "kimi-for-coding",
|
|
431
|
-
name: "Kimi
|
|
413
|
+
name: "Kimi For Coding",
|
|
432
414
|
contextWindow: 262144,
|
|
433
415
|
maxTokens: 32768,
|
|
434
416
|
reasoning: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domestic-presets.js","names":[],"sources":["../../../src/providers/domestic-presets.ts"],"sourcesContent":["import type { ProviderConfig } from '../config/models-json.js';\n\nexport interface DomesticProviderModelPreset {\n id: string;\n name?: string;\n contextWindow?: number;\n maxTokens?: number;\n reasoning?: boolean;\n input?: Array<'text' | 'image'>;\n}\n\nexport interface DomesticProviderBaseUrlPreset {\n id: string;\n label: string;\n baseUrl: string;\n description?: string;\n}\n\nexport interface DomesticProviderPreset {\n id: string;\n displayName: string;\n description: string;\n docsUrl: string;\n apiKeyUrl: string;\n pricingUrl?: string;\n envVars: string[];\n api: NonNullable<ProviderConfig['api']>;\n authHeader?: boolean;\n headers?: Record<string, string>;\n baseUrlPresets: DomesticProviderBaseUrlPreset[];\n defaultBaseUrlPreset: string;\n defaultModel: string;\n models: DomesticProviderModelPreset[];\n aliases: string[];\n quirks?: string[];\n}\n\nconst QWEN_MODELS: DomesticProviderModelPreset[] = [\n { id: 'qwen3.7-max', name: 'Qwen3.7 Max', contextWindow: 1000000, input: ['text', 'image'] },\n { id: 'qwen3.7-plus', name: 'Qwen3.7 Plus', contextWindow: 1000000, input: ['text', 'image'] },\n { id: 'qwen3.6-flash', name: 'Qwen3.6 Flash', contextWindow: 1000000, input: ['text'] },\n];\n\nconst STEPFUN_MODELS: DomesticProviderModelPreset[] = [\n { id: 'step-3.7-flash', name: 'Step 3.7 Flash', contextWindow: 1000000, reasoning: true, input: ['text', 'image'] },\n { id: 'step-3.5-flash-2603', name: 'Step 3.5 Flash 2603', contextWindow: 1000000, reasoning: true, input: ['text', 'image'] },\n { id: 'step-3.5-flash', name: 'Step 3.5 Flash', contextWindow: 1000000, reasoning: true, input: ['text'] },\n];\n\nconst MIMO_MODELS: DomesticProviderModelPreset[] = [\n { id: 'mimo-v2.5-pro', name: 'MiMo V2.5 Pro', contextWindow: 1000000, reasoning: true, input: ['text'] },\n { id: 'mimo-v2.5-pro-ultraspeed', name: 'MiMo V2.5 Pro UltraSpeed', contextWindow: 1000000, reasoning: true, input: ['text'] },\n { id: 'mimo-v2.5', name: 'MiMo V2.5', contextWindow: 1000000, reasoning: true, input: ['text', 'image'] },\n];\n\nconst MINIMAX_MODELS: DomesticProviderModelPreset[] = [\n { id: 'MiniMax-M3', name: 'MiniMax M3', contextWindow: 1000000, reasoning: true, input: ['text', 'image'] },\n { id: 'MiniMax-M2.7-highspeed', name: 'MiniMax M2.7 Highspeed', contextWindow: 204800, input: ['text'] },\n { id: 'MiniMax-M2.7', name: 'MiniMax M2.7', contextWindow: 204800, input: ['text'] },\n];\n\nexport const DOMESTIC_PROVIDER_PRESETS = [\n {\n id: 'dashscope-cn',\n displayName: 'Alibaba Bailian / DashScope China',\n description: 'Alibaba Bailian Qwen models through the China DashScope OpenAI-compatible endpoint.',\n docsUrl: 'https://help.aliyun.com/zh/model-studio/developer-reference/compatibility-of-openai-with-dashscope',\n apiKeyUrl: 'https://dashscope.console.aliyun.com/apiKey',\n pricingUrl: 'https://help.aliyun.com/zh/model-studio/developer-reference/tongyi-thousand-questions-metering-and-billing',\n envVars: ['DASHSCOPE_API_KEY', 'QWEN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n {\n id: 'cn',\n label: 'China',\n baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',\n },\n ],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'qwen3.7-plus',\n models: QWEN_MODELS,\n aliases: ['qwen', 'tongyi', 'aliyun', 'bailian', 'dashscope', 'dashscope cn', '阿里百炼'],\n quirks: ['Some Qwen coding endpoints use different hosts; keep the Base URL editable.'],\n },\n {\n id: 'dashscope-intl',\n displayName: 'Alibaba Bailian / DashScope International',\n description: 'Alibaba Bailian Qwen models through the international DashScope OpenAI-compatible endpoint.',\n docsUrl: 'https://www.alibabacloud.com/help/en/model-studio/compatibility-of-openai-with-dashscope',\n apiKeyUrl: 'https://modelstudio.console.alibabacloud.com/',\n pricingUrl: 'https://www.alibabacloud.com/help/en/model-studio/billing-for-tongyi-qianwen',\n envVars: ['DASHSCOPE_API_KEY', 'QWEN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n {\n id: 'intl',\n label: 'International',\n baseUrl: 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1',\n },\n ],\n defaultBaseUrlPreset: 'intl',\n defaultModel: 'qwen3.7-plus',\n models: QWEN_MODELS,\n aliases: ['qwen intl', 'tongyi intl', 'alibaba cloud', 'dashscope intl'],\n quirks: ['Use an international DashScope key for the international endpoint.'],\n },\n {\n id: 'volcengine-ark',\n displayName: 'Volcengine Ark',\n description: 'Volcengine Ark models through the OpenAI-compatible API.',\n docsUrl: 'https://www.volcengine.com/docs/82379/1302008',\n apiKeyUrl: 'https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey',\n envVars: ['ARK_API_KEY', 'VOLCENGINE_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n {\n id: 'cn-beijing',\n label: 'China Beijing',\n baseUrl: 'https://ark.cn-beijing.volces.com/api/v3',\n description: 'Model IDs are usually Ark endpoint IDs.',\n },\n ],\n defaultBaseUrlPreset: 'cn-beijing',\n defaultModel: 'ep-your-endpoint-id',\n models: [{ id: 'ep-your-endpoint-id', name: 'Ark endpoint ID', contextWindow: 128000, input: ['text'] }],\n aliases: ['doubao', 'ark', 'volcengine', 'volces', 'bytedance'],\n quirks: ['Use the Ark endpoint id as the model id.'],\n },\n {\n id: 'volcengine-plan',\n displayName: 'Volcengine Doubao Coding Plan',\n description: 'Doubao coding-plan models through Volcengine Ark coding endpoint.',\n docsUrl: 'https://www.volcengine.com/docs/82379/1302008',\n apiKeyUrl: 'https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey',\n envVars: ['ARK_API_KEY', 'VOLCENGINE_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n { id: 'cn-beijing-coding', label: 'China Beijing Coding Plan', baseUrl: 'https://ark.cn-beijing.volces.com/api/coding/v3' },\n ],\n defaultBaseUrlPreset: 'cn-beijing-coding',\n defaultModel: 'ark-code-latest',\n models: [\n { id: 'ark-code-latest', name: 'Ark Coding Plan', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-code', name: 'Doubao Seed 2.0 Code', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-pro', name: 'Doubao Seed 2.0 Pro', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-lite', name: 'Doubao Seed 2.0 Lite', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n ],\n aliases: ['doubao coding', 'volcengine plan', 'ark coding plan', '火山方舟 coding'],\n },\n {\n id: 'byteplus-plan',\n displayName: 'BytePlus Doubao Coding Plan',\n description: 'Doubao coding-plan models through the BytePlus international coding endpoint.',\n docsUrl: 'https://docs.byteplus.com/en/docs/ModelArk/OpenAI',\n apiKeyUrl: 'https://console.byteplus.com/ark/region:ark+ap-southeast-1/apiKey',\n envVars: ['BYTEPLUS_API_KEY', 'ARK_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n { id: 'ap-southeast-coding', label: 'Asia Pacific Coding Plan', baseUrl: 'https://ark.ap-southeast.bytepluses.com/api/coding/v3' },\n ],\n defaultBaseUrlPreset: 'ap-southeast-coding',\n defaultModel: 'ark-code-latest',\n models: [\n { id: 'ark-code-latest', name: 'Ark Coding Plan', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-code', name: 'Doubao Seed 2.0 Code', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-pro', name: 'Doubao Seed 2.0 Pro', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-lite', name: 'Doubao Seed 2.0 Lite', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n ],\n aliases: ['byteplus', 'byteplus plan', 'doubao coding international'],\n },\n {\n id: 'deepseek',\n displayName: 'DeepSeek',\n description: 'DeepSeek models through the OpenAI-compatible API.',\n docsUrl: 'https://api-docs.deepseek.com/',\n apiKeyUrl: 'https://platform.deepseek.com/api_keys',\n pricingUrl: 'https://api-docs.deepseek.com/quick_start/pricing',\n envVars: ['DEEPSEEK_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'default', label: 'Default', baseUrl: 'https://api.deepseek.com' }],\n defaultBaseUrlPreset: 'default',\n defaultModel: 'deepseek-v4-pro',\n models: [\n { id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro', contextWindow: 1000000, maxTokens: 393216, reasoning: true, input: ['text'] },\n { id: 'deepseek-v4-flash', name: 'DeepSeek V4 Flash', contextWindow: 1000000, maxTokens: 393216, reasoning: true, input: ['text'] },\n ],\n aliases: ['deep seek', 'deepseek', 'r1'],\n quirks: ['Prefer current catalog models; older chat/reasoner aliases may be deprecated by the provider.'],\n },\n {\n id: 'moonshotai-cn',\n displayName: 'Kimi / Moonshot China',\n description: 'Kimi models through the Moonshot China OpenAI-compatible endpoint.',\n docsUrl: 'https://platform.moonshot.cn/docs',\n apiKeyUrl: 'https://platform.moonshot.cn/console/api-keys',\n pricingUrl: 'https://platform.moonshot.cn/docs/pricing/chat',\n envVars: ['MOONSHOT_API_KEY', 'KIMI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'cn', label: 'China', baseUrl: 'https://api.moonshot.cn/v1' }],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'kimi-k2.7-code',\n models: [\n { id: 'kimi-k2.7-code', name: 'Kimi K2.7 Code', contextWindow: 262144, maxTokens: 32768, reasoning: true, input: ['text', 'image'] },\n { id: 'kimi-k2.6', name: 'Kimi K2.6', contextWindow: 128000, input: ['text'] },\n { id: 'kimi-k2.5', name: 'Kimi K2.5', contextWindow: 128000, input: ['text'] },\n ],\n aliases: ['kimi', 'moonshot', 'moonshot cn'],\n quirks: ['Provider-specific thinking and tool-call stream fields may need compatibility handling.'],\n },\n {\n id: 'moonshotai',\n displayName: 'Kimi / Moonshot International',\n description: 'Kimi models through the Moonshot international OpenAI-compatible endpoint.',\n docsUrl: 'https://platform.moonshot.ai/docs',\n apiKeyUrl: 'https://platform.moonshot.ai/console/api-keys',\n pricingUrl: 'https://platform.moonshot.ai/docs/pricing',\n envVars: ['MOONSHOT_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'intl', label: 'International', baseUrl: 'https://api.moonshot.ai/v1' }],\n defaultBaseUrlPreset: 'intl',\n defaultModel: 'kimi-k2.7-code',\n models: [\n { id: 'kimi-k2.7-code', name: 'Kimi K2.7 Code', contextWindow: 262144, maxTokens: 32768, reasoning: true, input: ['text', 'image'] },\n { id: 'kimi-k2.6', name: 'Kimi K2.6', contextWindow: 128000, input: ['text'] },\n { id: 'kimi-k2.5', name: 'Kimi K2.5', contextWindow: 128000, input: ['text'] },\n ],\n aliases: ['kimi intl', 'moonshot intl', 'moonshot ai'],\n quirks: ['Provider-specific thinking and tool-call stream fields may need compatibility handling.'],\n },\n {\n id: 'kimi-coding',\n displayName: 'Kimi Coding',\n description: 'Kimi dedicated coding endpoint with Anthropic-compatible requests.',\n docsUrl: 'https://platform.kimi.com/docs',\n apiKeyUrl: 'https://platform.kimi.com/console/api-keys',\n pricingUrl: 'https://platform.kimi.com/docs/pricing/chat',\n envVars: ['KIMI_API_KEY', 'MOONSHOT_API_KEY'],\n api: 'anthropic-messages',\n headers: { 'User-Agent': 'claude-code/0.1.0' },\n baseUrlPresets: [{ id: 'coding', label: 'Coding endpoint', baseUrl: 'https://api.kimi.com/coding/' }],\n defaultBaseUrlPreset: 'coding',\n defaultModel: 'kimi-k2.7-code',\n models: [\n { id: 'kimi-k2.7-code', name: 'Kimi K2.7 Code', contextWindow: 262144, maxTokens: 32768, reasoning: true, input: ['text', 'image'] },\n { id: 'kimi-for-coding', name: 'Kimi Code', contextWindow: 262144, maxTokens: 32768, reasoning: true, input: ['text', 'image'] },\n ],\n aliases: ['kimi coding', 'kimi code', 'moonshot coding'],\n },\n {\n id: 'stepfun-intl',\n displayName: 'StepFun International',\n description: 'StepFun models through the international OpenAI-compatible API.',\n docsUrl: 'https://platform.stepfun.com/docs',\n apiKeyUrl: 'https://platform.stepfun.com/interface-key',\n envVars: ['STEPFUN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'intl', label: 'International', baseUrl: 'https://api.stepfun.ai/v1' }],\n defaultBaseUrlPreset: 'intl',\n defaultModel: 'step-3.7-flash',\n models: STEPFUN_MODELS,\n aliases: ['step', 'stepfun', 'jieyue', 'stepfun intl'],\n },\n {\n id: 'stepfun-cn',\n displayName: 'StepFun China',\n description: 'StepFun models through the China OpenAI-compatible API.',\n docsUrl: 'https://platform.stepfun.com/docs',\n apiKeyUrl: 'https://platform.stepfun.com/interface-key',\n envVars: ['STEPFUN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'cn', label: 'China', baseUrl: 'https://api.stepfun.com/v1' }],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'step-3.7-flash',\n models: STEPFUN_MODELS,\n aliases: ['step cn', 'stepfun cn', 'jieyue cn', '阶跃星辰'],\n },\n {\n id: 'stepfun-plan-intl',\n displayName: 'StepFun Step Plan International',\n description: 'StepFun Step Plan international coding/planning endpoint.',\n docsUrl: 'https://platform.stepfun.com/docs',\n apiKeyUrl: 'https://platform.stepfun.com/interface-key',\n envVars: ['STEPFUN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'plan-intl', label: 'Step Plan International', baseUrl: 'https://api.stepfun.ai/step_plan/v1' }],\n defaultBaseUrlPreset: 'plan-intl',\n defaultModel: 'step-3.7-flash',\n models: STEPFUN_MODELS,\n aliases: ['step plan', 'stepfun plan', 'stepfun plan intl'],\n },\n {\n id: 'stepfun-plan-cn',\n displayName: 'StepFun Step Plan China',\n description: 'StepFun Step Plan China coding/planning endpoint.',\n docsUrl: 'https://platform.stepfun.com/docs',\n apiKeyUrl: 'https://platform.stepfun.com/interface-key',\n envVars: ['STEPFUN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'plan-cn', label: 'Step Plan China', baseUrl: 'https://api.stepfun.com/step_plan/v1' }],\n defaultBaseUrlPreset: 'plan-cn',\n defaultModel: 'step-3.7-flash',\n models: STEPFUN_MODELS,\n aliases: ['step plan cn', 'stepfun plan cn', '阶跃 plan'],\n },\n {\n id: 'xiaomi',\n displayName: 'Xiaomi MiMo',\n description: 'Xiaomi MiMo API billing endpoint through OpenAI-compatible requests.',\n docsUrl: 'https://platform.xiaomimimo.com/',\n apiKeyUrl: 'https://platform.xiaomimimo.com/#/console/api-keys',\n pricingUrl: 'https://mimo.mi.com/',\n envVars: ['XIAOMI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'api', label: 'API billing', baseUrl: 'https://api.xiaomimimo.com/v1' }],\n defaultBaseUrlPreset: 'api',\n defaultModel: 'mimo-v2.5-pro',\n models: MIMO_MODELS,\n aliases: ['xiaomi', 'mimo', 'xiaomimimo'],\n quirks: ['Some MiMo plans document api-key style auth; keep auth header behavior configurable if needed.'],\n },\n {\n id: 'xiaomi-token-plan-cn',\n displayName: 'Xiaomi MiMo Token Plan China',\n description: 'Xiaomi MiMo Token Plan China endpoint.',\n docsUrl: 'https://platform.xiaomimimo.com/',\n apiKeyUrl: 'https://platform.xiaomimimo.com/#/console/api-keys',\n pricingUrl: 'https://mimo.mi.com/',\n envVars: ['XIAOMI_TOKEN_PLAN_CN_API_KEY', 'XIAOMI_TOKEN_PLAN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'cn', label: 'China', baseUrl: 'https://token-plan-cn.xiaomimimo.com/v1' }],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'mimo-v2.5-pro',\n models: MIMO_MODELS,\n aliases: ['xiaomi token plan cn', 'mimo token plan cn'],\n },\n {\n id: 'xiaomi-token-plan-ams',\n displayName: 'Xiaomi MiMo Token Plan Amsterdam',\n description: 'Xiaomi MiMo Token Plan Amsterdam endpoint.',\n docsUrl: 'https://platform.xiaomimimo.com/',\n apiKeyUrl: 'https://platform.xiaomimimo.com/#/console/api-keys',\n pricingUrl: 'https://mimo.mi.com/',\n envVars: ['XIAOMI_TOKEN_PLAN_AMS_API_KEY', 'XIAOMI_TOKEN_PLAN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'ams', label: 'Amsterdam', baseUrl: 'https://token-plan-ams.xiaomimimo.com/v1' }],\n defaultBaseUrlPreset: 'ams',\n defaultModel: 'mimo-v2.5-pro',\n models: MIMO_MODELS,\n aliases: ['xiaomi token plan ams', 'mimo token plan ams'],\n },\n {\n id: 'xiaomi-token-plan-sgp',\n displayName: 'Xiaomi MiMo Token Plan Singapore',\n description: 'Xiaomi MiMo Token Plan Singapore endpoint.',\n docsUrl: 'https://platform.xiaomimimo.com/',\n apiKeyUrl: 'https://platform.xiaomimimo.com/#/console/api-keys',\n pricingUrl: 'https://mimo.mi.com/',\n envVars: ['XIAOMI_TOKEN_PLAN_SGP_API_KEY', 'XIAOMI_TOKEN_PLAN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'sgp', label: 'Singapore', baseUrl: 'https://token-plan-sgp.xiaomimimo.com/v1' }],\n defaultBaseUrlPreset: 'sgp',\n defaultModel: 'mimo-v2.5-pro',\n models: MIMO_MODELS,\n aliases: ['xiaomi token plan sgp', 'mimo token plan sgp'],\n },\n {\n id: 'zhipu-cn',\n displayName: 'Zhipu GLM China',\n description: 'Zhipu GLM models through the BigModel OpenAI-compatible API.',\n docsUrl: 'https://docs.bigmodel.cn/cn/guide/start/model-overview',\n apiKeyUrl: 'https://bigmodel.cn/usercenter/proj-mgmt/apikeys',\n pricingUrl: 'https://bigmodel.cn/pricing',\n envVars: ['ZHIPU_API_KEY', 'BIGMODEL_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'cn', label: 'China', baseUrl: 'https://open.bigmodel.cn/api/paas/v4' }],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'glm-5.2',\n models: [\n { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 1000000, maxTokens: 65536, reasoning: true, input: ['text'] },\n ],\n aliases: ['zhipu', 'glm', 'bigmodel', 'zai cn'],\n },\n {\n id: 'zai',\n displayName: 'Zhipu GLM International',\n description: 'Zhipu GLM models through the z.ai OpenAI-compatible endpoint.',\n docsUrl: 'https://docs.z.ai/guides/overview/quick-start',\n apiKeyUrl: 'https://z.ai/manage-apikey/apikey-list',\n pricingUrl: 'https://z.ai/manage-apikey/billing',\n envVars: ['ZAI_API_KEY', 'Z_AI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'global', label: 'International', baseUrl: 'https://api.z.ai/api/paas/v4' }],\n defaultBaseUrlPreset: 'global',\n defaultModel: 'glm-5.2',\n models: [\n { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 1000000, maxTokens: 65536, reasoning: true, input: ['text'] },\n ],\n aliases: ['zai', 'z.ai', 'zhipu global', 'glm global'],\n },\n {\n id: 'zai-coding-global',\n displayName: 'Zhipu GLM Coding Plan International',\n description: 'Zhipu GLM coding-plan international endpoint.',\n docsUrl: 'https://docs.z.ai/guides/overview/quick-start',\n apiKeyUrl: 'https://z.ai/manage-apikey/apikey-list',\n pricingUrl: 'https://z.ai/manage-apikey/billing',\n envVars: ['ZAI_API_KEY', 'Z_AI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'coding-global', label: 'Coding Global', baseUrl: 'https://api.z.ai/api/coding/paas/v4' }],\n defaultBaseUrlPreset: 'coding-global',\n defaultModel: 'glm-5.2',\n models: [\n { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 1000000, maxTokens: 65536, reasoning: true, input: ['text'] },\n ],\n aliases: ['zai coding', 'zhipu coding global', 'glm coding global'],\n },\n {\n id: 'zhipu-coding-cn',\n displayName: 'Zhipu GLM Coding Plan China',\n description: 'Zhipu GLM coding-plan China endpoint.',\n docsUrl: 'https://docs.bigmodel.cn/cn/guide/start/model-overview',\n apiKeyUrl: 'https://bigmodel.cn/usercenter/proj-mgmt/apikeys',\n pricingUrl: 'https://bigmodel.cn/pricing',\n envVars: ['ZHIPU_API_KEY', 'BIGMODEL_API_KEY', 'ZAI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'coding-cn', label: 'Coding China', baseUrl: 'https://open.bigmodel.cn/api/coding/paas/v4' }],\n defaultBaseUrlPreset: 'coding-cn',\n defaultModel: 'glm-5.2',\n models: [\n { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 1000000, maxTokens: 65536, reasoning: true, input: ['text'] },\n ],\n aliases: ['zhipu coding', 'glm coding cn', '智谱 coding'],\n },\n {\n id: 'minimax',\n displayName: 'MiniMax',\n description: 'MiniMax text models. Anthropic-compatible endpoint is preferred for agent/tool workflows.',\n docsUrl: 'https://platform.minimax.io/docs',\n apiKeyUrl: 'https://platform.minimax.io/user-center/basic-information/interface-key',\n pricingUrl: 'https://platform.minimax.io/docs/guides/models-intro',\n envVars: ['MINIMAX_API_KEY'],\n api: 'anthropic-messages',\n authHeader: true,\n baseUrlPresets: [\n { id: 'intl-anthropic', label: 'International Anthropic-compatible', baseUrl: 'https://api.minimax.io/anthropic' },\n { id: 'intl-openai', label: 'International OpenAI-compatible', baseUrl: 'https://api.minimax.io/v1' },\n ],\n defaultBaseUrlPreset: 'intl-anthropic',\n defaultModel: 'MiniMax-M3',\n models: MINIMAX_MODELS,\n aliases: ['minimax', 'mini max', 'abab'],\n quirks: ['Switch API type to OpenAI-compatible if you select an /v1 endpoint.'],\n },\n {\n id: 'minimax-cn',\n displayName: 'MiniMax China',\n description: 'MiniMax China endpoint. Anthropic-compatible endpoint is preferred for agent/tool workflows.',\n docsUrl: 'https://platform.minimaxi.com/document',\n apiKeyUrl: 'https://platform.minimaxi.com/user-center/basic-information/interface-key',\n pricingUrl: 'https://platform.minimaxi.com/document/Price',\n envVars: ['MINIMAX_CN_API_KEY', 'MINIMAX_API_KEY'],\n api: 'anthropic-messages',\n authHeader: true,\n baseUrlPresets: [\n { id: 'cn-anthropic', label: 'China Anthropic-compatible', baseUrl: 'https://api.minimaxi.com/anthropic' },\n { id: 'cn-openai', label: 'China OpenAI-compatible', baseUrl: 'https://api.minimaxi.com/v1' },\n ],\n defaultBaseUrlPreset: 'cn-anthropic',\n defaultModel: 'MiniMax-M3',\n models: MINIMAX_MODELS,\n aliases: ['minimax cn', 'mini max cn', 'abab cn'],\n quirks: ['Switch API type to OpenAI-compatible if you select an /v1 endpoint.'],\n },\n] as const satisfies readonly DomesticProviderPreset[];\n\nconst PRESET_BY_ID = new Map<string, DomesticProviderPreset>(\n DOMESTIC_PROVIDER_PRESETS.map((preset) => [preset.id, preset]),\n);\n\nexport function getDomesticProviderPreset(id: string): DomesticProviderPreset | undefined {\n return PRESET_BY_ID.get(id);\n}\n\nexport function getDomesticProviderPresetIds(): string[] {\n return DOMESTIC_PROVIDER_PRESETS.map((preset) => preset.id);\n}\n\nexport function getDomesticProviderBaseUrl(preset: DomesticProviderPreset): string {\n return (\n preset.baseUrlPresets.find((entry) => entry.id === preset.defaultBaseUrlPreset)?.baseUrl ??\n preset.baseUrlPresets[0]?.baseUrl ??\n ''\n );\n}\n\nexport function providerConfigFromDomesticPreset(\n preset: DomesticProviderPreset,\n params: { apiKey?: string; baseUrl?: string; modelIds?: string[] } = {},\n): ProviderConfig {\n const ids = params.modelIds?.length ? params.modelIds : preset.models.map((model) => model.id);\n return {\n baseUrl: params.baseUrl ?? getDomesticProviderBaseUrl(preset),\n apiKey: params.apiKey,\n api: preset.api,\n ...(preset.authHeader === undefined ? {} : { authHeader: preset.authHeader }),\n ...(preset.headers ? { headers: preset.headers } : {}),\n models: ids.map((id) => {\n const model = preset.models.find((entry) => entry.id === id);\n return {\n id,\n name: model?.name ?? id,\n api: preset.api,\n ...(model?.contextWindow ? { contextWindow: model.contextWindow } : {}),\n ...(model?.maxTokens ? { maxTokens: model.maxTokens } : {}),\n ...(model?.reasoning ? { reasoning: model.reasoning } : {}),\n input: model?.input ?? ['text'],\n };\n }),\n };\n}\n"],"mappings":";AAqCA,MAAM,cAA6C;CACjD;EAAE,IAAI;EAAe,MAAM;EAAe,eAAe;EAAS,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC5F;EAAE,IAAI;EAAgB,MAAM;EAAgB,eAAe;EAAS,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC9F;EAAE,IAAI;EAAiB,MAAM;EAAiB,eAAe;EAAS,OAAO,CAAC,OAAO;EAAE;CACxF;AAED,MAAM,iBAAgD;CACpD;EAAE,IAAI;EAAkB,MAAM;EAAkB,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,QAAQ,QAAQ;EAAE;CACnH;EAAE,IAAI;EAAuB,MAAM;EAAuB,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC7H;EAAE,IAAI;EAAkB,MAAM;EAAkB,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,OAAO;EAAE;CAC3G;AAED,MAAM,cAA6C;CACjD;EAAE,IAAI;EAAiB,MAAM;EAAiB,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,OAAO;EAAE;CACxG;EAAE,IAAI;EAA4B,MAAM;EAA4B,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,OAAO;EAAE;CAC9H;EAAE,IAAI;EAAa,MAAM;EAAa,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC1G;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,GAAI,OAAO,YAAY,EAAE,WAAW,MAAM,WAAW,GAAG,EAAE;IAC1D,GAAI,OAAO,YAAY,EAAE,WAAW,MAAM,WAAW,GAAG,EAAE;IAC1D,OAAO,OAAO,SAAS,CAAC,OAAO;IAChC;IACD;EACH"}
|
|
1
|
+
{"version":3,"file":"domestic-presets.js","names":[],"sources":["../../../src/providers/domestic-presets.ts"],"sourcesContent":["import type { ProviderConfig } from '../config/models-json.js';\n\nexport interface DomesticProviderModelPreset {\n id: string;\n name?: string;\n contextWindow?: number;\n maxTokens?: number;\n reasoning?: boolean;\n input?: Array<'text' | 'image'>;\n}\n\nexport interface DomesticProviderBaseUrlPreset {\n id: string;\n label: string;\n baseUrl: string;\n description?: string;\n}\n\nexport interface DomesticProviderPreset {\n id: string;\n displayName: string;\n description: string;\n docsUrl: string;\n apiKeyUrl: string;\n pricingUrl?: string;\n envVars: string[];\n api: NonNullable<ProviderConfig['api']>;\n authHeader?: boolean;\n headers?: Record<string, string>;\n baseUrlPresets: DomesticProviderBaseUrlPreset[];\n defaultBaseUrlPreset: string;\n defaultModel: string;\n models: DomesticProviderModelPreset[];\n aliases: string[];\n quirks?: string[];\n}\n\nconst QWEN_MODELS: DomesticProviderModelPreset[] = [\n { id: 'qwen3.7-max', name: 'Qwen3.7 Max', contextWindow: 1000000, input: ['text', 'image'] },\n { id: 'qwen3.7-plus', name: 'Qwen3.7 Plus', contextWindow: 1000000, input: ['text', 'image'] },\n { id: 'qwen3.6-flash', name: 'Qwen3.6 Flash', contextWindow: 1000000, input: ['text'] },\n];\n\nconst STEPFUN_MODELS: DomesticProviderModelPreset[] = [\n { id: 'step-3.7-flash', name: 'Step 3.7 Flash', contextWindow: 1000000, reasoning: true, input: ['text', 'image'] },\n { id: 'step-3.5-flash-2603', name: 'Step 3.5 Flash 2603', contextWindow: 1000000, reasoning: true, input: ['text', 'image'] },\n { id: 'step-3.5-flash', name: 'Step 3.5 Flash', contextWindow: 1000000, reasoning: true, input: ['text'] },\n];\n\nconst MIMO_MODELS: DomesticProviderModelPreset[] = [\n { id: 'mimo-v2.5-pro', name: 'MiMo V2.5 Pro', contextWindow: 1000000, reasoning: true, input: ['text'] },\n { id: 'mimo-v2.5-pro-ultraspeed', name: 'MiMo V2.5 Pro UltraSpeed', contextWindow: 1000000, reasoning: true, input: ['text'] },\n { id: 'mimo-v2.5', name: 'MiMo V2.5', contextWindow: 1000000, reasoning: true, input: ['text', 'image'] },\n];\n\nconst MINIMAX_MODELS: DomesticProviderModelPreset[] = [\n { id: 'MiniMax-M3', name: 'MiniMax M3', contextWindow: 1000000, reasoning: true, input: ['text', 'image'] },\n { id: 'MiniMax-M2.7-highspeed', name: 'MiniMax M2.7 Highspeed', contextWindow: 204800, input: ['text'] },\n { id: 'MiniMax-M2.7', name: 'MiniMax M2.7', contextWindow: 204800, input: ['text'] },\n];\n\nexport const DOMESTIC_PROVIDER_PRESETS = [\n {\n id: 'dashscope-cn',\n displayName: 'Alibaba Bailian / DashScope China',\n description: 'Alibaba Bailian Qwen models through the China DashScope OpenAI-compatible endpoint.',\n docsUrl: 'https://help.aliyun.com/zh/model-studio/developer-reference/compatibility-of-openai-with-dashscope',\n apiKeyUrl: 'https://dashscope.console.aliyun.com/apiKey',\n pricingUrl: 'https://help.aliyun.com/zh/model-studio/developer-reference/tongyi-thousand-questions-metering-and-billing',\n envVars: ['DASHSCOPE_API_KEY', 'QWEN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n {\n id: 'cn',\n label: 'China',\n baseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',\n },\n ],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'qwen3.7-plus',\n models: QWEN_MODELS,\n aliases: ['qwen', 'tongyi', 'aliyun', 'bailian', 'dashscope', 'dashscope cn', '阿里百炼'],\n quirks: ['Some Qwen coding endpoints use different hosts; keep the Base URL editable.'],\n },\n {\n id: 'dashscope-intl',\n displayName: 'Alibaba Bailian / DashScope International',\n description: 'Alibaba Bailian Qwen models through the international DashScope OpenAI-compatible endpoint.',\n docsUrl: 'https://www.alibabacloud.com/help/en/model-studio/compatibility-of-openai-with-dashscope',\n apiKeyUrl: 'https://modelstudio.console.alibabacloud.com/',\n pricingUrl: 'https://www.alibabacloud.com/help/en/model-studio/billing-for-tongyi-qianwen',\n envVars: ['DASHSCOPE_API_KEY', 'QWEN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n {\n id: 'intl',\n label: 'International',\n baseUrl: 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1',\n },\n ],\n defaultBaseUrlPreset: 'intl',\n defaultModel: 'qwen3.7-plus',\n models: QWEN_MODELS,\n aliases: ['qwen intl', 'tongyi intl', 'alibaba cloud', 'dashscope intl'],\n quirks: ['Use an international DashScope key for the international endpoint.'],\n },\n {\n id: 'volcengine-ark',\n displayName: 'Volcengine Ark',\n description: 'Volcengine Ark models through the OpenAI-compatible API.',\n docsUrl: 'https://www.volcengine.com/docs/82379/1302008',\n apiKeyUrl: 'https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey',\n envVars: ['ARK_API_KEY', 'VOLCENGINE_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n {\n id: 'cn-beijing',\n label: 'China Beijing',\n baseUrl: 'https://ark.cn-beijing.volces.com/api/v3',\n description: 'Model IDs are usually Ark endpoint IDs.',\n },\n ],\n defaultBaseUrlPreset: 'cn-beijing',\n defaultModel: 'ep-your-endpoint-id',\n models: [{ id: 'ep-your-endpoint-id', name: 'Ark endpoint ID', contextWindow: 128000, input: ['text'] }],\n aliases: ['doubao', 'ark', 'volcengine', 'volces', 'bytedance'],\n quirks: ['Use the Ark endpoint id as the model id.'],\n },\n {\n id: 'volcengine-plan',\n displayName: 'Volcengine Doubao Coding Plan',\n description: 'Doubao coding-plan models through Volcengine Ark coding endpoint.',\n docsUrl: 'https://www.volcengine.com/docs/82379/1302008',\n apiKeyUrl: 'https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey',\n envVars: ['ARK_API_KEY', 'VOLCENGINE_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n { id: 'cn-beijing-coding', label: 'China Beijing Coding Plan', baseUrl: 'https://ark.cn-beijing.volces.com/api/coding/v3' },\n ],\n defaultBaseUrlPreset: 'cn-beijing-coding',\n defaultModel: 'ark-code-latest',\n models: [\n { id: 'ark-code-latest', name: 'Ark Coding Plan', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-code', name: 'Doubao Seed 2.0 Code', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-pro', name: 'Doubao Seed 2.0 Pro', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-lite', name: 'Doubao Seed 2.0 Lite', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n ],\n aliases: ['doubao coding', 'volcengine plan', 'ark coding plan', '火山方舟 coding'],\n },\n {\n id: 'byteplus-plan',\n displayName: 'BytePlus Doubao Coding Plan',\n description: 'Doubao coding-plan models through the BytePlus international coding endpoint.',\n docsUrl: 'https://docs.byteplus.com/en/docs/ModelArk/OpenAI',\n apiKeyUrl: 'https://console.byteplus.com/ark/region:ark+ap-southeast-1/apiKey',\n envVars: ['BYTEPLUS_API_KEY', 'ARK_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [\n { id: 'ap-southeast-coding', label: 'Asia Pacific Coding Plan', baseUrl: 'https://ark.ap-southeast.bytepluses.com/api/coding/v3' },\n ],\n defaultBaseUrlPreset: 'ap-southeast-coding',\n defaultModel: 'ark-code-latest',\n models: [\n { id: 'ark-code-latest', name: 'Ark Coding Plan', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-code', name: 'Doubao Seed 2.0 Code', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-pro', name: 'Doubao Seed 2.0 Pro', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n { id: 'doubao-seed-2.0-lite', name: 'Doubao Seed 2.0 Lite', contextWindow: 256000, maxTokens: 4096, input: ['text'] },\n ],\n aliases: ['byteplus', 'byteplus plan', 'doubao coding international'],\n },\n {\n id: 'deepseek',\n displayName: 'DeepSeek',\n description: 'DeepSeek models through the OpenAI-compatible API.',\n docsUrl: 'https://api-docs.deepseek.com/',\n apiKeyUrl: 'https://platform.deepseek.com/api_keys',\n pricingUrl: 'https://api-docs.deepseek.com/quick_start/pricing',\n envVars: ['DEEPSEEK_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'default', label: 'Default', baseUrl: 'https://api.deepseek.com' }],\n defaultBaseUrlPreset: 'default',\n defaultModel: 'deepseek-v4-pro',\n models: [\n { id: 'deepseek-v4-pro', name: 'DeepSeek V4 Pro', contextWindow: 1000000, maxTokens: 393216, reasoning: true, input: ['text'] },\n { id: 'deepseek-v4-flash', name: 'DeepSeek V4 Flash', contextWindow: 1000000, maxTokens: 393216, reasoning: true, input: ['text'] },\n ],\n aliases: ['deep seek', 'deepseek', 'r1'],\n quirks: ['Prefer current catalog models; older chat/reasoner aliases may be deprecated by the provider.'],\n },\n {\n id: 'moonshotai-cn',\n displayName: 'Kimi / Moonshot China',\n description: 'Kimi models through the Moonshot China OpenAI-compatible endpoint.',\n docsUrl: 'https://platform.moonshot.cn/docs',\n apiKeyUrl: 'https://platform.moonshot.cn/console/api-keys',\n pricingUrl: 'https://platform.moonshot.cn/docs/pricing/chat',\n envVars: ['MOONSHOT_API_KEY', 'KIMI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'cn', label: 'China', baseUrl: 'https://api.moonshot.cn/v1' }],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'kimi-k2.7-code',\n models: [\n { id: 'kimi-k2.7-code', name: 'Kimi K2.7 Code', contextWindow: 262144, maxTokens: 32768, reasoning: true, input: ['text', 'image'] },\n { id: 'kimi-k2.6', name: 'Kimi K2.6', contextWindow: 128000, input: ['text'] },\n ],\n aliases: ['kimi', 'moonshot', 'moonshot cn'],\n quirks: ['Provider-specific thinking and tool-call stream fields may need compatibility handling.'],\n },\n {\n id: 'moonshotai',\n displayName: 'Kimi / Moonshot International',\n description: 'Kimi models through the Moonshot international OpenAI-compatible endpoint.',\n docsUrl: 'https://platform.moonshot.ai/docs',\n apiKeyUrl: 'https://platform.moonshot.ai/console/api-keys',\n pricingUrl: 'https://platform.moonshot.ai/docs/pricing',\n envVars: ['MOONSHOT_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'intl', label: 'International', baseUrl: 'https://api.moonshot.ai/v1' }],\n defaultBaseUrlPreset: 'intl',\n defaultModel: 'kimi-k2.7-code',\n models: [\n { id: 'kimi-k2.7-code', name: 'Kimi K2.7 Code', contextWindow: 262144, maxTokens: 32768, reasoning: true, input: ['text', 'image'] },\n { id: 'kimi-k2.6', name: 'Kimi K2.6', contextWindow: 128000, input: ['text'] },\n ],\n aliases: ['kimi intl', 'moonshot intl', 'moonshot ai'],\n quirks: ['Provider-specific thinking and tool-call stream fields may need compatibility handling.'],\n },\n {\n id: 'kimi-coding',\n displayName: 'Kimi Coding',\n description: 'Kimi dedicated coding endpoint with Anthropic-compatible requests.',\n docsUrl: 'https://platform.kimi.com/docs',\n apiKeyUrl: 'https://platform.kimi.com/console/api-keys',\n pricingUrl: 'https://platform.kimi.com/docs/pricing/chat',\n envVars: ['KIMI_API_KEY', 'MOONSHOT_API_KEY'],\n api: 'anthropic-messages',\n headers: { 'User-Agent': 'KimiCLI/1.5' },\n baseUrlPresets: [{ id: 'coding', label: 'Coding endpoint', baseUrl: 'https://api.kimi.com/coding' }],\n defaultBaseUrlPreset: 'coding',\n defaultModel: 'k2p7',\n models: [\n { id: 'k2p7', name: 'Kimi K2.7 Code', contextWindow: 262144, maxTokens: 32768, reasoning: true, input: ['text', 'image'] },\n { id: 'kimi-for-coding', name: 'Kimi For Coding', contextWindow: 262144, maxTokens: 32768, reasoning: true, input: ['text', 'image'] },\n ],\n aliases: ['kimi coding', 'kimi code', 'moonshot coding'],\n },\n {\n id: 'stepfun-intl',\n displayName: 'StepFun International',\n description: 'StepFun models through the international OpenAI-compatible API.',\n docsUrl: 'https://platform.stepfun.com/docs',\n apiKeyUrl: 'https://platform.stepfun.com/interface-key',\n envVars: ['STEPFUN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'intl', label: 'International', baseUrl: 'https://api.stepfun.ai/v1' }],\n defaultBaseUrlPreset: 'intl',\n defaultModel: 'step-3.7-flash',\n models: STEPFUN_MODELS,\n aliases: ['step', 'stepfun', 'jieyue', 'stepfun intl'],\n },\n {\n id: 'stepfun-cn',\n displayName: 'StepFun China',\n description: 'StepFun models through the China OpenAI-compatible API.',\n docsUrl: 'https://platform.stepfun.com/docs',\n apiKeyUrl: 'https://platform.stepfun.com/interface-key',\n envVars: ['STEPFUN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'cn', label: 'China', baseUrl: 'https://api.stepfun.com/v1' }],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'step-3.7-flash',\n models: STEPFUN_MODELS,\n aliases: ['step cn', 'stepfun cn', 'jieyue cn', '阶跃星辰'],\n },\n {\n id: 'stepfun-plan-intl',\n displayName: 'StepFun Step Plan International',\n description: 'StepFun Step Plan international coding/planning endpoint.',\n docsUrl: 'https://platform.stepfun.com/docs',\n apiKeyUrl: 'https://platform.stepfun.com/interface-key',\n envVars: ['STEPFUN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'plan-intl', label: 'Step Plan International', baseUrl: 'https://api.stepfun.ai/step_plan/v1' }],\n defaultBaseUrlPreset: 'plan-intl',\n defaultModel: 'step-3.7-flash',\n models: STEPFUN_MODELS,\n aliases: ['step plan', 'stepfun plan', 'stepfun plan intl'],\n },\n {\n id: 'stepfun-plan-cn',\n displayName: 'StepFun Step Plan China',\n description: 'StepFun Step Plan China coding/planning endpoint.',\n docsUrl: 'https://platform.stepfun.com/docs',\n apiKeyUrl: 'https://platform.stepfun.com/interface-key',\n envVars: ['STEPFUN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'plan-cn', label: 'Step Plan China', baseUrl: 'https://api.stepfun.com/step_plan/v1' }],\n defaultBaseUrlPreset: 'plan-cn',\n defaultModel: 'step-3.7-flash',\n models: STEPFUN_MODELS,\n aliases: ['step plan cn', 'stepfun plan cn', '阶跃 plan'],\n },\n {\n id: 'xiaomi',\n displayName: 'Xiaomi MiMo',\n description: 'Xiaomi MiMo API billing endpoint through OpenAI-compatible requests.',\n docsUrl: 'https://platform.xiaomimimo.com/',\n apiKeyUrl: 'https://platform.xiaomimimo.com/#/console/api-keys',\n pricingUrl: 'https://mimo.mi.com/',\n envVars: ['XIAOMI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'api', label: 'API billing', baseUrl: 'https://api.xiaomimimo.com/v1' }],\n defaultBaseUrlPreset: 'api',\n defaultModel: 'mimo-v2.5-pro',\n models: MIMO_MODELS,\n aliases: ['xiaomi', 'mimo', 'xiaomimimo'],\n quirks: ['Some MiMo plans document api-key style auth; keep auth header behavior configurable if needed.'],\n },\n {\n id: 'xiaomi-token-plan-cn',\n displayName: 'Xiaomi MiMo Token Plan China',\n description: 'Xiaomi MiMo Token Plan China endpoint.',\n docsUrl: 'https://platform.xiaomimimo.com/',\n apiKeyUrl: 'https://platform.xiaomimimo.com/#/console/api-keys',\n pricingUrl: 'https://mimo.mi.com/',\n envVars: ['XIAOMI_TOKEN_PLAN_CN_API_KEY', 'XIAOMI_TOKEN_PLAN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'cn', label: 'China', baseUrl: 'https://token-plan-cn.xiaomimimo.com/v1' }],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'mimo-v2.5-pro',\n models: MIMO_MODELS,\n aliases: ['xiaomi token plan cn', 'mimo token plan cn'],\n },\n {\n id: 'xiaomi-token-plan-ams',\n displayName: 'Xiaomi MiMo Token Plan Amsterdam',\n description: 'Xiaomi MiMo Token Plan Amsterdam endpoint.',\n docsUrl: 'https://platform.xiaomimimo.com/',\n apiKeyUrl: 'https://platform.xiaomimimo.com/#/console/api-keys',\n pricingUrl: 'https://mimo.mi.com/',\n envVars: ['XIAOMI_TOKEN_PLAN_AMS_API_KEY', 'XIAOMI_TOKEN_PLAN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'ams', label: 'Amsterdam', baseUrl: 'https://token-plan-ams.xiaomimimo.com/v1' }],\n defaultBaseUrlPreset: 'ams',\n defaultModel: 'mimo-v2.5-pro',\n models: MIMO_MODELS,\n aliases: ['xiaomi token plan ams', 'mimo token plan ams'],\n },\n {\n id: 'xiaomi-token-plan-sgp',\n displayName: 'Xiaomi MiMo Token Plan Singapore',\n description: 'Xiaomi MiMo Token Plan Singapore endpoint.',\n docsUrl: 'https://platform.xiaomimimo.com/',\n apiKeyUrl: 'https://platform.xiaomimimo.com/#/console/api-keys',\n pricingUrl: 'https://mimo.mi.com/',\n envVars: ['XIAOMI_TOKEN_PLAN_SGP_API_KEY', 'XIAOMI_TOKEN_PLAN_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'sgp', label: 'Singapore', baseUrl: 'https://token-plan-sgp.xiaomimimo.com/v1' }],\n defaultBaseUrlPreset: 'sgp',\n defaultModel: 'mimo-v2.5-pro',\n models: MIMO_MODELS,\n aliases: ['xiaomi token plan sgp', 'mimo token plan sgp'],\n },\n {\n id: 'zhipu-cn',\n displayName: 'Zhipu GLM China',\n description: 'Zhipu GLM models through the BigModel OpenAI-compatible API.',\n docsUrl: 'https://docs.bigmodel.cn/cn/guide/start/model-overview',\n apiKeyUrl: 'https://bigmodel.cn/usercenter/proj-mgmt/apikeys',\n pricingUrl: 'https://bigmodel.cn/pricing',\n envVars: ['ZHIPU_API_KEY', 'BIGMODEL_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'cn', label: 'China', baseUrl: 'https://open.bigmodel.cn/api/paas/v4' }],\n defaultBaseUrlPreset: 'cn',\n defaultModel: 'glm-5.2',\n models: [\n { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 1000000, maxTokens: 65536, reasoning: true, input: ['text'] },\n ],\n aliases: ['zhipu', 'glm', 'bigmodel', 'zai cn'],\n },\n {\n id: 'zai',\n displayName: 'Zhipu GLM International',\n description: 'Zhipu GLM models through the z.ai OpenAI-compatible endpoint.',\n docsUrl: 'https://docs.z.ai/guides/overview/quick-start',\n apiKeyUrl: 'https://z.ai/manage-apikey/apikey-list',\n pricingUrl: 'https://z.ai/manage-apikey/billing',\n envVars: ['ZAI_API_KEY', 'Z_AI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'global', label: 'International', baseUrl: 'https://api.z.ai/api/paas/v4' }],\n defaultBaseUrlPreset: 'global',\n defaultModel: 'glm-5.2',\n models: [\n { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 1000000, maxTokens: 65536, reasoning: true, input: ['text'] },\n ],\n aliases: ['zai', 'z.ai', 'zhipu global', 'glm global'],\n },\n {\n id: 'zai-coding-global',\n displayName: 'Zhipu GLM Coding Plan International',\n description: 'Zhipu GLM coding-plan international endpoint.',\n docsUrl: 'https://docs.z.ai/guides/overview/quick-start',\n apiKeyUrl: 'https://z.ai/manage-apikey/apikey-list',\n pricingUrl: 'https://z.ai/manage-apikey/billing',\n envVars: ['ZAI_API_KEY', 'Z_AI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'coding-global', label: 'Coding Global', baseUrl: 'https://api.z.ai/api/coding/paas/v4' }],\n defaultBaseUrlPreset: 'coding-global',\n defaultModel: 'glm-5.2',\n models: [\n { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 1000000, maxTokens: 65536, reasoning: true, input: ['text'] },\n ],\n aliases: ['zai coding', 'zhipu coding global', 'glm coding global'],\n },\n {\n id: 'zhipu-coding-cn',\n displayName: 'Zhipu GLM Coding Plan China',\n description: 'Zhipu GLM coding-plan China endpoint.',\n docsUrl: 'https://docs.bigmodel.cn/cn/guide/start/model-overview',\n apiKeyUrl: 'https://bigmodel.cn/usercenter/proj-mgmt/apikeys',\n pricingUrl: 'https://bigmodel.cn/pricing',\n envVars: ['ZHIPU_API_KEY', 'BIGMODEL_API_KEY', 'ZAI_API_KEY'],\n api: 'openai-completions',\n baseUrlPresets: [{ id: 'coding-cn', label: 'Coding China', baseUrl: 'https://open.bigmodel.cn/api/coding/paas/v4' }],\n defaultBaseUrlPreset: 'coding-cn',\n defaultModel: 'glm-5.2',\n models: [\n { id: 'glm-5.2', name: 'GLM 5.2', contextWindow: 1000000, maxTokens: 65536, reasoning: true, input: ['text'] },\n ],\n aliases: ['zhipu coding', 'glm coding cn', '智谱 coding'],\n },\n {\n id: 'minimax',\n displayName: 'MiniMax',\n description: 'MiniMax text models. Anthropic-compatible endpoint is preferred for agent/tool workflows.',\n docsUrl: 'https://platform.minimax.io/docs',\n apiKeyUrl: 'https://platform.minimax.io/user-center/basic-information/interface-key',\n pricingUrl: 'https://platform.minimax.io/docs/guides/models-intro',\n envVars: ['MINIMAX_API_KEY'],\n api: 'anthropic-messages',\n authHeader: true,\n baseUrlPresets: [\n { id: 'intl-anthropic', label: 'International Anthropic-compatible', baseUrl: 'https://api.minimax.io/anthropic' },\n { id: 'intl-openai', label: 'International OpenAI-compatible', baseUrl: 'https://api.minimax.io/v1' },\n ],\n defaultBaseUrlPreset: 'intl-anthropic',\n defaultModel: 'MiniMax-M3',\n models: MINIMAX_MODELS,\n aliases: ['minimax', 'mini max', 'abab'],\n quirks: ['Switch API type to OpenAI-compatible if you select an /v1 endpoint.'],\n },\n {\n id: 'minimax-cn',\n displayName: 'MiniMax China',\n description: 'MiniMax China endpoint. Anthropic-compatible endpoint is preferred for agent/tool workflows.',\n docsUrl: 'https://platform.minimaxi.com/document',\n apiKeyUrl: 'https://platform.minimaxi.com/user-center/basic-information/interface-key',\n pricingUrl: 'https://platform.minimaxi.com/document/Price',\n envVars: ['MINIMAX_CN_API_KEY', 'MINIMAX_API_KEY'],\n api: 'anthropic-messages',\n authHeader: true,\n baseUrlPresets: [\n { id: 'cn-anthropic', label: 'China Anthropic-compatible', baseUrl: 'https://api.minimaxi.com/anthropic' },\n { id: 'cn-openai', label: 'China OpenAI-compatible', baseUrl: 'https://api.minimaxi.com/v1' },\n ],\n defaultBaseUrlPreset: 'cn-anthropic',\n defaultModel: 'MiniMax-M3',\n models: MINIMAX_MODELS,\n aliases: ['minimax cn', 'mini max cn', 'abab cn'],\n quirks: ['Switch API type to OpenAI-compatible if you select an /v1 endpoint.'],\n },\n] as const satisfies readonly DomesticProviderPreset[];\n\nconst PRESET_BY_ID = new Map<string, DomesticProviderPreset>(\n DOMESTIC_PROVIDER_PRESETS.map((preset) => [preset.id, preset]),\n);\n\nexport function getDomesticProviderPreset(id: string): DomesticProviderPreset | undefined {\n return PRESET_BY_ID.get(id);\n}\n\nexport function getDomesticProviderPresetIds(): string[] {\n return DOMESTIC_PROVIDER_PRESETS.map((preset) => preset.id);\n}\n\nexport function getDomesticProviderBaseUrl(preset: DomesticProviderPreset): string {\n return (\n preset.baseUrlPresets.find((entry) => entry.id === preset.defaultBaseUrlPreset)?.baseUrl ??\n preset.baseUrlPresets[0]?.baseUrl ??\n ''\n );\n}\n\nexport function providerConfigFromDomesticPreset(\n preset: DomesticProviderPreset,\n params: { apiKey?: string; baseUrl?: string; modelIds?: string[] } = {},\n): ProviderConfig {\n const ids = params.modelIds?.length ? params.modelIds : preset.models.map((model) => model.id);\n return {\n baseUrl: params.baseUrl ?? getDomesticProviderBaseUrl(preset),\n apiKey: params.apiKey,\n api: preset.api,\n ...(preset.authHeader === undefined ? {} : { authHeader: preset.authHeader }),\n ...(preset.headers ? { headers: preset.headers } : {}),\n models: ids.map((id) => {\n const model = preset.models.find((entry) => entry.id === id);\n return {\n id,\n name: model?.name ?? id,\n api: preset.api,\n ...(model?.contextWindow ? { contextWindow: model.contextWindow } : {}),\n ...(model?.maxTokens ? { maxTokens: model.maxTokens } : {}),\n ...(model?.reasoning ? { reasoning: model.reasoning } : {}),\n input: model?.input ?? ['text'],\n };\n }),\n };\n}\n"],"mappings":";AAqCA,MAAM,cAA6C;CACjD;EAAE,IAAI;EAAe,MAAM;EAAe,eAAe;EAAS,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC5F;EAAE,IAAI;EAAgB,MAAM;EAAgB,eAAe;EAAS,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC9F;EAAE,IAAI;EAAiB,MAAM;EAAiB,eAAe;EAAS,OAAO,CAAC,OAAO;EAAE;CACxF;AAED,MAAM,iBAAgD;CACpD;EAAE,IAAI;EAAkB,MAAM;EAAkB,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,QAAQ,QAAQ;EAAE;CACnH;EAAE,IAAI;EAAuB,MAAM;EAAuB,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC7H;EAAE,IAAI;EAAkB,MAAM;EAAkB,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,OAAO;EAAE;CAC3G;AAED,MAAM,cAA6C;CACjD;EAAE,IAAI;EAAiB,MAAM;EAAiB,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,OAAO;EAAE;CACxG;EAAE,IAAI;EAA4B,MAAM;EAA4B,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,OAAO;EAAE;CAC9H;EAAE,IAAI;EAAa,MAAM;EAAa,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC1G;AAED,MAAM,iBAAgD;CACpD;EAAE,IAAI;EAAc,MAAM;EAAc,eAAe;EAAS,WAAW;EAAM,OAAO,CAAC,QAAQ,QAAQ;EAAE;CAC3G;EAAE,IAAI;EAA0B,MAAM;EAA0B,eAAe;EAAQ,OAAO,CAAC,OAAO;EAAE;CACxG;EAAE,IAAI;EAAgB,MAAM;EAAgB,eA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AAI,OAAO,CAAC,CAC/D;AAED,SAAgB,0BAA0B,IAAgD;AACxF,QAAO,aAAa,IAAI,GAAG;;AAG7B,SAAgB,+BAAyC;AACvD,QAAO,0BAA0B,KAAK,WAAW,OAAO,GAAG;;AAG7D,SAAgB,2BAA2B,QAAwC;AACjF,QACE,OAAO,eAAe,MAAM,UAAU,MAAM,OAAO,OAAO,qBAAqB,EAAE,WACjF,OAAO,eAAe,IAAI,WAC1B;;AAIJ,SAAgB,iCACd,QACA,SAAqE,EAAE,EACvD;CAChB,MAAM,MAAM,OAAO,UAAU,SAAS,OAAO,WAAW,OAAO,OAAO,KAAK,UAAU,MAAM,GAAG;AAC9F,QAAO;EACL,SAAS,OAAO,WAAW,2BAA2B,OAAO;EAC7D,QAAQ,OAAO;EACf,KAAK,OAAO;EACZ,GAAI,OAAO,eAAe,KAAA,IAAY,EAAE,GAAG,EAAE,YAAY,OAAO,YAAY;EAC5E,GAAI,OAAO,UAAU,EAAE,SAAS,OAAO,SAAS,GAAG,EAAE;EACrD,QAAQ,IAAI,KAAK,OAAO;GACtB,MAAM,QAAQ,OAAO,OAAO,MAAM,UAAU,MAAM,OAAO,GAAG;AAC5D,UAAO;IACL;IACA,MAAM,OAAO,QAAQ;IACrB,KAAK,OAAO;IACZ,GAAI,OAAO,gBAAgB,EAAE,eAAe,MAAM,eAAe,GAAG,EAAE;IACtE,GAAI,OAAO,YAAY,EAAE,WAAW,MAAM,WAAW,GAAG,EAAE;IAC1D,GAAI,OAAO,YAAY,EAAE,WAAW,MAAM,WAAW,GAAG,EAAE;IAC1D,OAAO,OAAO,SAAS,CAAC,OAAO;IAChC;IACD;EACH"}
|
|
@@ -4,6 +4,7 @@ import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync
|
|
|
4
4
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
5
5
|
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
6
6
|
import { CredentialResolver, hasCredentials, init_credentials, resolveApiKey } from "../auth/credentials.js";
|
|
7
|
+
import { getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
7
8
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
8
9
|
import { getModel, getModels, getProviders } from "@earendil-works/pi-ai/compat";
|
|
9
10
|
//#region src/providers/index.ts
|
|
@@ -91,6 +92,8 @@ function resolveModel(ref) {
|
|
|
91
92
|
const [provider, modelId] = trimmedRef.split("/");
|
|
92
93
|
const piAiModel = getModel(provider, modelId);
|
|
93
94
|
if (piAiModel) return normalizeProviderModel(piAiModel);
|
|
95
|
+
const supplementalModel = getSupplementalModels().find((m) => m.provider === provider && m.id === modelId);
|
|
96
|
+
if (supplementalModel) return normalizeProviderModel(supplementalModel);
|
|
94
97
|
const plugin = getProviderRegistry().get(provider);
|
|
95
98
|
if (plugin) {
|
|
96
99
|
const pluginModel = plugin.models.find((m) => m.id === modelId);
|
|
@@ -104,6 +107,8 @@ function resolveModel(ref) {
|
|
|
104
107
|
} catch {
|
|
105
108
|
continue;
|
|
106
109
|
}
|
|
110
|
+
const supplementalModel = getSupplementalModels().find((m) => m.id === trimmedRef);
|
|
111
|
+
if (supplementalModel) return normalizeProviderModel(supplementalModel);
|
|
107
112
|
const pluginRegistry = getProviderRegistry();
|
|
108
113
|
for (const plugin of pluginRegistry.listAll()) {
|
|
109
114
|
const found = plugin.models.find((m) => m.id === trimmedRef);
|
|
@@ -113,10 +118,16 @@ function resolveModel(ref) {
|
|
|
113
118
|
}
|
|
114
119
|
function getModelsByProvider(provider) {
|
|
115
120
|
const fromRegistry = getModelRegistry().getAll().filter((m) => m.provider === provider).map(normalizeProviderModel);
|
|
121
|
+
const existingIds = new Set(fromRegistry.map((m) => m.id));
|
|
122
|
+
const supplementalModels = getSupplementalModels().filter((m) => m.provider === provider && !existingIds.has(m.id)).map(normalizeProviderModel);
|
|
116
123
|
const plugin = getProviderRegistry().get(provider);
|
|
117
|
-
if (!plugin) return fromRegistry;
|
|
124
|
+
if (!plugin) return [...fromRegistry, ...supplementalModels];
|
|
118
125
|
const pluginModels = plugin.models.map((m) => pluginModelToModel(provider, m));
|
|
119
|
-
return [
|
|
126
|
+
return [
|
|
127
|
+
...fromRegistry,
|
|
128
|
+
...supplementalModels,
|
|
129
|
+
...pluginModels
|
|
130
|
+
];
|
|
120
131
|
}
|
|
121
132
|
function getAllProviders() {
|
|
122
133
|
const registry = getModelRegistry();
|
|
@@ -202,10 +213,12 @@ async function getConfiguredProviders() {
|
|
|
202
213
|
}
|
|
203
214
|
function getAllModels() {
|
|
204
215
|
const registryModels = getModelRegistry().getAll().map(normalizeProviderModel);
|
|
205
|
-
const pluginProviders = getProviderRegistry().listAll();
|
|
206
|
-
if (pluginProviders.length === 0) return registryModels;
|
|
207
216
|
const existingIds = new Set(registryModels.map((m) => `${m.provider}/${m.id}`));
|
|
208
|
-
const
|
|
217
|
+
const supplementalModels = getSupplementalModels().filter((m) => !existingIds.has(`${m.provider}/${m.id}`)).map(normalizeProviderModel);
|
|
218
|
+
for (const model of supplementalModels) existingIds.add(`${model.provider}/${model.id}`);
|
|
219
|
+
const pluginProviders = getProviderRegistry().listAll();
|
|
220
|
+
if (pluginProviders.length === 0) return [...registryModels, ...supplementalModels];
|
|
221
|
+
const merged = [...registryModels, ...supplementalModels];
|
|
209
222
|
for (const plugin of pluginProviders) for (const model of plugin.models) {
|
|
210
223
|
const compositeId = `${plugin.id}/${model.id}`;
|
|
211
224
|
if (!existingIds.has(compositeId)) {
|
|
@@ -297,6 +310,7 @@ var init_providers = __esmMin((() => {
|
|
|
297
310
|
init_credentials();
|
|
298
311
|
init_sync_provider_auth();
|
|
299
312
|
init_env_keys();
|
|
313
|
+
init_model_supplements();
|
|
300
314
|
init_plugin_registry();
|
|
301
315
|
EXTENSION_PROVIDER_BASE_URL = "extension://provider-plugin";
|
|
302
316
|
OPENAI_CODEX_CANONICAL_BASE_URL = "https://chatgpt.com/backend-api/codex";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getPiAiModel","getPiAiProviders","getPiAiModels"],"sources":["../../../src/providers/index.ts"],"sourcesContent":["/**\n * Model provider module - integrates built-in models with custom models from models.json\n */\n\nimport {\n\tgetModel as getPiAiModel,\n\tgetModels as getPiAiModels,\n\tgetProviders as getPiAiProviders,\n\ttype Model,\n\ttype Api,\n} from '@earendil-works/pi-ai/compat';\nimport { getAgentDefaultModelRef, type Config } from '../config/schema.js';\nimport { getModelRegistry } from './model-registry.js';\nimport { CredentialResolver, resolveApiKey, hasCredentials } from '../auth/credentials.js';\nimport { hasProviderAuthOnDiskSync } from '../auth/sync-provider-auth.js';\nimport { getApiKeyFromEnv } from './env-keys.js';\nimport { getProviderRegistry } from './plugin-registry.js';\nimport type { ProviderModelDefinition } from '../extensions/types/providers.js';\n\nexport { getApiKeyFromEnv, PROVIDER_ENV_MAP } from './env-keys.js';\n\n/** Sentinel base URL: model is served by an extension {@link ProviderPluginRegistry} provider. */\nexport const EXTENSION_PROVIDER_BASE_URL = 'extension://provider-plugin';\nconst OPENAI_CODEX_CANONICAL_BASE_URL = 'https://chatgpt.com/backend-api/codex';\n\nfunction normalizeProviderModel(model: Model<Api>): Model<Api> {\n\tif (model.provider === 'openai-codex' && model.api === 'openai-codex-responses') {\n\t\treturn { ...model, baseUrl: OPENAI_CODEX_CANONICAL_BASE_URL } as Model<Api>;\n\t}\n\treturn model;\n}\n\n/** Map a plugin registry model to the pi-ai {@link Model} shape. */\nexport function pluginModelToModel(providerId: string, definition: ProviderModelDefinition): Model<Api> {\n\treturn {\n\t\tprovider: providerId,\n\t\tid: definition.id,\n\t\tname: definition.name,\n\t\tapi: 'openai-completions' as Api,\n\t\tbaseUrl: EXTENSION_PROVIDER_BASE_URL,\n\t\treasoning: false,\n\t\tinput: definition.supportsImages ? (['text', 'image'] as ('text' | 'image')[]) : (['text'] as ('text' | 'image')[]),\n\t\tcontextWindow: definition.contextWindow ?? 128000,\n\t\tmaxTokens: definition.maxOutputTokens ?? 4096,\n\t\tcost: {\n\t\t\tinput: definition.pricing?.input ?? 0,\n\t\t\toutput: definition.pricing?.output ?? 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t} as Model<Api>;\n}\n\n/**\n * Get API key synchronously: checks registry (models.json) first, then environment variables.\n * Use this for Agent's getApiKey callback which must be synchronous.\n */\nexport function getApiKeySync(provider: string): string | undefined {\n const pluginRegistry = getProviderRegistry();\n if (pluginRegistry.has(provider)) return 'extension-managed';\n\n const registry = getModelRegistry();\n const registryKey = registry.getApiKey(provider);\n if (registryKey) {\n return registryKey;\n }\n return getApiKeyFromEnv(provider);\n}\n\n/**\n * Resolve model reference. Supports:\n * - \"provider/modelId\" format\n * - \"modelId\" auto-detection via pi-ai or custom models\n * @throws if model not found\n */\nexport function resolveModel(ref: string): Model<Api> {\n\tconst trimmedRef = typeof ref === 'string' ? ref.trim() : '';\n\tif (!trimmedRef) {\n\t\tthrow new Error(\n\t\t\t'No default model configured. Choose a model in onboarding or set agents.capabilityPresets.default.models.roles.<role>.model.',\n\t\t);\n\t}\n\n\t// First try ModelRegistry (includes custom models)\n\tconst registry = getModelRegistry();\n\tconst customModel = registry.resolve(trimmedRef);\n\tif (customModel) {\n\t\treturn customModel;\n\t}\n\n\tif (trimmedRef.includes('/')) {\n\t\tconst [provider, modelId] = trimmedRef.split('/');\n\t\tconst piAiModel = getPiAiModel(provider as any, modelId as any);\n\t\tif (piAiModel) return normalizeProviderModel(piAiModel as Model<Api>);\n\n\t\tconst pluginRegistry = getProviderRegistry();\n\t\tconst plugin = pluginRegistry.get(provider);\n\t\tif (plugin) {\n\t\t\tconst pluginModel = plugin.models.find(m => m.id === modelId);\n\t\t\tif (pluginModel) return pluginModelToModel(provider, pluginModel);\n\t\t}\n\t\tthrow new Error(`Model not found: ${trimmedRef}`);\n\t}\n\n\tfor (const provider of getPiAiProviders()) {\n\t\ttry {\n\t\t\tconst models = getPiAiModels(provider);\n\t\t\tconst found = models.find(m => m.id === trimmedRef);\n\t\t\tif (found) return normalizeProviderModel(found as Model<Api>);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\tconst pluginRegistry = getProviderRegistry();\n\tfor (const plugin of pluginRegistry.listAll()) {\n\t\tconst found = plugin.models.find(m => m.id === trimmedRef);\n\t\tif (found) return pluginModelToModel(plugin.id, found);\n\t}\n\n\tthrow new Error(`Model not found: ${trimmedRef}. Use format: provider/model-id`);\n}\n\nexport function getModelsByProvider(provider: string): readonly Model<Api>[] {\n\tconst registry = getModelRegistry();\n\tconst fromRegistry = registry.getAll().filter(m => m.provider === provider).map(normalizeProviderModel);\n\tconst plugin = getProviderRegistry().get(provider);\n\tif (!plugin) return fromRegistry;\n\tconst pluginModels = plugin.models.map(m => pluginModelToModel(provider, m));\n\treturn [...fromRegistry, ...pluginModels];\n}\n\nexport function getAllProviders(): string[] {\n\tconst registry = getModelRegistry();\n\tconst providers = new Set<string>();\n\n\t// Add built-in providers\n\tfor (const p of getPiAiProviders()) {\n\t\tproviders.add(p);\n\t}\n\n\t// Add custom providers from registry\n\tfor (const m of registry.getAll()) {\n\t\tproviders.add(m.provider);\n\t}\n\n\tfor (const plugin of getProviderRegistry().listAll()) {\n\t\tproviders.add(plugin.id);\n\t}\n\n\treturn Array.from(providers);\n}\n\nexport async function getApiKey(provider: string): Promise<string | undefined> {\n\tif (getProviderRegistry().has(provider)) return 'extension-managed';\n\n\t// Use new credential resolver first (checks: agent private > global > oauth > env)\n\tconst credentialKey = await resolveApiKey(provider);\n\tif (credentialKey) {\n\t\treturn credentialKey;\n\t}\n\n\t// Check registry for custom providers (from models.json)\n\tconst registry = getModelRegistry();\n\tconst registryKey = registry.getApiKey(provider);\n\tif (registryKey) {\n\t\treturn registryKey;\n\t}\n\n\t// Fallback to environment variables\n\treturn getApiKeyFromEnv(provider);\n}\n\n/**\n * Synchronous version for use in non-async contexts\n * Only checks environment variables and registry, not credential system\n */\nexport function isProviderConfiguredSync(provider: string): boolean {\n\tif (getProviderRegistry().has(provider)) return true;\n\n\t// Check registry for custom providers\n\tconst registry = getModelRegistry();\n\tif (registry.getApiKey(provider)) {\n\t\treturn true;\n\t}\n\t// Check environment variables\n\tif (getApiKeyFromEnv(provider)) {\n\t\treturn true;\n\t}\n\t// Gateway UI / CLI store keys in auth-profiles.json (async CredentialResolver); sync path for fallback list\n\treturn hasProviderAuthOnDiskSync(provider);\n}\n\nexport async function isProviderConfigured(provider: string): Promise<boolean> {\n if (getProviderRegistry().has(provider)) return true;\n\n // Check registry first for custom providers (from models.json)\n const registry = getModelRegistry();\n if (registry.getApiKey(provider)) {\n return true;\n }\n return await hasCredentials(provider);\n}\n\n/** Where runtime {@link getApiKey} resolves the key from (no secret values). */\nexport type ProviderActiveKeySource = 'none' | 'agent' | 'gateway' | 'oauth' | 'env' | 'models_json' | 'extension';\n\nexport type ProviderAuthMode = ProviderActiveKeySource;\nexport type ProviderAuthStatus = 'connected' | 'expired' | 'not_connected';\n\nexport interface ProviderAuthState {\n authMode: ProviderAuthMode;\n authStatus: ProviderAuthStatus;\n expiresAt?: number;\n}\n\nexport async function getProviderActiveKeySource(provider: string): Promise<ProviderActiveKeySource> {\n const authState = await getProviderAuthState(provider);\n return authState.authMode;\n}\n\nexport async function getProviderAuthState(provider: string): Promise<ProviderAuthState> {\n if (getProviderRegistry().has(provider)) {\n return { authMode: 'extension', authStatus: 'connected' };\n }\n\n const resolver = new CredentialResolver();\n const fromCredentials = await resolver.resolveApiKeySource(provider);\n if (fromCredentials === 'agent') return { authMode: 'agent', authStatus: 'connected' };\n if (fromCredentials === 'global') return { authMode: 'gateway', authStatus: 'connected' };\n if (fromCredentials === 'oauth') {\n const token = await resolver.loadOAuthTokenRecord(provider);\n const expired = Boolean(token?.expiresAt && token.expiresAt < Date.now());\n return {\n authMode: 'oauth',\n authStatus: expired ? 'expired' : 'connected',\n ...(token?.expiresAt ? { expiresAt: token.expiresAt } : {}),\n };\n }\n if (fromCredentials === 'env') return { authMode: 'env', authStatus: 'connected' };\n\n const expiredOAuthToken = await resolver.loadOAuthTokenRecord(provider);\n if (expiredOAuthToken?.expiresAt && expiredOAuthToken.expiresAt < Date.now()) {\n return {\n authMode: 'oauth',\n authStatus: 'expired',\n expiresAt: expiredOAuthToken.expiresAt,\n };\n }\n\n const registry = getModelRegistry();\n if (registry.getApiKey(provider)) {\n return { authMode: 'models_json', authStatus: 'connected' };\n }\n\n return { authMode: 'none', authStatus: 'not_connected' };\n}\n\nexport async function getConfiguredProviders(): Promise<string[]> {\n\tconst allProviders = getAllProviders();\n\tconst configured: string[] = [];\n\tfor (const p of allProviders) {\n\t\tif (await isProviderConfigured(p)) {\n\t\t\tconfigured.push(p);\n\t\t}\n\t}\n\treturn configured;\n}\n\nexport function getAllModels(): readonly Model<Api>[] {\n\tconst registry = getModelRegistry();\n\tconst registryModels = registry.getAll().map(normalizeProviderModel);\n\tconst pluginProviders = getProviderRegistry().listAll();\n\tif (pluginProviders.length === 0) return registryModels;\n\n\tconst existingIds = new Set(registryModels.map(m => `${m.provider}/${m.id}`));\n\tconst merged: Model<Api>[] = [...registryModels];\n\tfor (const plugin of pluginProviders) {\n\t\tfor (const model of plugin.models) {\n\t\t\tconst compositeId = `${plugin.id}/${model.id}`;\n\t\t\tif (!existingIds.has(compositeId)) {\n\t\t\t\tmerged.push(pluginModelToModel(plugin.id, model));\n\t\t\t\texistingIds.add(compositeId);\n\t\t\t}\n\t\t}\n\t}\n\treturn merged;\n}\n\nexport async function getAvailableModels(): Promise<readonly Model<Api>[]> {\n\tconst allModels = getAllModels();\n\tconst pluginRegistry = getProviderRegistry();\n\tconst available: Model<Api>[] = [];\n\tconst configuredByProvider = new Map<string, boolean>();\n\n\tfor (const model of allModels) {\n\t\tif (pluginRegistry.has(model.provider)) {\n\t\t\tavailable.push(model);\n\t\t\tcontinue;\n\t\t}\n\t\tlet configured = configuredByProvider.get(model.provider);\n\t\tif (configured === undefined) {\n\t\t\tconfigured = await isProviderConfigured(model.provider);\n\t\t\tconfiguredByProvider.set(model.provider, configured);\n\t\t}\n\t\tif (configured) {\n\t\t\tavailable.push(model);\n\t\t}\n\t}\n\treturn available;\n}\n\nexport type { Model, Api } from '@earendil-works/pi-ai';\n\nexport type ProviderCategory = 'common' | 'domestic' | 'specialty' | 'oauth' | 'enterprise' | 'extension';\n\nexport interface ProviderMeta {\n name: string;\n category: ProviderCategory;\n supportsOAuth?: boolean;\n supportsApiKey?: boolean;\n}\n\nexport const PROVIDER_META: Record<string, ProviderMeta> = {\n 'openai': { name: 'OpenAI', category: 'common', supportsApiKey: true },\n 'anthropic': { name: 'Anthropic', category: 'common', supportsApiKey: true, supportsOAuth: true },\n 'deepseek': { name: 'DeepSeek', category: 'domestic', supportsApiKey: true },\n 'google': { name: 'Google AI', category: 'common', supportsApiKey: true },\n 'groq': { name: 'Groq', category: 'common', supportsApiKey: true },\n 'minimax': { name: 'MiniMax', category: 'domestic', supportsApiKey: true, supportsOAuth: true },\n 'minimax-cn': { name: 'MiniMax CN', category: 'domestic', supportsApiKey: true, supportsOAuth: true },\n 'kimi-coding': { name: 'Kimi For Coding', category: 'domestic', supportsApiKey: true, supportsOAuth: true },\n 'xai': { name: 'xAI', category: 'specialty', supportsApiKey: true },\n 'mistral': { name: 'Mistral AI', category: 'specialty', supportsApiKey: true },\n 'cerebras': { name: 'Cerebras', category: 'specialty', supportsApiKey: true },\n 'openrouter': { name: 'OpenRouter', category: 'specialty', supportsApiKey: true },\n 'huggingface': { name: 'Hugging Face', category: 'specialty', supportsApiKey: true },\n moonshotai: { name: 'Moonshot AI (Kimi · International)', category: 'domestic', supportsApiKey: true },\n 'moonshotai-cn': { name: 'Moonshot AI (Kimi · China)', category: 'domestic', supportsApiKey: true },\n fireworks: { name: 'Fireworks AI', category: 'specialty', supportsApiKey: true },\n together: { name: 'Together AI', category: 'specialty', supportsApiKey: true },\n 'cloudflare-workers-ai': { name: 'Cloudflare Workers AI', category: 'enterprise', supportsApiKey: true },\n 'cloudflare-ai-gateway': { name: 'Cloudflare AI Gateway', category: 'enterprise', supportsApiKey: true },\n xiaomi: { name: 'Xiaomi Mimo', category: 'domestic', supportsApiKey: true },\n 'xiaomi-token-plan-cn': { name: 'Xiaomi Token Plan (CN)', category: 'domestic', supportsApiKey: true },\n 'xiaomi-token-plan-ams': { name: 'Xiaomi Token Plan (AMS)', category: 'domestic', supportsApiKey: true },\n 'xiaomi-token-plan-sgp': { name: 'Xiaomi Token Plan (SGP)', category: 'domestic', supportsApiKey: true },\n 'opencode': { name: 'OpenCode', category: 'specialty', supportsApiKey: true },\n 'opencode-go': { name: 'OpenCode Go', category: 'specialty', supportsApiKey: true },\n 'dashscope': { name: 'DashScope (Alibaba)', category: 'domestic', supportsApiKey: true },\n 'dashscope-cn': { name: 'Alibaba Bailian / DashScope China', category: 'domestic', supportsApiKey: true },\n 'dashscope-intl': { name: 'Alibaba Bailian / DashScope International', category: 'domestic', supportsApiKey: true },\n 'volcengine-ark': { name: 'Volcengine Ark', category: 'domestic', supportsApiKey: true },\n 'volcengine-plan': { name: 'Volcengine Doubao Coding Plan', category: 'domestic', supportsApiKey: true },\n 'byteplus-plan': { name: 'BytePlus Doubao Coding Plan', category: 'domestic', supportsApiKey: true },\n 'stepfun': { name: 'StepFun', category: 'domestic', supportsApiKey: true },\n 'stepfun-cn': { name: 'StepFun China', category: 'domestic', supportsApiKey: true },\n 'stepfun-intl': { name: 'StepFun International', category: 'domestic', supportsApiKey: true },\n 'stepfun-plan': { name: 'StepFun Step Plan', category: 'domestic', supportsApiKey: true },\n 'stepfun-plan-cn': { name: 'StepFun Step Plan China', category: 'domestic', supportsApiKey: true },\n 'stepfun-plan-intl': { name: 'StepFun Step Plan International', category: 'domestic', supportsApiKey: true },\n 'ant-ling': { name: 'Ant Ling', category: 'domestic', supportsApiKey: true },\n 'zhipu-cn': { name: 'Zhipu GLM (China)', category: 'domestic', supportsApiKey: true },\n 'zai-coding-cn': { name: 'Zhipu GLM Coding Plan (China)', category: 'domestic', supportsApiKey: true },\n 'zai-coding-global': { name: 'Zhipu GLM Coding Plan (International)', category: 'domestic', supportsApiKey: true },\n 'zhipu-coding-cn': { name: 'Zhipu GLM Coding Plan (China)', category: 'domestic', supportsApiKey: true },\n /** International GLM (api.z.ai). Auth: API key (ZAI_API_KEY); no published OAuth for this HTTP API. */\n 'zai': { name: 'Zhipu GLM (International · z.ai)', category: 'domestic', supportsApiKey: true },\n 'amazon-bedrock': { name: 'Amazon Bedrock', category: 'enterprise', supportsApiKey: true },\n 'azure-openai-responses': { name: 'Azure OpenAI', category: 'enterprise', supportsApiKey: true },\n 'google-vertex': { name: 'Google Vertex AI', category: 'enterprise', supportsApiKey: true },\n 'vercel-ai-gateway': { name: 'Vercel AI Gateway', category: 'enterprise', supportsApiKey: true },\n 'github-copilot': { name: 'GitHub Copilot (OAuth)', category: 'oauth', supportsOAuth: true, supportsApiKey: false },\n 'openai-codex': { name: 'OpenAI Codex (OAuth)', category: 'oauth', supportsOAuth: true, supportsApiKey: false },\n 'google-gemini-cli': { name: 'Google Gemini CLI (OAuth)', category: 'oauth', supportsOAuth: true, supportsApiKey: false },\n 'google-antigravity': { name: 'Google Antigravity (OAuth)', category: 'oauth', supportsOAuth: true, supportsApiKey: false },\n};\n\nexport function getSortedProviders(): string[] {\n const all = getAllProviders();\n const catOrder: Record<ProviderCategory, number> = {\n common: 0,\n domestic: 1,\n specialty: 2,\n enterprise: 3,\n oauth: 4,\n extension: 5,\n };\n const pluginRegistry = getProviderRegistry();\n\n return [...all].sort((a, b) => {\n const catA = pluginRegistry.has(a) ? 'extension' : (PROVIDER_META[a]?.category ?? 'specialty');\n const catB = pluginRegistry.has(b) ? 'extension' : (PROVIDER_META[b]?.category ?? 'specialty');\n if (catOrder[catA] !== catOrder[catB]) {\n return catOrder[catA] - catOrder[catB];\n }\n return a.localeCompare(b);\n });\n}\n\nexport function getProviderDisplayName(provider: string): string {\n const plugin = getProviderRegistry().get(provider);\n if (plugin) return plugin.name;\n return PROVIDER_META[provider]?.name || provider;\n}\n\nexport function providerSupportsOAuth(provider: string): boolean {\n return PROVIDER_META[provider]?.supportsOAuth ?? false;\n}\n\nexport function providerSupportsApiKey(provider: string): boolean {\n return PROVIDER_META[provider]?.supportsApiKey ?? true;\n}\n\n// ============================================\n// Dynamic Default Model Resolution\n// ============================================\n\n/**\n * Get a default model reference.\n * Priority:\n * 1. Effective model inherited from the global default preset / agent presets / agent override\n * 2. Empty string only when no default model is present in the loaded config\n */\nexport async function getDefaultModel(config?: Config | null | undefined): Promise<string> {\n const modelRef = config ? getAgentDefaultModelRef(config) : undefined;\n if (modelRef) {\n const availableModels = await getAvailableModels();\n const configured = availableModels.find(m =>\n `${m.provider}/${m.id}` === modelRef ||\n m.id === modelRef\n );\n if (configured) {\n return `${configured.provider}/${configured.id}`;\n }\n return modelRef;\n }\n\n return '';\n}\n\n/**\n * Synchronous default model resolution for constructors and sync code paths.\n * Uses catalog/registry only (no async credential checks).\n *\n * When no model is present in the loaded config, returns an empty string so\n * setup flows can prompt for the global default model.\n */\nexport function getDefaultModelSync(config?: Config | null | undefined): string {\n const modelRef = config ? getAgentDefaultModelRef(config) : undefined;\n if (modelRef) {\n return modelRef;\n }\n\n return '';\n}\n\n// Re-export ModelRegistry for advanced use cases\nexport { ModelRegistry, getModelRegistry, resetModelRegistry, prewarmModelRegistry } from './model-registry.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAS,uBAAuB,OAA+B;AAC9D,KAAI,MAAM,aAAa,kBAAkB,MAAM,QAAQ,yBACtD,QAAO;EAAE,GAAG;EAAO,SAAS;EAAiC;AAE9D,QAAO;;;AAIR,SAAgB,mBAAmB,YAAoB,YAAiD;AACvG,QAAO;EACN,UAAU;EACV,IAAI,WAAW;EACf,MAAM,WAAW;EACjB,KAAK;EACL,SAAS;EACT,WAAW;EACX,OAAO,WAAW,iBAAkB,C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GAAc,gBAAgB;GAAM;EAChG,iBAAiB;GAAE,MAAM;GAAoB,UAAU;GAAc,gBAAgB;GAAM;EAC3F,qBAAqB;GAAE,MAAM;GAAqB,UAAU;GAAc,gBAAgB;GAAM;EAChG,kBAAkB;GAAE,MAAM;GAA0B,UAAU;GAAS,eAAe;GAAM,gBAAgB;GAAO;EACnH,gBAAgB;GAAE,MAAM;GAAwB,UAAU;GAAS,eAAe;GAAM,gBAAgB;GAAO;EAC/G,qBAAqB;GAAE,MAAM;GAA6B,UAAU;GAAS,eAAe;GAAM,gBAAgB;GAAO;EACzH,sBAAsB;GAAE,MAAM;GAA8B,UAAU;GAAS,eAAe;GAAM,gBAAgB;GAAO;EAC5H"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["getPiAiModel","getPiAiProviders","getPiAiModels"],"sources":["../../../src/providers/index.ts"],"sourcesContent":["/**\n * Model provider module - integrates built-in models with custom models from models.json\n */\n\nimport {\n\tgetModel as getPiAiModel,\n\tgetModels as getPiAiModels,\n\tgetProviders as getPiAiProviders,\n\ttype Model,\n\ttype Api,\n} from '@earendil-works/pi-ai/compat';\nimport { getAgentDefaultModelRef, type Config } from '../config/schema.js';\nimport { getModelRegistry } from './model-registry.js';\nimport { CredentialResolver, resolveApiKey, hasCredentials } from '../auth/credentials.js';\nimport { hasProviderAuthOnDiskSync } from '../auth/sync-provider-auth.js';\nimport { getApiKeyFromEnv } from './env-keys.js';\nimport { getSupplementalModels } from './model-supplements.js';\nimport { getProviderRegistry } from './plugin-registry.js';\nimport type { ProviderModelDefinition } from '../extensions/types/providers.js';\n\nexport { getApiKeyFromEnv, PROVIDER_ENV_MAP } from './env-keys.js';\n\n/** Sentinel base URL: model is served by an extension {@link ProviderPluginRegistry} provider. */\nexport const EXTENSION_PROVIDER_BASE_URL = 'extension://provider-plugin';\nconst OPENAI_CODEX_CANONICAL_BASE_URL = 'https://chatgpt.com/backend-api/codex';\n\nfunction normalizeProviderModel(model: Model<Api>): Model<Api> {\n\tif (model.provider === 'openai-codex' && model.api === 'openai-codex-responses') {\n\t\treturn { ...model, baseUrl: OPENAI_CODEX_CANONICAL_BASE_URL } as Model<Api>;\n\t}\n\treturn model;\n}\n\n/** Map a plugin registry model to the pi-ai {@link Model} shape. */\nexport function pluginModelToModel(providerId: string, definition: ProviderModelDefinition): Model<Api> {\n\treturn {\n\t\tprovider: providerId,\n\t\tid: definition.id,\n\t\tname: definition.name,\n\t\tapi: 'openai-completions' as Api,\n\t\tbaseUrl: EXTENSION_PROVIDER_BASE_URL,\n\t\treasoning: false,\n\t\tinput: definition.supportsImages ? (['text', 'image'] as ('text' | 'image')[]) : (['text'] as ('text' | 'image')[]),\n\t\tcontextWindow: definition.contextWindow ?? 128000,\n\t\tmaxTokens: definition.maxOutputTokens ?? 4096,\n\t\tcost: {\n\t\t\tinput: definition.pricing?.input ?? 0,\n\t\t\toutput: definition.pricing?.output ?? 0,\n\t\t\tcacheRead: 0,\n\t\t\tcacheWrite: 0,\n\t\t},\n\t} as Model<Api>;\n}\n\n/**\n * Get API key synchronously: checks registry (models.json) first, then environment variables.\n * Use this for Agent's getApiKey callback which must be synchronous.\n */\nexport function getApiKeySync(provider: string): string | undefined {\n const pluginRegistry = getProviderRegistry();\n if (pluginRegistry.has(provider)) return 'extension-managed';\n\n const registry = getModelRegistry();\n const registryKey = registry.getApiKey(provider);\n if (registryKey) {\n return registryKey;\n }\n return getApiKeyFromEnv(provider);\n}\n\n/**\n * Resolve model reference. Supports:\n * - \"provider/modelId\" format\n * - \"modelId\" auto-detection via pi-ai or custom models\n * @throws if model not found\n */\nexport function resolveModel(ref: string): Model<Api> {\n\tconst trimmedRef = typeof ref === 'string' ? ref.trim() : '';\n\tif (!trimmedRef) {\n\t\tthrow new Error(\n\t\t\t'No default model configured. Choose a model in onboarding or set agents.capabilityPresets.default.models.roles.<role>.model.',\n\t\t);\n\t}\n\n\t// First try ModelRegistry (includes custom models)\n\tconst registry = getModelRegistry();\n\tconst customModel = registry.resolve(trimmedRef);\n\tif (customModel) {\n\t\treturn customModel;\n\t}\n\n\tif (trimmedRef.includes('/')) {\n\t\tconst [provider, modelId] = trimmedRef.split('/');\n\t\tconst piAiModel = getPiAiModel(provider as any, modelId as any);\n\t\tif (piAiModel) return normalizeProviderModel(piAiModel as Model<Api>);\n\n\t\tconst supplementalModel = getSupplementalModels().find(m => m.provider === provider && m.id === modelId);\n\t\tif (supplementalModel) return normalizeProviderModel(supplementalModel);\n\n\t\tconst pluginRegistry = getProviderRegistry();\n\t\tconst plugin = pluginRegistry.get(provider);\n\t\tif (plugin) {\n\t\t\tconst pluginModel = plugin.models.find(m => m.id === modelId);\n\t\t\tif (pluginModel) return pluginModelToModel(provider, pluginModel);\n\t\t}\n\t\tthrow new Error(`Model not found: ${trimmedRef}`);\n\t}\n\n\tfor (const provider of getPiAiProviders()) {\n\t\ttry {\n\t\t\tconst models = getPiAiModels(provider);\n\t\t\tconst found = models.find(m => m.id === trimmedRef);\n\t\t\tif (found) return normalizeProviderModel(found as Model<Api>);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\tconst supplementalModel = getSupplementalModels().find(m => m.id === trimmedRef);\n\tif (supplementalModel) return normalizeProviderModel(supplementalModel);\n\n\tconst pluginRegistry = getProviderRegistry();\n\tfor (const plugin of pluginRegistry.listAll()) {\n\t\tconst found = plugin.models.find(m => m.id === trimmedRef);\n\t\tif (found) return pluginModelToModel(plugin.id, found);\n\t}\n\n\tthrow new Error(`Model not found: ${trimmedRef}. Use format: provider/model-id`);\n}\n\nexport function getModelsByProvider(provider: string): readonly Model<Api>[] {\n\tconst registry = getModelRegistry();\n\tconst fromRegistry = registry.getAll().filter(m => m.provider === provider).map(normalizeProviderModel);\n\tconst existingIds = new Set(fromRegistry.map(m => m.id));\n\tconst supplementalModels = getSupplementalModels()\n\t\t.filter(m => m.provider === provider && !existingIds.has(m.id))\n\t\t.map(normalizeProviderModel);\n\tconst plugin = getProviderRegistry().get(provider);\n\tif (!plugin) return [...fromRegistry, ...supplementalModels];\n\tconst pluginModels = plugin.models.map(m => pluginModelToModel(provider, m));\n\treturn [...fromRegistry, ...supplementalModels, ...pluginModels];\n}\n\nexport function getAllProviders(): string[] {\n\tconst registry = getModelRegistry();\n\tconst providers = new Set<string>();\n\n\t// Add built-in providers\n\tfor (const p of getPiAiProviders()) {\n\t\tproviders.add(p);\n\t}\n\n\t// Add custom providers from registry\n\tfor (const m of registry.getAll()) {\n\t\tproviders.add(m.provider);\n\t}\n\n\tfor (const plugin of getProviderRegistry().listAll()) {\n\t\tproviders.add(plugin.id);\n\t}\n\n\treturn Array.from(providers);\n}\n\nexport async function getApiKey(provider: string): Promise<string | undefined> {\n\tif (getProviderRegistry().has(provider)) return 'extension-managed';\n\n\t// Use new credential resolver first (checks: agent private > global > oauth > env)\n\tconst credentialKey = await resolveApiKey(provider);\n\tif (credentialKey) {\n\t\treturn credentialKey;\n\t}\n\n\t// Check registry for custom providers (from models.json)\n\tconst registry = getModelRegistry();\n\tconst registryKey = registry.getApiKey(provider);\n\tif (registryKey) {\n\t\treturn registryKey;\n\t}\n\n\t// Fallback to environment variables\n\treturn getApiKeyFromEnv(provider);\n}\n\n/**\n * Synchronous version for use in non-async contexts\n * Only checks environment variables and registry, not credential system\n */\nexport function isProviderConfiguredSync(provider: string): boolean {\n\tif (getProviderRegistry().has(provider)) return true;\n\n\t// Check registry for custom providers\n\tconst registry = getModelRegistry();\n\tif (registry.getApiKey(provider)) {\n\t\treturn true;\n\t}\n\t// Check environment variables\n\tif (getApiKeyFromEnv(provider)) {\n\t\treturn true;\n\t}\n\t// Gateway UI / CLI store keys in auth-profiles.json (async CredentialResolver); sync path for fallback list\n\treturn hasProviderAuthOnDiskSync(provider);\n}\n\nexport async function isProviderConfigured(provider: string): Promise<boolean> {\n if (getProviderRegistry().has(provider)) return true;\n\n // Check registry first for custom providers (from models.json)\n const registry = getModelRegistry();\n if (registry.getApiKey(provider)) {\n return true;\n }\n return await hasCredentials(provider);\n}\n\n/** Where runtime {@link getApiKey} resolves the key from (no secret values). */\nexport type ProviderActiveKeySource = 'none' | 'agent' | 'gateway' | 'oauth' | 'env' | 'models_json' | 'extension';\n\nexport type ProviderAuthMode = ProviderActiveKeySource;\nexport type ProviderAuthStatus = 'connected' | 'expired' | 'not_connected';\n\nexport interface ProviderAuthState {\n authMode: ProviderAuthMode;\n authStatus: ProviderAuthStatus;\n expiresAt?: number;\n}\n\nexport async function getProviderActiveKeySource(provider: string): Promise<ProviderActiveKeySource> {\n const authState = await getProviderAuthState(provider);\n return authState.authMode;\n}\n\nexport async function getProviderAuthState(provider: string): Promise<ProviderAuthState> {\n if (getProviderRegistry().has(provider)) {\n return { authMode: 'extension', authStatus: 'connected' };\n }\n\n const resolver = new CredentialResolver();\n const fromCredentials = await resolver.resolveApiKeySource(provider);\n if (fromCredentials === 'agent') return { authMode: 'agent', authStatus: 'connected' };\n if (fromCredentials === 'global') return { authMode: 'gateway', authStatus: 'connected' };\n if (fromCredentials === 'oauth') {\n const token = await resolver.loadOAuthTokenRecord(provider);\n const expired = Boolean(token?.expiresAt && token.expiresAt < Date.now());\n return {\n authMode: 'oauth',\n authStatus: expired ? 'expired' : 'connected',\n ...(token?.expiresAt ? { expiresAt: token.expiresAt } : {}),\n };\n }\n if (fromCredentials === 'env') return { authMode: 'env', authStatus: 'connected' };\n\n const expiredOAuthToken = await resolver.loadOAuthTokenRecord(provider);\n if (expiredOAuthToken?.expiresAt && expiredOAuthToken.expiresAt < Date.now()) {\n return {\n authMode: 'oauth',\n authStatus: 'expired',\n expiresAt: expiredOAuthToken.expiresAt,\n };\n }\n\n const registry = getModelRegistry();\n if (registry.getApiKey(provider)) {\n return { authMode: 'models_json', authStatus: 'connected' };\n }\n\n return { authMode: 'none', authStatus: 'not_connected' };\n}\n\nexport async function getConfiguredProviders(): Promise<string[]> {\n\tconst allProviders = getAllProviders();\n\tconst configured: string[] = [];\n\tfor (const p of allProviders) {\n\t\tif (await isProviderConfigured(p)) {\n\t\t\tconfigured.push(p);\n\t\t}\n\t}\n\treturn configured;\n}\n\nexport function getAllModels(): readonly Model<Api>[] {\n\tconst registry = getModelRegistry();\n\tconst registryModels = registry.getAll().map(normalizeProviderModel);\n\tconst existingIds = new Set(registryModels.map(m => `${m.provider}/${m.id}`));\n\tconst supplementalModels = getSupplementalModels()\n\t\t.filter(m => !existingIds.has(`${m.provider}/${m.id}`))\n\t\t.map(normalizeProviderModel);\n\tfor (const model of supplementalModels) {\n\t\texistingIds.add(`${model.provider}/${model.id}`);\n\t}\n\tconst pluginProviders = getProviderRegistry().listAll();\n\tif (pluginProviders.length === 0) return [...registryModels, ...supplementalModels];\n\n\tconst merged: Model<Api>[] = [...registryModels, ...supplementalModels];\n\tfor (const plugin of pluginProviders) {\n\t\tfor (const model of plugin.models) {\n\t\t\tconst compositeId = `${plugin.id}/${model.id}`;\n\t\t\tif (!existingIds.has(compositeId)) {\n\t\t\t\tmerged.push(pluginModelToModel(plugin.id, model));\n\t\t\t\texistingIds.add(compositeId);\n\t\t\t}\n\t\t}\n\t}\n\treturn merged;\n}\n\nexport async function getAvailableModels(): Promise<readonly Model<Api>[]> {\n\tconst allModels = getAllModels();\n\tconst pluginRegistry = getProviderRegistry();\n\tconst available: Model<Api>[] = [];\n\tconst configuredByProvider = new Map<string, boolean>();\n\n\tfor (const model of allModels) {\n\t\tif (pluginRegistry.has(model.provider)) {\n\t\t\tavailable.push(model);\n\t\t\tcontinue;\n\t\t}\n\t\tlet configured = configuredByProvider.get(model.provider);\n\t\tif (configured === undefined) {\n\t\t\tconfigured = await isProviderConfigured(model.provider);\n\t\t\tconfiguredByProvider.set(model.provider, configured);\n\t\t}\n\t\tif (configured) {\n\t\t\tavailable.push(model);\n\t\t}\n\t}\n\treturn available;\n}\n\nexport type { Model, Api } from '@earendil-works/pi-ai';\n\nexport type ProviderCategory = 'common' | 'domestic' | 'specialty' | 'oauth' | 'enterprise' | 'extension';\n\nexport interface ProviderMeta {\n name: string;\n category: ProviderCategory;\n supportsOAuth?: boolean;\n supportsApiKey?: boolean;\n}\n\nexport const PROVIDER_META: Record<string, ProviderMeta> = {\n 'openai': { name: 'OpenAI', category: 'common', supportsApiKey: true },\n 'anthropic': { name: 'Anthropic', category: 'common', supportsApiKey: true, supportsOAuth: true },\n 'deepseek': { name: 'DeepSeek', category: 'domestic', supportsApiKey: true },\n 'google': { name: 'Google AI', category: 'common', supportsApiKey: true },\n 'groq': { name: 'Groq', category: 'common', supportsApiKey: true },\n 'minimax': { name: 'MiniMax', category: 'domestic', supportsApiKey: true, supportsOAuth: true },\n 'minimax-cn': { name: 'MiniMax CN', category: 'domestic', supportsApiKey: true, supportsOAuth: true },\n 'kimi-coding': { name: 'Kimi For Coding', category: 'domestic', supportsApiKey: true, supportsOAuth: true },\n 'xai': { name: 'xAI', category: 'specialty', supportsApiKey: true },\n 'mistral': { name: 'Mistral AI', category: 'specialty', supportsApiKey: true },\n 'cerebras': { name: 'Cerebras', category: 'specialty', supportsApiKey: true },\n 'openrouter': { name: 'OpenRouter', category: 'specialty', supportsApiKey: true },\n 'huggingface': { name: 'Hugging Face', category: 'specialty', supportsApiKey: true },\n moonshotai: { name: 'Moonshot AI (Kimi · International)', category: 'domestic', supportsApiKey: true },\n 'moonshotai-cn': { name: 'Moonshot AI (Kimi · China)', category: 'domestic', supportsApiKey: true },\n fireworks: { name: 'Fireworks AI', category: 'specialty', supportsApiKey: true },\n together: { name: 'Together AI', category: 'specialty', supportsApiKey: true },\n 'cloudflare-workers-ai': { name: 'Cloudflare Workers AI', category: 'enterprise', supportsApiKey: true },\n 'cloudflare-ai-gateway': { name: 'Cloudflare AI Gateway', category: 'enterprise', supportsApiKey: true },\n xiaomi: { name: 'Xiaomi Mimo', category: 'domestic', supportsApiKey: true },\n 'xiaomi-token-plan-cn': { name: 'Xiaomi Token Plan (CN)', category: 'domestic', supportsApiKey: true },\n 'xiaomi-token-plan-ams': { name: 'Xiaomi Token Plan (AMS)', category: 'domestic', supportsApiKey: true },\n 'xiaomi-token-plan-sgp': { name: 'Xiaomi Token Plan (SGP)', category: 'domestic', supportsApiKey: true },\n 'opencode': { name: 'OpenCode', category: 'specialty', supportsApiKey: true },\n 'opencode-go': { name: 'OpenCode Go', category: 'specialty', supportsApiKey: true },\n 'dashscope': { name: 'DashScope (Alibaba)', category: 'domestic', supportsApiKey: true },\n 'dashscope-cn': { name: 'Alibaba Bailian / DashScope China', category: 'domestic', supportsApiKey: true },\n 'dashscope-intl': { name: 'Alibaba Bailian / DashScope International', category: 'domestic', supportsApiKey: true },\n 'volcengine-ark': { name: 'Volcengine Ark', category: 'domestic', supportsApiKey: true },\n 'volcengine-plan': { name: 'Volcengine Doubao Coding Plan', category: 'domestic', supportsApiKey: true },\n 'byteplus-plan': { name: 'BytePlus Doubao Coding Plan', category: 'domestic', supportsApiKey: true },\n 'stepfun': { name: 'StepFun', category: 'domestic', supportsApiKey: true },\n 'stepfun-cn': { name: 'StepFun China', category: 'domestic', supportsApiKey: true },\n 'stepfun-intl': { name: 'StepFun International', category: 'domestic', supportsApiKey: true },\n 'stepfun-plan': { name: 'StepFun Step Plan', category: 'domestic', supportsApiKey: true },\n 'stepfun-plan-cn': { name: 'StepFun Step Plan China', category: 'domestic', supportsApiKey: true },\n 'stepfun-plan-intl': { name: 'StepFun Step Plan International', category: 'domestic', supportsApiKey: true },\n 'ant-ling': { name: 'Ant Ling', category: 'domestic', supportsApiKey: true },\n 'zhipu-cn': { name: 'Zhipu GLM (China)', category: 'domestic', supportsApiKey: true },\n 'zai-coding-cn': { name: 'Zhipu GLM Coding Plan (China)', category: 'domestic', supportsApiKey: true },\n 'zai-coding-global': { name: 'Zhipu GLM Coding Plan (International)', category: 'domestic', supportsApiKey: true },\n 'zhipu-coding-cn': { name: 'Zhipu GLM Coding Plan (China)', category: 'domestic', supportsApiKey: true },\n /** International GLM (api.z.ai). Auth: API key (ZAI_API_KEY); no published OAuth for this HTTP API. */\n 'zai': { name: 'Zhipu GLM (International · z.ai)', category: 'domestic', supportsApiKey: true },\n 'amazon-bedrock': { name: 'Amazon Bedrock', category: 'enterprise', supportsApiKey: true },\n 'azure-openai-responses': { name: 'Azure OpenAI', category: 'enterprise', supportsApiKey: true },\n 'google-vertex': { name: 'Google Vertex AI', category: 'enterprise', supportsApiKey: true },\n 'vercel-ai-gateway': { name: 'Vercel AI Gateway', category: 'enterprise', supportsApiKey: true },\n 'github-copilot': { name: 'GitHub Copilot (OAuth)', category: 'oauth', supportsOAuth: true, supportsApiKey: false },\n 'openai-codex': { name: 'OpenAI Codex (OAuth)', category: 'oauth', supportsOAuth: true, supportsApiKey: false },\n 'google-gemini-cli': { name: 'Google Gemini CLI (OAuth)', category: 'oauth', supportsOAuth: true, supportsApiKey: false },\n 'google-antigravity': { name: 'Google Antigravity (OAuth)', category: 'oauth', supportsOAuth: true, supportsApiKey: false },\n};\n\nexport function getSortedProviders(): string[] {\n const all = getAllProviders();\n const catOrder: Record<ProviderCategory, number> = {\n common: 0,\n domestic: 1,\n specialty: 2,\n enterprise: 3,\n oauth: 4,\n extension: 5,\n };\n const pluginRegistry = getProviderRegistry();\n\n return [...all].sort((a, b) => {\n const catA = pluginRegistry.has(a) ? 'extension' : (PROVIDER_META[a]?.category ?? 'specialty');\n const catB = pluginRegistry.has(b) ? 'extension' : (PROVIDER_META[b]?.category ?? 'specialty');\n if (catOrder[catA] !== catOrder[catB]) {\n return catOrder[catA] - catOrder[catB];\n }\n return a.localeCompare(b);\n });\n}\n\nexport function getProviderDisplayName(provider: string): string {\n const plugin = getProviderRegistry().get(provider);\n if (plugin) return plugin.name;\n return PROVIDER_META[provider]?.name || provider;\n}\n\nexport function providerSupportsOAuth(provider: string): boolean {\n return PROVIDER_META[provider]?.supportsOAuth ?? false;\n}\n\nexport function providerSupportsApiKey(provider: string): boolean {\n return PROVIDER_META[provider]?.supportsApiKey ?? true;\n}\n\n// ============================================\n// Dynamic Default Model Resolution\n// ============================================\n\n/**\n * Get a default model reference.\n * Priority:\n * 1. Effective model inherited from the global default preset / agent presets / agent override\n * 2. Empty string only when no default model is present in the loaded config\n */\nexport async function getDefaultModel(config?: Config | null | undefined): Promise<string> {\n const modelRef = config ? getAgentDefaultModelRef(config) : undefined;\n if (modelRef) {\n const availableModels = await getAvailableModels();\n const configured = availableModels.find(m =>\n `${m.provider}/${m.id}` === modelRef ||\n m.id === modelRef\n );\n if (configured) {\n return `${configured.provider}/${configured.id}`;\n }\n return modelRef;\n }\n\n return '';\n}\n\n/**\n * Synchronous default model resolution for constructors and sync code paths.\n * Uses catalog/registry only (no async credential checks).\n *\n * When no model is present in the loaded config, returns an empty string so\n * setup flows can prompt for the global default model.\n */\nexport function getDefaultModelSync(config?: Config | null | undefined): string {\n const modelRef = config ? getAgentDefaultModelRef(config) : undefined;\n if (modelRef) {\n return modelRef;\n }\n\n return '';\n}\n\n// Re-export ModelRegistry for advanced use cases\nexport { ModelRegistry, getModelRegistry, resetModelRegistry, prewarmModelRegistry } from './model-registry.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,SAAS,uBAAuB,OAA+B;AAC9D,KAAI,MAAM,aAAa,kBAAkB,MAAM,QAAQ,yBACtD,QAAO;EAAE,GAAG;EAAO,SAAS;EAAiC;AAE9D,QAAO;;;AAIR,SAAgB,mBAAmB,YAAoB,YAAiD;AACvG,QAAO;EACN,UAAU;EACV,IAAI,WAAW;EACf,MAAM,WAAW;EACjB,KAAK;EACL,SAAS;EACT,WAAW;EACX,OAAO,WAAW,iBAAkB,CAAC,QAAQ,QAAQ,GAA6B,CAAC,OAAO;EAC1F,eAAe,WAAW,iBAAiB;EAC3C,WAAW,WAAW,mBAAmB;EACzC,MAAM;GACL,OAAO,WAAW,SAAS,SAAS;GACpC,QAAQ,WAAW,SAAS,UAAU;GACtC,WAAW;GACX,YAAY;GACZ;EACD;;;;;;AAOF,SAAgB,cAAc,UAAsC;AAElE,KADuB,qBACL,CAAC,IAAI,SAAS,CAAE,QAAO;CAGzC,MAAM,cADW,kB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