Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: Add new provider ZenMux & Gemini 3 Pro Image Preview (#10310)

sxjeruf2291e4fc8f1
diff --git a/packages/model-bank/package.json b/packages/model-bank/package.json
index 3eb9db3f894..bbdc0a70b79 100644
--- a/packages/model-bank/package.json
+++ b/packages/model-bank/package.json
@@ -69,6 +69,7 @@
"./wenxin": "./src/aiModels/wenxin.ts",
"./xai": "./src/aiModels/xai.ts",
"./xinference": "./src/aiModels/xinference.ts",
+ "./zenmux": "./src/aiModels/zenmux.ts",
"./zeroone": "./src/aiModels/zeroone.ts",
"./zhipu": "./src/aiModels/zhipu.ts",
"./types": "./src/types/index.ts"
diff --git a/packages/model-bank/src/aiModels/aihubmix.ts b/packages/model-bank/src/aiModels/aihubmix.ts
index 7a0c85291b4..9e05d51d27f 100644
--- a/packages/model-bank/src/aiModels/aihubmix.ts
+++ b/packages/model-bank/src/aiModels/aihubmix.ts
@@ -1046,6 +1046,33 @@ const aihubmixModels: AIChatModelCard[] = [
},
type: 'chat',
},
+ {
+ abilities: {
+ imageOutput: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 131_072 + 32_768,
+ description:
+ 'Gemini 3 Pro Image(Nano Banana Pro)是 Google 的图像生成模型,同时支持多模态对话。',
+ displayName: 'Nano Banana Pro',
+ id: 'gemini-3-pro-image-preview',
+ maxOutput: 32_768,
+ pricing: {
+ approximatePricePerImage: 0.134,
+ units: [
+ { name: 'imageOutput', rate: 120, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ searchImpl: 'params',
+ searchProvider: 'google',
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/google.ts b/packages/model-bank/src/aiModels/google.ts
index 57a587f4b05..c401d48de33 100644
--- a/packages/model-bank/src/aiModels/google.ts
+++ b/packages/model-bank/src/aiModels/google.ts
@@ -173,6 +173,33 @@ const googleChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
+ {
+ abilities: {
+ imageOutput: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 131_072 + 32_768,
+ description:
+ 'Gemini 3 Pro Image(Nano Banana Pro)是 Google 的图像生成模型,同时支持多模态对话。',
+ displayName: 'Nano Banana Pro',
+ id: 'gemini-3-pro-image-preview',
+ maxOutput: 32_768,
+ pricing: {
+ approximatePricePerImage: 0.134,
+ units: [
+ { name: 'imageOutput', rate: 120, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ searchImpl: 'params',
+ searchProvider: 'google',
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
@@ -820,16 +847,16 @@ export const imagenGenParameters: ModelParamsSchema = {
};
const NANO_BANANA_ASPECT_RATIOS = [
- '1:1', // 1024x1024
- '2:3', // 832x1248
- '3:2', // 1248x832
- '3:4', // 864x1184
- '4:3', // 1184x864
- '4:5', // 896x1152
- '5:4', // 1152x896
- '9:16', // 768x1344
- '16:9', // 1344x768
- '21:9', // 1536x672
+ '1:1', // 1024x1024 / 2048x2048 / 4096x4096
+ '2:3', // 848x1264 / 1696x2528 / 3392x5056
+ '3:2', // 1264x848 / 2528x1696 / 5056x3392
+ '3:4', // 896x1200 / 1792x2400 / 3584x4800
+ '4:3', // 1200x896 / 2400x1792 / 4800x3584
+ '4:5', // 928x1152 / 1856x2304 / 3712x4608
+ '5:4', // 1152x928 / 2304x1856 / 4608x3712
+ '9:16', // 768x1376 / 1536x2752 / 3072x5504
+ '16:9', // 1376x768 / 2752x1536 / 5504x3072
+ '21:9', // 1584x672 / 3168x1344 / 6336x2688
];
export const nanoBananaParameters: ModelParamsSchema = {
@@ -843,8 +870,40 @@ export const nanoBananaParameters: ModelParamsSchema = {
prompt: { default: '' },
};
+export const nanoBananaProParameters: ModelParamsSchema = {
+ aspectRatio: {
+ default: '1:1',
+ enum: NANO_BANANA_ASPECT_RATIOS,
+ },
+ imageUrls: {
+ default: [],
+ },
+ prompt: { default: '' },
+ resolution: {
+ default: '1K',
+ enum: ['1K', '2K', '4K'],
+ },
+};
+
/* eslint-disable sort-keys-fix/sort-keys-fix */
const googleImageModels: AIImageModelCard[] = [
+ {
+ displayName: 'Nano Banana Pro',
+ id: 'gemini-3-pro-image-preview:image',
+ type: 'image',
+ description:
+ 'Gemini 3 Pro Image(Nano Banana Pro)是 Google 的图像生成模型,同时支持多模态对话。',
+ releasedAt: '2025-11-18',
+ parameters: nanoBananaProParameters,
+ pricing: {
+ approximatePricePerImage: 0.134,
+ units: [
+ { name: 'imageOutput', rate: 120, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ },
{
displayName: 'Nano Banana',
id: 'gemini-2.5-flash-image:image',
diff --git a/packages/model-bank/src/aiModels/index.ts b/packages/model-bank/src/aiModels/index.ts
index 4b3cc7f8fba..a9e2f8565f4 100644
--- a/packages/model-bank/src/aiModels/index.ts
+++ b/packages/model-bank/src/aiModels/index.ts
@@ -63,6 +63,7 @@ import { default as volcengine } from './volcengine';
import { default as wenxin } from './wenxin';
import { default as xai } from './xai';
import { default as xinference } from './xinference';
+import { default as zenmux } from './zenmux';
import { default as zeroone } from './zeroone';
import { default as zhipu } from './zhipu';
@@ -150,6 +151,7 @@ export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
wenxin,
xai,
xinference,
+ zenmux,
zeroone,
zhipu,
});
@@ -219,5 +221,6 @@ export { default as volcengine } from './volcengine';
export { default as wenxin } from './wenxin';
export { default as xai } from './xai';
export { default as xinference } from './xinference';
+export { default as zenmux } from './zenmux';
export { default as zeroone } from './zeroone';
export { default as zhipu } from './zhipu';
diff --git a/packages/model-bank/src/aiModels/infiniai.ts b/packages/model-bank/src/aiModels/infiniai.ts
index 1ac96963fd9..258e7c24bbc 100644
--- a/packages/model-bank/src/aiModels/infiniai.ts
+++ b/packages/model-bank/src/aiModels/infiniai.ts
@@ -53,8 +53,7 @@ const infiniaiChatModels: AIChatModelCard[] = [
reasoning: true,
},
contextWindowTokens: 131_072,
- description:
- 'DeepSeek-V3.2-Exp 是深度求索推出的实验性大语言模型,具有更强的推理和生成能力。',
+ description: 'DeepSeek-V3.2-Exp 是深度求索推出的实验性大语言模型,具有更强的推理和生成能力。',
displayName: 'DeepSeek V3.2 Exp',
enabled: true,
id: 'deepseek-v3.2-exp',
@@ -263,24 +262,6 @@ const infiniaiChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- vision: true,
- },
- contextWindowTokens: 131_072,
- description: 'Step3 是阶跃星辰推出的多模态模型,具备强大的视觉理解能力。',
- displayName: 'Step3',
- id: 'step3',
- maxOutput: 4096,
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
@@ -704,7 +685,8 @@ const infiniaiChatModels: AIChatModelCard[] = [
},
{
contextWindowTokens: 131_072,
- description: '该模型需要申请体验。GPT-OSS-120B 是 OpenAI 推出的开源大规模语言模型,具备强大的文本生成能力。',
+ description:
+ '该模型需要申请体验。GPT-OSS-120B 是 OpenAI 推出的开源大规模语言模型,具备强大的文本生成能力。',
displayName: 'GPT-OSS-120B',
id: 'gpt-oss-120b',
maxOutput: 32_768,
@@ -719,7 +701,8 @@ const infiniaiChatModels: AIChatModelCard[] = [
},
{
contextWindowTokens: 131_072,
- description: '该模型需要申请体验。GPT-OSS-20B 是 OpenAI 推出的开源中型语言模型,具备高效的文本生成能力。',
+ description:
+ '该模型需要申请体验。GPT-OSS-20B 是 OpenAI 推出的开源中型语言模型,具备高效的文本生成能力。',
displayName: 'GPT-OSS-20B',
id: 'gpt-oss-20b',
maxOutput: 32_768,
diff --git a/packages/model-bank/src/aiModels/ollamacloud.ts b/packages/model-bank/src/aiModels/ollamacloud.ts
index ad639f5f789..44e22df5e86 100644
--- a/packages/model-bank/src/aiModels/ollamacloud.ts
+++ b/packages/model-bank/src/aiModels/ollamacloud.ts
@@ -1,6 +1,18 @@
import { AIChatModelCard } from '../types/aiModel';
const ollamaCloudModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 163_840,
+ description:
+ 'Cogito v2.1 671B 是一款可免费商用的美国开源大语言模型,它以媲美顶尖模型的性能、更高的 token 推理效率、128k 长上下文和强大的综合能力为核心优势。',
+ displayName: 'Cogito v2.1 671B',
+ id: 'cogito-2.1:671b',
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/siliconcloud.ts b/packages/model-bank/src/aiModels/siliconcloud.ts
index aaa7dfb5d04..e5469cbc3a5 100644
--- a/packages/model-bank/src/aiModels/siliconcloud.ts
+++ b/packages/model-bank/src/aiModels/siliconcloud.ts
@@ -184,67 +184,6 @@ const siliconcloudChatModels: AIChatModelCard[] = [
releasedAt: '2025-09-27',
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- },
- contextWindowTokens: 131_072,
- description:
- 'Ling-1T 是 "灵 2.0" 系列的首款旗舰级 non-thinking 模型,拥有 1 万亿总参数和每 token 约 500 亿个活动参数。基于灵 2.0 架构构建,Ling-1T 旨在突破高效推理和可扩展认知的极限。Ling-1T-base 在超过 20 万亿个高质量、推理密集的 token 上进行训练,针对大型知识密集型任务与长文档理解进行了优化,具备出色的工具调用和上下文记忆能力。',
- displayName: 'Ling 1T',
- id: 'inclusionAI/Ling-1T',
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-10-09',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 131_072,
- description:
- 'Ring-1T 是一款由百灵(Bailing)团队发布的万亿参数规模的开源思想模型。它基于 Ling 2.0 架构和 Ling-1T-base 基础模型训练,总参数量达 1 万亿,激活参数量为 500 亿,并支持高达 128K 的上下文窗口。该模型通过大规模可验证奖励强化学习进行优化。',
- displayName: 'Ring-1T',
- id: 'inclusionAI/Ring-1T',
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-10-14',
- settings: {
- extendParams: ['reasoningBudgetToken'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- },
- contextWindowTokens: 131_072,
- description:
- 'Ling-1T 是"灵 2.0"系列的首款旗舰级 non-thinking 模型,拥有 1 万亿总参数和每 token 约 500 亿个活动参数。基于灵 2.0 架构构建,Ling-1T 旨在突破高效推理和可扩展认知的极限。Ling-1T-base 在超过 20 万亿个高质量、推理密集的 token 上进行训练。',
- displayName: 'Ling-1T',
- id: 'inclusionAI/Ling-1T',
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 16, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-10-09',
- type: 'chat',
- },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/vertexai.ts b/packages/model-bank/src/aiModels/vertexai.ts
index f9e919392c0..c3d91df2ee7 100644
--- a/packages/model-bank/src/aiModels/vertexai.ts
+++ b/packages/model-bank/src/aiModels/vertexai.ts
@@ -3,6 +3,93 @@ import { imagenGenParameters, nanoBananaParameters } from './google';
// ref: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models
const vertexaiChatModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ imageOutput: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 131_072 + 32_768,
+ description:
+ 'Gemini 3 Pro Image(Nano Banana Pro)是 Google 的图像生成模型,同时支持多模态对话。',
+ displayName: 'Nano Banana Pro',
+ id: 'gemini-3-pro-image-preview',
+ maxOutput: 32_768,
+ pricing: {
+ approximatePricePerImage: 0.134,
+ units: [
+ { name: 'imageOutput', rate: 120, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ searchImpl: 'params',
+ searchProvider: 'google',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ video: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_048_576 + 65_536,
+ description:
+ 'Gemini 3 Pro 是 全球最佳的多模态理解模型,也是 Google 迄今为止最强大的智能体和氛围编程模型,提供更丰富的视觉效果和更深层次的交互性,所有这些都建立在最先进的推理能力基础之上。',
+ displayName: 'Gemini 3 Pro Preview',
+ enabled: true,
+ id: 'gemini-3-pro-preview',
+ maxOutput: 65_536,
+ pricing: {
+ units: [
+ {
+ name: 'textInput_cacheRead',
+ strategy: 'tiered',
+ tiers: [
+ { rate: 0.2, upTo: 200_000 },
+ { rate: 0.4, upTo: 'infinity' },
+ ],
+ unit: 'millionTokens',
+ },
+ {
+ name: 'textInput',
+ strategy: 'tiered',
+ tiers: [
+ { rate: 2, upTo: 200_000 },
+ { rate: 4, upTo: 'infinity' },
+ ],
+ unit: 'millionTokens',
+ },
+ {
+ name: 'textOutput',
+ strategy: 'tiered',
+ tiers: [
+ { rate: 12, upTo: 200_000 },
+ { rate: 18, upTo: 'infinity' },
+ ],
+ unit: 'millionTokens',
+ },
+ {
+ lookup: { prices: { '1h': 4.5 }, pricingParams: ['ttl'] },
+ name: 'textInput_cacheWrite',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
+ ],
+ },
+ releasedAt: '2025-11-18',
+ settings: {
+ extendParams: ['thinkingLevel', 'urlContext'],
+ searchImpl: 'params',
+ searchProvider: 'google',
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
@@ -132,7 +219,7 @@ const vertexaiChatModels: AIChatModelCard[] = [
'Nano Banana 是 Google 最新、最快、最高效的原生多模态模型,它允许您通过对话生成和编辑图像。',
displayName: 'Nano Banana',
enabled: true,
- id: 'gemini-2.5-flash-image-preview',
+ id: 'gemini-2.5-flash-image',
maxOutput: 8192,
pricing: {
approximatePricePerImage: 0.039,
diff --git a/packages/model-bank/src/aiModels/zenmux.ts b/packages/model-bank/src/aiModels/zenmux.ts
new file mode 100644
index 00000000000..60e5d87d3ac
--- /dev/null
+++ b/packages/model-bank/src/aiModels/zenmux.ts
@@ -0,0 +1,1423 @@
+import { AIChatModelCard } from '../types/aiModel';
+
+const zenmuxChatModels: AIChatModelCard[] = [
+ {
+ description:
+ 'ZenMux 的自动路由功能会根据你的请求内容,在支持的模型中自动选择当前性价比最高、表现最好的模型。',
+ displayName: 'Auto Router',
+ id: 'zenmux/auto',
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ imageOutput: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 65_536,
+ description:
+ 'Gemini 3 Pro Image(Nano Banana Pro)是 Google 的图像生成模型,同时支持多模态对话。',
+ displayName: 'Gemini 3 Pro Image (Nano Banana Pro)',
+ id: 'google/gemini-3-pro-image-preview',
+ maxOutput: 32_768,
+ pricing: {
+ units: [
+ { name: 'imageOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ imageOutput: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 65_536,
+ description: 'Gemini 3 Pro Image 免费版,支持受限额度的多模态生成。',
+ displayName: 'Gemini 3 Pro Image (Nano Banana) Free',
+ id: 'google/gemini-3-pro-image-preview-free',
+ maxOutput: 32_768,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description:
+ 'Gemini 3 Pro 是 Gemini 系列下一代多模态推理模型,可理解文本、音频、图像、视频等多种输入,并处理复杂任务与大型代码库。',
+ displayName: 'Gemini 3 Pro Preview',
+ id: 'google/gemini-3-pro-preview',
+ maxOutput: 65_530,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description:
+ 'Gemini 3 Pro 免费预览版,具备与标准版相同的多模态理解与推理能力,但受免费额度与速率限制影响,更适合作为体验与低频使用。',
+ displayName: 'Gemini 3 Pro Preview Free',
+ id: 'google/gemini-3-pro-preview-free',
+ maxOutput: 65_530,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['thinkingLevel', 'urlContext'],
+ searchImpl: 'params',
+ searchProvider: 'google',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 400_000,
+ description:
+ 'GPT-5.1 是 GPT-5 系列最新旗舰模型,相比 GPT-5 在通用推理、指令遵循和对话自然度上均有显著提升,适合广泛任务场景。',
+ displayName: 'GPT-5.1',
+ id: 'openai/gpt-5.1',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['gpt5_1ReasoningEffort', 'textVerbosity'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'GPT-5.1 Chat 是 GPT-5.1 家族的轻量成员,针对低延迟对话进行优化,同时保留较强的推理与指令执行能力。',
+ displayName: 'GPT-5.1 Chat',
+ id: 'openai/gpt-5.1-chat',
+ maxOutput: 16_380,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 400_000,
+ description:
+ 'GPT-5.1-Codex 是针对软件工程和编码工作流优化的 GPT-5.1 变体,适合大型重构、复杂调试与长时间自主编码任务。',
+ displayName: 'GPT-5.1-Codex',
+ id: 'openai/gpt-5.1-codex',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['gpt5_1ReasoningEffort'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 400_000,
+ description:
+ 'GPT-5.1-Codex-Mini 是 GPT-5.1-Codex 的小型加速版本,更适合对延迟和成本敏感的编码场景。',
+ displayName: 'GPT-5.1-Codex-Mini',
+ id: 'openai/gpt-5.1-codex-mini',
+ maxOutput: 100_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['gpt5_1ReasoningEffort'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 2_000_000,
+ description:
+ 'Grok 4 Fast 是 xAI 的高吞吐、低成本模型(支持 2M 上下文窗口),适合需要高并发与长上下文的使用场景。',
+ displayName: 'Grok 4.1 Fast',
+ id: 'x-ai/grok-4.1-fast',
+ maxOutput: 30_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ vision: true,
+ },
+ contextWindowTokens: 2_000_000,
+ description:
+ 'Grok 4 Fast(Non-Reasoning)是 xAI 的高吞吐、低成本多模态模型(支持 2M 上下文窗口),面向对延迟和成本敏感但不需要启用模型内推理的场景。它与 Grok 4 Fast 的 reasoning 版本并列,可通过 API 的 reasoning enable 参数在需要时开启推理功能。Prompts 和 completions 可能会被 xAI 或 OpenRouter 用于改进未来模型。',
+ displayName: 'Grok 4.1 Fast (Non-Reasoning)',
+ id: 'x-ai/grok-4.1-fast-non-reasoning',
+ maxOutput: 30_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 2_000_000,
+ description:
+ 'Grok 4 Fast 是 xAI 的高吞吐、低成本模型(支持 2M 上下文窗口),适合需要高并发与长上下文的使用场景。',
+ displayName: 'Grok 4 Fast',
+ id: 'x-ai/grok-4-fast',
+ maxOutput: 30_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ vision: true,
+ },
+ contextWindowTokens: 2_000_000,
+ description:
+ 'Grok 4 Fast(Non-Reasoning)是 xAI 的高吞吐、低成本多模态模型(支持 2M 上下文窗口),面向对延迟和成本敏感但不需要启用模型内推理的场景。它与 Grok 4 Fast 的 reasoning 版本并列,可通过 API 的 reasoning enable 参数在需要时开启推理功能。Prompts 和 completions 可能会被 xAI 或 OpenRouter 用于改进未来模型。',
+ displayName: 'Grok 4 Fast (Non-Reasoning)',
+ id: 'x-ai/grok-4-fast-non-reasoning',
+ maxOutput: 30_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 256_000,
+ description: 'Grok 4 是 xAI 的旗舰推理模型,提供强大的推理与多模态能力。',
+ displayName: 'Grok 4',
+ id: 'x-ai/grok-4',
+ maxOutput: 256_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 256_000,
+ description: 'Grok Code Fast 1 是 xAI 的快速代码模型,输出具可读性与工程化适配。',
+ displayName: 'Grok Code Fast 1',
+ id: 'x-ai/grok-code-fast-1',
+ maxOutput: 10_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'ERNIE 5.0 Thinking Preview 是百度新一代原生多模态文心模型,擅长多模态理解、指令遵循、创作、事实问答与工具调用。',
+ displayName: 'ERNIE-5.0-Thinking-Preview',
+ id: 'baidu/ernie-5.0-thinking-preview',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.84, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 3.37, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 256_000,
+ description:
+ 'Doubao-Seed-Code 是字节火山引擎面向 Agentic Programming 优化的大模型,在多项编程与代理基准上表现优异,支持 256K 上下文。',
+ displayName: 'Doubao-Seed-Code',
+ id: 'volcengine/doubao-seed-code',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.17, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.12, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 262_144,
+ description:
+ 'Kimi K2 Thinking 是 Moonshot 针对深度推理任务优化的思考模型,具备通用 Agent 能力。',
+ displayName: 'Kimi K2 Thinking',
+ id: 'moonshotai/kimi-k2-thinking',
+ maxOutput: 262_144,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 262_144,
+ description:
+ 'Kimi K2 Thinking Turbo 是 Kimi K2 Thinking 的高速版本,在保持深度推理能力的同时,显著降低响应延迟。',
+ displayName: 'Kimi K2 Thinking Turbo',
+ id: 'moonshotai/kimi-k2-thinking-turbo',
+ maxOutput: 262_144,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.15, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 65_536,
+ description:
+ 'Ming-flash-omni Preview 是 inclusionAI 的多模态模型,支持语音、图像和视频输入,优化了图像渲染与语音识别能力。',
+ displayName: 'Ming-flash-omini Preview',
+ id: 'inclusionai/ming-flash-omini-preview',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.8, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'Ring-1T 是 inclusionAI 的 trillion-parameter MoE 思考模型,适合大规模推理与研究类任务。',
+ displayName: 'Ring-1T',
+ id: 'inclusionai/ring-1t',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.56, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.24, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'Ling-1T 是 inclusionAI 的 1T MoE 大模型,针对高强度推理任务与大规模上下文进行了优化。',
+ displayName: 'Ling-1T',
+ id: 'inclusionai/ling-1t',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.56, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.24, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'Ling-flash-2.0 是 inclusionAI 的 MoE 模型,优化了效率与推理表现,适合中大型任务。',
+ displayName: 'Ling-flash-2.0',
+ id: 'inclusionai/ling-flash-2.0',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.8, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'Ring-flash-2.0 是 inclusionAI 面向高吞吐场景的 Ring 模型变体,强调速度与成本效率。',
+ displayName: 'Ring-flash-2.0',
+ id: 'inclusionai/ring-flash-2.0',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.8, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'Ling-mini-2.0 是 inclusionAI 的轻量化 MoE 模型,在保持推理能力的同时显著降低成本。',
+ displayName: 'Ling-mini-2.0',
+ id: 'inclusionai/ling-mini-2.0',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.07, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description: 'Ring-mini-2.0 是 inclusionAI 的高吞吐轻量化 MoE 版本,主要用于并发场景。',
+ displayName: 'Ring-mini-2.0',
+ id: 'inclusionai/ring-mini-2.0',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.07, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.7, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 204_800,
+ description: 'MiniMax-M2 是一款在编码与代理任务上表现出色的高性价比模型,适合多种工程场景。',
+ displayName: 'MiniMax M2',
+ id: 'minimax/minimax-m2',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ contextWindowTokens: 256_000,
+ description: 'KAT-Coder-Pro-V1(限时免费)专注于代码理解与自动化编程,用于高效的编程代理任务。',
+ displayName: 'KAT-Coder-Pro-V1 (Limited-time Free)',
+ id: 'kuaishou/kat-coder-pro-v1',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 200_000,
+ description:
+ 'Claude Haiku 4.5 是 Anthropic 的高性能快速模型,在保持较高准确性的同时具有极低延迟。',
+ displayName: 'Claude Haiku 4.5',
+ id: 'anthropic/claude-haiku-4.5',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['enableReasoning', 'reasoningBudgetToken'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description: 'DeepSeek-V3 是 DeepSeek 团队的一款高性能混合推理模型,适合复杂任务与工具集成。',
+ displayName: 'DeepSeek-V3.2-Exp (Non-thinking Mode)',
+ id: 'deepseek/deepseek-chat',
+ maxOutput: 8000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.56, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.68, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'DeepSeek-V3 Thinking(reasoner)是 DeepSeek 的实验 reasoning 模型,适合高复杂度推理任务。',
+ displayName: 'DeepSeek-V3.2-Exp (Thinking Mode)',
+ id: 'deepseek/deepseek-reasoner',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.42, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 64_000,
+ description: 'DeepSeek R1 0528 是 DeepSeek 的更新变体,注重开源可用与推理深度。',
+ displayName: 'DeepSeek R1 0528',
+ id: 'deepseek/deepseek-r1-0528',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.56, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.23, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description: 'Gemini 2.5 Pro 是 Google 的旗舰级推理模型,支持长上下文与复杂任务。',
+ displayName: 'Gemini 2.5 Pro',
+ id: 'google/gemini-2.5-pro',
+ maxOutput: 65_530,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['thinkingBudget', 'urlContext'],
+ searchImpl: 'params',
+ searchProvider: 'google',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description: 'Gemini 2.5 Pro 免费版,支持受限额度的多模态长上下文,适合试用与轻量工作流。',
+ displayName: 'Gemini 2.5 Pro Free',
+ id: 'google/gemini-2.5-pro-free',
+ maxOutput: 65_530,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['thinkingBudget', 'urlContext'],
+ searchImpl: 'params',
+ searchProvider: 'google',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description: 'Gemini 2.5 Flash(Lite/Pro/Flash)系列是 Google 的中低延迟到高性能推理模型。',
+ displayName: 'Gemini 2.5 Flash',
+ id: 'google/gemini-2.5-flash',
+ maxOutput: 65_530,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['thinkingBudget', 'urlContext'],
+ searchImpl: 'params',
+ searchProvider: 'google',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 400_000,
+ description:
+ 'GPT-5 Pro 是 OpenAI 的旗舰模型,提供更强的推理、代码生成与企业级功能,支持测试时路由与更严谨的安全策略。',
+ displayName: 'GPT-5 Pro',
+ id: 'openai/gpt-5-pro',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 120, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['textVerbosity'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 400_000,
+ description: 'GPT-5 是 OpenAI 的高性能模型,适用广泛的生产与研究任务。',
+ displayName: 'GPT-5',
+ id: 'openai/gpt-5',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['gpt5ReasoningEffort', 'textVerbosity'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description: 'GPT-5 Chat 是为对话场景优化的 GPT-5 子型号,降低延迟以提升交互体验。',
+ displayName: 'GPT-5 Chat',
+ id: 'openai/gpt-5-chat',
+ maxOutput: 16_380,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 400_000,
+ description: 'GPT-5 Mini 是 GPT-5 家族的精简版,适用于低延迟低成本场景。',
+ displayName: 'GPT-5 Mini',
+ id: 'openai/gpt-5-mini',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['gpt5ReasoningEffort', 'textVerbosity'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 400_000,
+ description: 'GPT-5 Nano 是家族中的超小型版本,适合对成本和延迟要求非常高的场景。',
+ displayName: 'GPT-5 Nano',
+ id: 'openai/gpt-5-nano',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.05, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['gpt5ReasoningEffort', 'textVerbosity'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 400_000,
+ description: 'GPT-5-Codex 是针对编码场景进一步优化的 GPT-5 变体,适合大规模代码工作流。',
+ displayName: 'GPT-5 Codex',
+ id: 'openai/gpt-5-codex',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['gpt5ReasoningEffort', 'textVerbosity'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description: 'GPT-4.1 系列提供了更大上下文与更强的工程与推理能力。',
+ displayName: 'GPT-4.1',
+ id: 'openai/gpt-4.1',
+ maxOutput: 32_770,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description: 'GPT-4.1 Mini 提供更低延迟与更佳性价比,适合中等上下文上下线路。',
+ displayName: 'GPT-4.1 Mini',
+ id: 'openai/gpt-4.1-mini',
+ maxOutput: 32_770,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description: 'GPT-4.1 Nano 是极低成本低延迟选项,适合高频次短对话或分类场景。',
+ displayName: 'GPT-4.1 Nano',
+ id: 'openai/gpt-4.1-nano',
+ maxOutput: 32_770,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 262_144,
+ description: 'Qwen3 Max (preview) 是 Qwen 系列面向高级推理与工具集成的 Max 版本(预览)。',
+ displayName: 'Qwen3 Max Thinking Preview',
+ id: 'qwen/qwen3-max-preview',
+ maxOutput: 65_540,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 262_144,
+ description: 'Qwen3 Max 是 Qwen3 系列的高端推理模型,适合多语言推理和工具集成。',
+ displayName: 'Qwen3 Max',
+ id: 'qwen/qwen3-max',
+ maxOutput: 65_540,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 262_144,
+ description: 'Qwen3 VL-Plus 为 Qwen3 的视觉增强版本,提升了多模态推理与视频处理的能力。',
+ displayName: 'Qwen3-VL-Plus',
+ id: 'qwen/qwen3-vl-plus',
+ maxOutput: 32_770,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 1_000_000,
+ description:
+ 'Qwen3-Coder-Plus 为 Qwen 系列特别优化的编码代理模型,支持更复杂的工具调用与长期会话。',
+ displayName: 'Qwen3-Coder-Plus',
+ id: 'qwen/qwen3-coder-plus',
+ maxOutput: 65_540,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 256_000,
+ description: 'Qwen3-Coder 是 Qwen3 的代码生成器家族,擅长长文档内的代码理解与生成。',
+ displayName: 'Qwen3-Coder',
+ id: 'qwen/qwen3-coder',
+ maxOutput: 261_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 5.01, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 32_000,
+ description: 'Qwen3-14B 是 Qwen 系列的 14B 版本,适合常规推理与对话场景。',
+ displayName: 'Qwen3 14B',
+ id: 'qwen/qwen3-14b',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.14, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 200_000,
+ description: 'GLM 4.6 是 Z.AI 的旗舰模型,扩展了上下文长度和编码能力。',
+ displayName: 'GLM 4.6',
+ id: 'z-ai/glm-4.6',
+ maxOutput: 128_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.35, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.54, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 200_000,
+ description: 'Opus 4.1 是 Anthropic 的高端模型,优化于编程、复杂推理和持续任务。',
+ displayName: 'Claude Opus 4.1',
+ id: 'anthropic/claude-opus-4.1',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 75, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['enableReasoning', 'reasoningBudgetToken'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 200_000,
+ description: 'Opus 4 是 Anthropic 的旗舰级模型,专为复杂任务和企业级应用设计。',
+ displayName: 'Claude Opus 4',
+ id: 'anthropic/claude-opus-4',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 75, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['enableReasoning', 'reasoningBudgetToken'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ imageOutput: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 32_768,
+ description:
+ 'Gemini 2.5 Flash Image(Nano Banana)是 Google 的图像生成模型,同时支持多模态对话。',
+ displayName: 'Gemini 2.5 Flash Image (Nano Banana)',
+ id: 'google/gemini-2.5-flash-image',
+ maxOutput: 8192,
+ pricing: {
+ approximatePricePerImage: 0.039,
+ units: [
+ { name: 'imageOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ imageOutput: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 32_768,
+ description: 'Gemini 2.5 Flash Image 免费版,支持受限额度的多模态生成。',
+ displayName: 'Gemini 2.5 Flash Image (Nano Banana) Free',
+ id: 'google/gemini-2.5-flash-image-free',
+ maxOutput: 8192,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 200_000,
+ description: 'Claude Sonnet 4.5 是 Anthropic 最新的混合推理模型,优化于复杂推理和编码。',
+ displayName: 'Claude Sonnet 4.5',
+ id: 'anthropic/claude-sonnet-4.5',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['enableReasoning', 'reasoningBudgetToken'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 1_000_000,
+ description: 'Claude Sonnet 4 是 Anthropic 的混合推理版本,提供思维/非思维混合能力。',
+ displayName: 'Claude Sonnet 4',
+ id: 'anthropic/claude-sonnet-4',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 200_000,
+ description: 'OpenAI o4-mini 是 OpenAI 的小型高效推理模型,适合低延迟场景。',
+ displayName: 'o4 Mini',
+ id: 'openai/o4-mini',
+ maxOutput: 100_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 1.1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['reasoningEffort'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description: 'GPT-4o 系列是 OpenAI 的 Omni 模型,支持文本 + 图片输入与文本输出。',
+ displayName: 'GPT-4o',
+ id: 'openai/gpt-4o',
+ maxOutput: 16_380,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description: 'GPT-4o-mini 是 GPT-4o 的快速小模型版本,适合低延迟图文混合场景。',
+ displayName: 'GPT-4o-mini',
+ id: 'openai/gpt-4o-mini',
+ maxOutput: 16_380,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description: 'Kimi K2 0711 是 Kimi 系列的 Instruct 版本,适合高质量代码与工具调用场景。',
+ displayName: 'Kimi K2 0711',
+ id: 'moonshotai/kimi-k2-0711',
+ maxOutput: 32_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.56, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.23, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 128_000,
+ description: 'GLM 4.5 Air 是 GLM 4.5 的轻量化版本,适合成本敏感场景但保留强推理能力。',
+ displayName: 'GLM 4.5 Air',
+ id: 'z-ai/glm-4.5-air',
+ maxOutput: 96_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.11, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.56, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 200_000,
+ description:
+ 'Claude 3.5 Haiku features enhanced capabilities in speed, coding accuracy, and tool use. 适用于对速度与工具交互有高要求的场景。',
+ displayName: 'Claude 3.5 Haiku',
+ id: 'anthropic/claude-3.5-haiku',
+ maxOutput: 8192,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 200_000,
+ description:
+ 'Claude 3.5 Sonnet 是 Sonnet 家族的快速高效模型,提供更好的编码与推理性能,部分版本将逐步被 Sonnet 3.7 等替代。',
+ displayName: 'Claude 3.5 Sonnet',
+ id: 'anthropic/claude-3.5-sonnet',
+ maxOutput: 8192,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 200_000,
+ description:
+ 'Claude 3.7 Sonnet 是 Sonnet 系列的升级版,提供更强的推理与编码能力,适用于企业级复杂任务。',
+ displayName: 'Claude 3.7 Sonnet',
+ id: 'anthropic/claude-3.7-sonnet',
+ maxOutput: 64_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ },
+ contextWindowTokens: 128_000,
+ description:
+ 'DeepSeek-V3.1 是 DeepSeek 的长上下文混合推理模型,支持思考/非思考混合模式与工具集成。',
+ displayName: 'DeepSeek V3.1',
+ id: 'deepseek/deepseek-chat-v3.1',
+ maxOutput: 65_540,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.11, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description: 'Gemini 2.0 Flash 是 Google 的高性能推理模型,适用于延展的多模态任务。',
+ displayName: 'Gemini 2.0 Flash',
+ id: 'google/gemini-2.0-flash',
+ maxOutput: 8192,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description:
+ 'Gemini 2.0 Flash Lite 是 Gemini 家族的轻量版本,默认不启用思考以提升延迟与成本表现,但可通过参数开启。',
+ displayName: 'Gemini 2.0 Flash Lite',
+ id: 'google/gemini-2.0-flash-lite-001',
+ maxOutput: 8192,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.075, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 1_050_000,
+ description:
+ 'Gemini 2.5 Flash Lite 是 Gemini 2.5 的轻量版本,优化了延迟与成本,适合高吞吐场景。',
+ displayName: 'Gemini 2.5 Flash Lite',
+ id: 'google/gemini-2.5-flash-lite',
+ maxOutput: 65_530,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 262_144,
+ description: 'Kimi K2 0905 是 Kimi 系列的 0905 更新,扩充了上下文与推理性能,优化了编码场景。',
+ displayName: 'Kimi K2 0905',
+ id: 'moonshotai/kimi-k2-0905',
+ maxOutput: 262_144,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 256_000,
+ description:
+ 'Qwen3-235B-A22B-Instruct-2507 为 Qwen3 系列的 Instruct 版本,兼顾多语言指令与长上下文场景。',
+ displayName: 'Qwen3 235B A22B Instruct 2507',
+ id: 'qwen/qwen3-235b-a22b-2507',
+ maxOutput: 262_100,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.11, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ },
+ contextWindowTokens: 256_000,
+ description:
+ 'Qwen3-235B-A22B-Thinking-2507 为 Qwen3 的 Thinking 变体,针对复杂数学与推理任务进行了强化。',
+ displayName: 'Qwen3 235B A22B Thinking 2507',
+ id: 'qwen/qwen3-235b-a22b-thinking-2507',
+ maxOutput: 262_100,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.78, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: { reasoning: true },
+ contextWindowTokens: 128_000,
+ description: 'GLM 4.5 是 Z.AI 的旗舰模型,支持混合推理模式并优化于工程与长上下文任务。',
+ displayName: 'GLM 4.5',
+ id: 'z-ai/glm-4.5',
+ maxOutput: 96_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.35, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 1.54, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
+];
+
+export const allModels = [...zenmuxChatModels];
+
+export default allModels;
diff --git a/packages/model-bank/src/const/modelProvider.ts b/packages/model-bank/src/const/modelProvider.ts
index dec2b0c6b58..3eaa79b651c 100644
--- a/packages/model-bank/src/const/modelProvider.ts
+++ b/packages/model-bank/src/const/modelProvider.ts
@@ -64,6 +64,7 @@ export enum ModelProvider {
Wenxin = 'wenxin',
XAI = 'xai',
Xinference = 'xinference',
+ ZenMux = 'zenmux',
ZeroOne = 'zeroone',
ZhiPu = 'zhipu',
}
diff --git a/packages/model-bank/src/standard-parameters/index.ts b/packages/model-bank/src/standard-parameters/index.ts
index a9480d179f6..c3dfc0ebfb3 100644
--- a/packages/model-bank/src/standard-parameters/index.ts
+++ b/packages/model-bank/src/standard-parameters/index.ts
@@ -149,6 +149,15 @@ export const ModelParamsMetaSchema = z.object({
})
.optional(),
+ resolution: z
+ .object({
+ default: z.string(),
+ description: z.string().optional(),
+ enum: z.array(z.string()),
+ type: z.literal('string').optional(),
+ })
+ .optional(),
+
cfg: z
.object({
default: z.number(),
diff --git a/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts b/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts
index 7028c347a0a..45f90f14bc4 100644
--- a/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts
+++ b/packages/model-runtime/src/core/openaiCompatibleFactory/index.test.ts
@@ -426,7 +426,7 @@ describe('LobeOpenAICompatibleFactory', () => {
'data: "Hello"\n\n',
'id: a\n',
'event: usage\n',
- 'data: {"inputTextTokens":5,"outputTextTokens":5,"totalInputTokens":5,"totalOutputTokens":5,"totalTokens":10}\n\n',
+ 'data: {"inputTextTokens":5,"outputTextTokens":5,"totalInputTokens":5,"totalOutputTokens":5,"totalTokens":10,"cost":0.000005}\n\n',
'id: output_speed\n',
'event: speed\n',
expect.stringMatching(/^data: {.*"tps":.*,"ttft":.*}\n\n$/), // tps ttft should be calculated with elapsed time
@@ -601,7 +601,7 @@ describe('LobeOpenAICompatibleFactory', () => {
signal: controller.signal,
}),
);
- });
+ }, 10000);
});
describe('Error', () => {
diff --git a/packages/model-runtime/src/core/streams/google/index.ts b/packages/model-runtime/src/core/streams/google/index.ts
index a4b0ef2d154..cc437f664e7 100644
--- a/packages/model-runtime/src/core/streams/google/index.ts
+++ b/packages/model-runtime/src/core/streams/google/index.ts
@@ -148,7 +148,8 @@ const transformGoogleGenerativeAIStream = (
// Check for image data before handling finishReason
if (Array.isArray(candidate.content?.parts) && candidate.content.parts.length > 0) {
- const part = candidate.content.parts[0];
+ // Filter out reasoning content and get first non-reasoning part
+ const part = candidate.content.parts.find((p: any) => !p.thought);
if (part && part.inlineData && part.inlineData.data && part.inlineData.mimeType) {
const imageChunk = {
@@ -182,7 +183,11 @@ const transformGoogleGenerativeAIStream = (
...usageChunks,
].filter(Boolean) as StreamProtocolChunk[];
}
- return { data: candidate.finishReason, id: context?.id, type: 'stop' };
+ // 当有 finishReason 但没有 text 内容时,发送一个空的 text 块以停止加载动画
+ return [
+ { data: '', id: context?.id, type: 'text' },
+ { data: candidate.finishReason, id: context?.id, type: 'stop' },
+ ];
}
if (!!text?.trim()) return { data: text, id: context?.id, type: 'text' };
diff --git a/packages/model-runtime/src/core/streams/openai/__snapshots__/responsesStream.test.ts.snap b/packages/model-runtime/src/core/streams/openai/__snapshots__/responsesStream.test.ts.snap
index a32c9335c6c..566f08eb1fe 100644
--- a/packages/model-runtime/src/core/streams/openai/__snapshots__/responsesStream.test.ts.snap
+++ b/packages/model-runtime/src/core/streams/openai/__snapshots__/responsesStream.test.ts.snap
@@ -858,10 +858,10 @@ exports[`OpenAIResponsesStream Reasoning summary 1`] = `
]
`;
-exports[`OpenAIResponsesStream should transform OpenAI stream to protocol stream 1`] = `
+exports[`OpenAIResponsesStream should handle chunks with undefined values gracefully 1`] = `
[
-"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
+"id: resp_undefined_vals
"
,
@@ -874,74 +874,58 @@ exports[`OpenAIResponsesStream should transform OpenAI stream to protocol stream
"
,
-"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
+"id: undefined
"
,
-"event: data
+"event: reasoning
"
,
-"data: {"type":"response.in_progress","response":{"id":"resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58","object":"response","created_at":1748925324,"status":"in_progress","error":null,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"model":"o4-mini","output":[],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":"medium","summary":null},"service_tier":"auto","store":false,"temperature":1,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[{"type":"function","description":"a search service. Useful for when you need to answer questions about current events. Input should be a search query. Output is a JSON array of the query results","name":"lobe-web-browsing____search____builtin","parameters":{"properties":{"query":{"description":"The search query","type":"string"},"searchCategories":{"description":"The search categories you can set:","items":{"enum":["general","images","news","science","videos"],"type":"string"},"type":"array"},"searchEngines":{"description":"The search engines you can use:","items":{"enum":["google","bilibili","bing","duckduckgo","npm","pypi","github","arxiv","google scholar","z-library","reddit","imdb","brave","wikipedia","pinterest","unsplash","vimeo","youtube"],"type":"string"},"type":"array"},"searchTimeRange":{"description":"The time range you can set:","enum":["anytime","day","week","month","year"],"type":"string"}},"required":["query"],"type":"object"},"strict":true},{"type":"function","description":"A crawler can visit page content. Output is a JSON object of title, content, url and website","name":"lobe-web-browsing____crawlSinglePage____builtin","parameters":{"properties":{"url":{"description":"The url need to be crawled","type":"string"}},"required":["url"],"type":"object"},"strict":true},{"type":"function","description":"A crawler can visit multi pages. If need to visit multi website, use this one. Output is an array of JSON object of title, content, url and website","name":"lobe-web-browsing____crawlMultiPages____builtin","parameters":{"properties":{"urls":{"items":{"description":"The urls need to be crawled","type":"string"},"type":"array"}},"required":["urls"],"type":"object"},"strict":true}],"top_p":1,"truncation":"disabled","usage":null,"user":null,"metadata":{}}}
+"data: undefined
"
,
-
-"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
-"
-,
-
-"event: data
-"
-,
-
-"data: {"id":"rs_683e7bc80a9c81908f6e3d61ad63cc1e0cf93af363cdcf58","type":"reasoning","summary":[]}
+]
+`;
-"
-,
+exports[`OpenAIResponsesStream should handle first chunk error with FIRST_CHUNK_ERROR_KEY 1`] = `
+[
-"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
+"id: first_chunk_error
"
,
-"event: data
+"event: error
"
,
-"data: {"id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","type":"message","status":"in_progress","content":[],"role":"assistant"}
+"data: {"body":{"message":"Invalid API key","errorType":"InvalidProviderAPIKey"},"message":"Invalid API key","type":"InvalidProviderAPIKey"}
"
,
-
-"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
-"
-,
-
-"event: data
-"
-,
-
-"data: {"type":"response.content_part.added","item_id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","output_index":1,"content_index":0,"part":{"type":"output_text","annotations":[],"text":"Hello"}}
+]
+`;
-"
-,
+exports[`OpenAIResponsesStream should handle first chunk error with message object 1`] = `
+[
-"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
+"id: first_chunk_error
"
,
-"event: data
+"event: error
"
,
-"data: {"type":"response.content_part.added","item_id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","output_index":1,"content_index":0,"part":{"type":"output_text","annotations":[],"text":" world"}}
+"data: {"body":{"message":{"error":"API quota exceeded","code":429}},"message":"{\\"message\\":{\\"error\\":\\"API quota exceeded\\",\\"code\\":429}}","type":"ProviderBizError"}
"
,
]
`;
-exports[`OpenAIResponsesStream should handle first chunk error with FIRST_CHUNK_ERROR_KEY 1`] = `
+exports[`OpenAIResponsesStream should handle first chunk error without message 1`] = `
[
"id: first_chunk_error
@@ -952,53 +936,48 @@ exports[`OpenAIResponsesStream should handle first chunk error with FIRST_CHUNK_
"
,
-"data: {"body":{"message":"Invalid API key","errorType":"InvalidProviderAPIKey"},"message":"Invalid API key","type":"InvalidProviderAPIKey"}
+"data: {"body":{"code":"rate_limit_exceeded","status":429},"message":"{\\"code\\":\\"rate_limit_exceeded\\",\\"status\\":429}","type":"ProviderBizError"}
"
,
]
`;
-exports[`OpenAIResponsesStream should handle first chunk error with message object 1`] = `
+exports[`OpenAIResponsesStream should handle function_call in response.output_item.added 1`] = `
[
-"id: first_chunk_error
+"id: resp_test_456
"
,
-"event: error
+"event: data
"
,
-"data: {"body":{"message":{"error":"API quota exceeded","code":429}},"message":"{\\"message\\":{\\"error\\":\\"API quota exceeded\\",\\"code\\":429}}","type":"ProviderBizError"}
+"data: "in_progress"
"
,
-]
-`;
-
-exports[`OpenAIResponsesStream should handle first chunk error without message 1`] = `
-[
-"id: first_chunk_error
+"id: resp_test_456
"
,
-"event: error
+"event: tool_calls
"
,
-"data: {"body":{"code":"rate_limit_exceeded","status":429},"message":"{\\"code\\":\\"rate_limit_exceeded\\",\\"status\\":429}","type":"ProviderBizError"}
+"data: [{"function":{"arguments":"{\\"location\\": \\"San Francisco\\"}","name":"get_weather"},"id":"call_abc123","index":0,"type":"function"}]
"
,
]
`;
-exports[`OpenAIResponsesStream should handle response.created event 1`] = `
+exports[`OpenAIResponsesStream should handle multiple annotations and accumulate citations 1`] = `
[
-"id: resp_test_123
+"id: resp_multi_citation
"
,
@@ -1010,34 +989,29 @@ exports[`OpenAIResponsesStream should handle response.created event 1`] = `
"
,
-]
-`;
-
-exports[`OpenAIResponsesStream should handle function_call in response.output_item.added 1`] = `
-[
-"id: resp_test_456
+"id: msg_cite
"
,
-"event: data
+"event: text
"
,
-"data: "in_progress"
+"data: null
"
,
-"id: resp_test_456
+"id: msg_cite
"
,
-"event: tool_calls
+"event: text
"
,
-"data: [{"function":{"arguments":"{\\"location\\": \\"San Francisco\\"}","name":"get_weather"},"id":"call_abc123","index":0,"type":"function"}]
+"data: null
"
,
@@ -1088,10 +1062,10 @@ exports[`OpenAIResponsesStream should handle multiple function_calls with increm
]
`;
-exports[`OpenAIResponsesStream should handle response.function_call_arguments.delta 1`] = `
+exports[`OpenAIResponsesStream should handle non-standard item types in output_item.added 1`] = `
[
-"id: resp_delta_test
+"id: resp_other_item
"
,
@@ -1104,38 +1078,56 @@ exports[`OpenAIResponsesStream should handle response.function_call_arguments.de
"
,
-"id: resp_delta_test
+"id: resp_other_item
"
,
-"event: tool_calls
+"event: data
"
,
-"data: [{"function":{"arguments":"{\\"query\\":","name":"search_web"},"id":"call_delta","index":0,"type":"function"}]
+"data: {"type":"message","id":"msg_test","status":"in_progress","content":[],"role":"assistant"}
"
,
+]
+`;
+
+exports[`OpenAIResponsesStream should handle response.completed with usage 1`] = `
+[
-"id: resp_delta_test
+"id: resp_completed_usage
"
,
-"event: tool_calls
+"event: data
"
,
-"data: [{"function":{"arguments":" \\"OpenAI\\"}","name":"search_web"},"id":"call_delta","index":0,"type":"function"}]
+"data: "in_progress"
+
+"
+,
+
+"id: resp_completed_usage
+"
+,
+
+"event: usage
+"
+,
+
+"data: {"inputCacheMissTokens":100,"inputTextTokens":100,"outputTextTokens":50,"totalInputTokens":100,"totalOutputTokens":50,"totalTokens":150}
"
,
]
`;
-exports[`OpenAIResponsesStream should handle response.output_text.delta 1`] = `
+exports[`OpenAIResponsesStream should handle response.completed without usage 1`] = `
[
-"id: resp_text_delta
+"id: resp_completed_no_usage
"
,
@@ -1148,38 +1140,43 @@ exports[`OpenAIResponsesStream should handle response.output_text.delta 1`] = `
"
,
-"id: msg_123
+"id: resp_completed_no_usage
"
,
-"event: text
+"event: data
"
,
-"data: "Hello "
+"data: {"type":"response.completed","response":{"id":"resp_completed_no_usage","status":"completed"}}
"
,
+]
+`;
+
+exports[`OpenAIResponsesStream should handle response.created event 1`] = `
+[
-"id: msg_123
+"id: resp_test_123
"
,
-"event: text
+"event: data
"
,
-"data: "world!"
+"data: "in_progress"
"
,
]
`;
-exports[`OpenAIResponsesStream should handle response.reasoning_summary_part.added for first part 1`] = `
+exports[`OpenAIResponsesStream should handle response.function_call_arguments.delta 1`] = `
[
-"id: resp_reasoning
+"id: resp_delta_test
"
,
@@ -1192,25 +1189,38 @@ exports[`OpenAIResponsesStream should handle response.reasoning_summary_part.add
"
,
-"id: reasoning_1
+"id: resp_delta_test
"
,
-"event: reasoning
+"event: tool_calls
"
,
-"data: ""
+"data: [{"function":{"arguments":"{\\"query\\":","name":"search_web"},"id":"call_delta","index":0,"type":"function"}]
+
+"
+,
+
+"id: resp_delta_test
+"
+,
+
+"event: tool_calls
+"
+,
+
+"data: [{"function":{"arguments":" \\"OpenAI\\"}","name":"search_web"},"id":"call_delta","index":0,"type":"function"}]
"
,
]
`;
-exports[`OpenAIResponsesStream should handle response.reasoning_summary_part.added for subsequent parts 1`] = `
+exports[`OpenAIResponsesStream should handle response.output_item.done with citations 1`] = `
[
-"id: resp_reasoning_multi
+"id: resp_done_citation
"
,
@@ -1223,38 +1233,38 @@ exports[`OpenAIResponsesStream should handle response.reasoning_summary_part.add
"
,
-"id: reasoning_1
+"id: msg_final
"
,
-"event: reasoning
+"event: text
"
,
-"data: ""
+"data: null
"
,
-"id: reasoning_2
+"id: msg_final
"
,
-"event: reasoning
+"event: grounding
"
,
-"data: "\\n"
+"data: {"citations":[{"title":"Citation Title","url":"https://citation.com"}]}
"
,
]
`;
-exports[`OpenAIResponsesStream should handle response.reasoning_summary_text.delta 1`] = `
+exports[`OpenAIResponsesStream should handle response.output_item.done without citations 1`] = `
[
-"id: resp_reasoning_delta
+"id: resp_done_no_citation
"
,
@@ -1267,28 +1277,15 @@ exports[`OpenAIResponsesStream should handle response.reasoning_summary_text.del
"
,
-"id: reasoning_123
-"
-,
-
-"event: reasoning
-"
-,
-
-"data: "Thinking about"
-
-"
-,
-
-"id: reasoning_123
+"id: msg_no_cite
"
,
-"event: reasoning
+"event: text
"
,
-"data: " the problem..."
+"data: null
"
,
@@ -1326,10 +1323,10 @@ exports[`OpenAIResponsesStream should handle response.output_text.annotation.add
]
`;
-exports[`OpenAIResponsesStream should handle multiple annotations and accumulate citations 1`] = `
+exports[`OpenAIResponsesStream should handle response.output_text.delta 1`] = `
[
-"id: resp_multi_citation
+"id: resp_text_delta
"
,
@@ -1342,7 +1339,7 @@ exports[`OpenAIResponsesStream should handle multiple annotations and accumulate
"
,
-"id: msg_cite
+"id: msg_123
"
,
@@ -1350,12 +1347,12 @@ exports[`OpenAIResponsesStream should handle multiple annotations and accumulate
"
,
-"data: null
+"data: "Hello "
"
,
-"id: msg_cite
+"id: msg_123
"
,
@@ -1363,17 +1360,17 @@ exports[`OpenAIResponsesStream should handle multiple annotations and accumulate
"
,
-"data: null
+"data: "world!"
"
,
]
`;
-exports[`OpenAIResponsesStream should handle response.output_item.done with citations 1`] = `
+exports[`OpenAIResponsesStream should handle response.reasoning_summary_part.added for first part 1`] = `
[
-"id: resp_done_citation
+"id: resp_reasoning
"
,
@@ -1386,69 +1383,69 @@ exports[`OpenAIResponsesStream should handle response.output_item.done with cita
"
,
-"id: msg_final
+"id: reasoning_1
"
,
-"event: text
+"event: reasoning
"
,
-"data: null
+"data: ""
"
,
+]
+`;
+
+exports[`OpenAIResponsesStream should handle response.reasoning_summary_part.added for subsequent parts 1`] = `
+[
-"id: msg_final
+"id: resp_reasoning_multi
"
,
-"event: grounding
+"event: data
"
,
-"data: {"citations":[{"title":"Citation Title","url":"https://citation.com"}]}
+"data: "in_progress"
"
,
-]
-`;
-
-exports[`OpenAIResponsesStream should handle response.output_item.done without citations 1`] = `
-[
-"id: resp_done_no_citation
+"id: reasoning_1
"
,
-"event: data
+"event: reasoning
"
,
-"data: "in_progress"
+"data: ""
"
,
-"id: msg_no_cite
+"id: reasoning_2
"
,
-"event: text
+"event: reasoning
"
,
-"data: null
+"data: "\\n"
"
,
]
`;
-exports[`OpenAIResponsesStream should handle response.completed with usage 1`] = `
+exports[`OpenAIResponsesStream should handle response.reasoning_summary_text.delta 1`] = `
[
-"id: resp_completed_usage
+"id: resp_reasoning_delta
"
,
@@ -1461,25 +1458,38 @@ exports[`OpenAIResponsesStream should handle response.completed with usage 1`] =
"
,
-"id: resp_completed_usage
+"id: reasoning_123
"
,
-"event: usage
+"event: reasoning
"
,
-"data: {"inputCacheMissTokens":100,"inputTextTokens":100,"outputTextTokens":50,"totalInputTokens":100,"totalOutputTokens":50,"totalTokens":150}
+"data: "Thinking about"
+
+"
+,
+
+"id: reasoning_123
+"
+,
+
+"event: reasoning
+"
+,
+
+"data: " the problem..."
"
,
]
`;
-exports[`OpenAIResponsesStream should handle response.completed without usage 1`] = `
+exports[`OpenAIResponsesStream should handle unknown chunk type as data 1`] = `
[
-"id: resp_completed_no_usage
+"id: resp_unknown
"
,
@@ -1492,7 +1502,7 @@ exports[`OpenAIResponsesStream should handle response.completed without usage 1`
"
,
-"id: resp_completed_no_usage
+"id: resp_unknown
"
,
@@ -1500,17 +1510,17 @@ exports[`OpenAIResponsesStream should handle response.completed without usage 1`
"
,
-"data: {"type":"response.completed","response":{"id":"resp_completed_no_usage","status":"completed"}}
+"data: {"type":"response.unknown_event","data":"some data"}
"
,
]
`;
-exports[`OpenAIResponsesStream should handle unknown chunk type as data 1`] = `
+exports[`OpenAIResponsesStream should transform OpenAI stream to protocol stream 1`] = `
[
-"id: resp_unknown
+"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
"
,
@@ -1523,7 +1533,7 @@ exports[`OpenAIResponsesStream should handle unknown chunk type as data 1`] = `
"
,
-"id: resp_unknown
+"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
"
,
@@ -1531,17 +1541,12 @@ exports[`OpenAIResponsesStream should handle unknown chunk type as data 1`] = `
"
,
-"data: {"type":"response.unknown_event","data":"some data"}
+"data: {"type":"response.in_progress","response":{"id":"resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58","object":"response","created_at":1748925324,"status":"in_progress","error":null,"incomplete_details":null,"instructions":null,"max_output_tokens":null,"model":"o4-mini","output":[],"parallel_tool_calls":true,"previous_response_id":null,"reasoning":{"effort":"medium","summary":null},"service_tier":"auto","store":false,"temperature":1,"text":{"format":{"type":"text"}},"tool_choice":"auto","tools":[{"type":"function","description":"a search service. Useful for when you need to answer questions about current events. Input should be a search query. Output is a JSON array of the query results","name":"lobe-web-browsing____search____builtin","parameters":{"properties":{"query":{"description":"The search query","type":"string"},"searchCategories":{"description":"The search categories you can set:","items":{"enum":["general","images","news","science","videos"],"type":"string"},"type":"array"},"searchEngines":{"description":"The search engines you can use:","items":{"enum":["google","bilibili","bing","duckduckgo","npm","pypi","github","arxiv","google scholar","z-library","reddit","imdb","brave","wikipedia","pinterest","unsplash","vimeo","youtube"],"type":"string"},"type":"array"},"searchTimeRange":{"description":"The time range you can set:","enum":["anytime","day","week","month","year"],"type":"string"}},"required":["query"],"type":"object"},"strict":true},{"type":"function","description":"A crawler can visit page content. Output is a JSON object of title, content, url and website","name":"lobe-web-browsing____crawlSinglePage____builtin","parameters":{"properties":{"url":{"description":"The url need to be crawled","type":"string"}},"required":["url"],"type":"object"},"strict":true},{"type":"function","description":"A crawler can visit multi pages. If need to visit multi website, use this one. Output is an array of JSON object of title, content, url and website","name":"lobe-web-browsing____crawlMultiPages____builtin","parameters":{"properties":{"urls":{"items":{"description":"The urls need to be crawled","type":"string"},"type":"array"}},"required":["urls"],"type":"object"},"strict":true}],"top_p":1,"truncation":"disabled","usage":null,"user":null,"metadata":{}}}
"
,
-]
-`;
-
-exports[`OpenAIResponsesStream should handle non-standard item types in output_item.added 1`] = `
-[
-"id: resp_other_item
+"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
"
,
@@ -1549,12 +1554,12 @@ exports[`OpenAIResponsesStream should handle non-standard item types in output_i
"
,
-"data: "in_progress"
+"data: {"id":"rs_683e7bc80a9c81908f6e3d61ad63cc1e0cf93af363cdcf58","type":"reasoning","summary":[]}
"
,
-"id: resp_other_item
+"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
"
,
@@ -1562,17 +1567,12 @@ exports[`OpenAIResponsesStream should handle non-standard item types in output_i
"
,
-"data: {"type":"message","id":"msg_test","status":"in_progress","content":[],"role":"assistant"}
+"data: {"id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","type":"message","status":"in_progress","content":[],"role":"assistant"}
"
,
-]
-`;
-
-exports[`OpenAIResponsesStream should handle chunks with undefined values gracefully 1`] = `
-[
-"id: resp_undefined_vals
+"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
"
,
@@ -1580,20 +1580,20 @@ exports[`OpenAIResponsesStream should handle chunks with undefined values gracef
"
,
-"data: "in_progress"
+"data: {"type":"response.content_part.added","item_id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","output_index":1,"content_index":0,"part":{"type":"output_text","annotations":[],"text":"Hello"}}
"
,
-"id: undefined
+"id: resp_683e7b8ca3308190b6837f20d2c015cd0cf93af363cdcf58
"
,
-"event: reasoning
+"event: data
"
,
-"data: undefined
+"data: {"type":"response.content_part.added","item_id":"msg_683e7bde8b0c8190970ab8c719c0fc1c0cf93af363cdcf58","output_index":1,"content_index":0,"part":{"type":"output_text","annotations":[],"text":" world"}}
"
,
diff --git a/packages/model-runtime/src/index.ts b/packages/model-runtime/src/index.ts
index 4a78c23e7ee..652781d7a93 100644
--- a/packages/model-runtime/src/index.ts
+++ b/packages/model-runtime/src/index.ts
@@ -31,6 +31,7 @@ export { LobeQwenAI } from './providers/qwen';
export { LobeStepfunAI } from './providers/stepfun';
export { LobeTogetherAI } from './providers/togetherai';
export { LobeVolcengineAI } from './providers/volcengine';
+export { LobeZenMuxAI } from './providers/zenmux';
export { LobeZeroOneAI } from './providers/zeroone';
export { LobeZhipuAI } from './providers/zhipu';
export * from './types';
@@ -40,4 +41,3 @@ export { AgentRuntimeError } from './utils/createError';
export { getModelPropertyWithFallback } from './utils/getFallbackModelProperty';
export { getModelPricing } from './utils/getModelPricing';
export { parseDataUri } from './utils/uriParser';
-
diff --git a/packages/model-runtime/src/providers/google/createImage.ts b/packages/model-runtime/src/providers/google/createImage.ts
index e340822290d..e447cd96aaf 100644
--- a/packages/model-runtime/src/providers/google/createImage.ts
+++ b/packages/model-runtime/src/providers/google/createImage.ts
@@ -147,6 +147,7 @@ async function generateImageByChatModel(
? {
imageConfig: {
aspectRatio: params.aspectRatio,
+ imageSize: params.resolution,
},
}
: {}),
diff --git a/packages/model-runtime/src/providers/google/index.ts b/packages/model-runtime/src/providers/google/index.ts
index 7b934759110..87481c7a3b7 100644
--- a/packages/model-runtime/src/providers/google/index.ts
+++ b/packages/model-runtime/src/providers/google/index.ts
@@ -38,6 +38,8 @@ const modelsWithModalities = new Set([
'gemini-2.0-flash-preview-image-generation',
'gemini-2.5-flash-image-preview',
'gemini-2.5-flash-image',
+ 'gemini-3-pro-image-preview',
+ 'nano-banana-pro-preview',
]);
const modelsDisableInstuction = new Set([
@@ -51,6 +53,11 @@ const modelsDisableInstuction = new Set([
'gemma-3-12b-it',
'gemma-3-27b-it',
'gemma-3n-e4b-it',
+ // ZenMux
+ 'google/gemini-2.5-flash-image-free',
+ 'google/gemini-2.5-flash-image',
+ 'google/gemini-3-pro-image-preview-free',
+ 'google/gemini-3-pro-image-preview',
]);
const PRO_THINKING_MIN = 128;
@@ -203,7 +210,10 @@ export class LobeGoogleAI implements LobeRuntimeAI {
includeThoughts:
(!!thinkingBudget ||
!!thinkingLevel ||
- (model && (model.includes('-3-pro-image') || model.includes('thinking')))) &&
+ (model &&
+ (model.includes('-3-pro-image') ||
+ model.includes('nano-banana-pro') ||
+ model.includes('thinking')))) &&
resolvedThinkingBudget !== 0
? true
: undefined,
diff --git a/packages/model-runtime/src/providers/zenmux/index.test.ts b/packages/model-runtime/src/providers/zenmux/index.test.ts
new file mode 100644
index 00000000000..32de1904a48
--- /dev/null
+++ b/packages/model-runtime/src/providers/zenmux/index.test.ts
@@ -0,0 +1,320 @@
+// @vitest-environment node
+import { ModelProvider } from 'model-bank';
+import { Mock, afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import * as modelParseModule from '../../utils/modelParse';
+import { LobeZenMuxAI, params } from './index';
+
+// Mock external dependencies
+vi.mock('../../utils/modelParse');
+
+// Mock console methods
+vi.spyOn(console, 'error').mockImplementation(() => {});
+vi.spyOn(console, 'debug').mockImplementation(() => {});
+
+describe('ZenMux Runtime', () => {
+ let mockFetch: Mock;
+ let mockProcessMultiProviderModelList: Mock;
+ let mockDetectModelProvider: Mock;
+
+ beforeEach(() => {
+ // Setup fetch mock
+ mockFetch = vi.fn();
+ global.fetch = mockFetch;
+
+ // Setup utility function mocks
+ mockProcessMultiProviderModelList = vi.mocked(modelParseModule.processMultiProviderModelList);
+ mockDetectModelProvider = vi.mocked(modelParseModule.detectModelProvider);
+
+ // Clear environment variables
+ delete process.env.DEBUG_ZENMUX_CHAT_COMPLETION;
+ });
+
+ afterEach(() => {
+ vi.clearAllMocks();
+ delete process.env.DEBUG_ZENMUX_CHAT_COMPLETION;
+ });
+
+ describe('Debug Configuration', () => {
+ it('should return false when DEBUG_ZENMUX_CHAT_COMPLETION is not set', () => {
+ delete process.env.DEBUG_ZENMUX_CHAT_COMPLETION;
+ const debugResult = process.env.DEBUG_ZENMUX_CHAT_COMPLETION === '1';
+ expect(debugResult).toBe(false);
+ });
+
+ it('should return true when DEBUG_ZENMUX_CHAT_COMPLETION is set to 1', () => {
+ process.env.DEBUG_ZENMUX_CHAT_COMPLETION = '1';
+ const debugResult = process.env.DEBUG_ZENMUX_CHAT_COMPLETION === '1';
+ expect(debugResult).toBe(true);
+ });
+ });
+
+ describe('LobeZenMuxAI - custom features', () => {
+ describe('Params Export', () => {
+ it('should export params object', () => {
+ expect(params).toBeDefined();
+ expect(params.id).toBe('zenmux');
+ });
+
+ it('should have routers configuration', () => {
+ expect(params.routers).toBeDefined();
+ expect(typeof params.routers).toBe('function');
+ });
+
+ it('should have models function', () => {
+ expect(params.models).toBeDefined();
+ expect(typeof params.models).toBe('function');
+ });
+
+ it('should have correct provider ID', () => {
+ expect(params.id).toBe(ModelProvider.ZenMux);
+ });
+
+ it('should have chatCompletion handlePayload function', () => {
+ expect(params.chatCompletion).toBeDefined();
+ expect(params.chatCompletion?.handlePayload).toBeDefined();
+ expect(typeof params.chatCompletion?.handlePayload).toBe('function');
+ });
+ });
+
+ describe('ChatCompletion HandlePayload', () => {
+ it('should map reasoning_effort to reasoning.effort', () => {
+ const payload = {
+ model: 'gpt-4o',
+ messages: [],
+ reasoning_effort: 'high' as const,
+ } as any;
+
+ const result = params.chatCompletion?.handlePayload?.(payload);
+
+ expect(result).toBeDefined();
+ expect(result?.reasoning).toBeDefined();
+ expect(result?.reasoning?.effort).toBe('high');
+ expect(result?.reasoning_effort).toBeUndefined();
+ });
+
+ it('should map thinking.budget_tokens to reasoning.max_tokens', () => {
+ const payload = {
+ model: 'gpt-4o',
+ messages: [],
+ thinking: { budget_tokens: 2048, type: 'enabled' as const },
+ } as any;
+
+ const result = params.chatCompletion?.handlePayload?.(payload);
+
+ expect(result).toBeDefined();
+ expect(result?.reasoning).toBeDefined();
+ expect(result?.reasoning?.max_tokens).toBe(2048);
+ expect(result?.thinking).toBeUndefined();
+ });
+
+ it('should map thinking.type=enabled to reasoning.enabled=true', () => {
+ const payload = {
+ model: 'gpt-4o',
+ messages: [],
+ thinking: { budget_tokens: 1024, type: 'enabled' as const },
+ } as any;
+
+ const result = params.chatCompletion?.handlePayload?.(payload);
+
+ expect(result).toBeDefined();
+ expect(result?.reasoning).toBeDefined();
+ expect(result?.reasoning?.enabled).toBe(true);
+ expect(result?.thinking).toBeUndefined();
+ });
+
+ it('should not set reasoning.enabled when thinking.type=disabled', () => {
+ const payload = {
+ model: 'gpt-4o',
+ messages: [],
+ thinking: { budget_tokens: 1024, type: 'disabled' as const },
+ } as any;
+
+ const result = params.chatCompletion?.handlePayload?.(payload);
+
+ expect(result).toBeDefined();
+ // When thinking.type is 'disabled', max_tokens should be mapped and enabled should be false
+ expect(result?.reasoning?.max_tokens).toBe(1024);
+ expect(result?.reasoning?.enabled).toBe(false);
+ });
+
+ it('should map both reasoning_effort and thinking.budget_tokens together', () => {
+ const payload = {
+ model: 'gpt-4o',
+ messages: [],
+ reasoning_effort: 'high' as const,
+ thinking: { budget_tokens: 2048, type: 'enabled' as const },
+ } as any;
+
+ const result = params.chatCompletion?.handlePayload?.(payload);
+
+ expect(result).toBeDefined();
+ expect(result?.reasoning).toBeDefined();
+ expect(result?.reasoning?.effort).toBe('high');
+ expect(result?.reasoning?.max_tokens).toBe(2048);
+ });
+
+ it('should preserve existing reasoning properties', () => {
+ const payload = {
+ model: 'gpt-4o',
+ messages: [],
+ reasoning: { summary: 'auto' },
+ reasoning_effort: 'medium' as const,
+ } as any;
+
+ const result = params.chatCompletion?.handlePayload?.(payload);
+
+ expect(result).toBeDefined();
+ expect(result?.reasoning).toBeDefined();
+ expect(result?.reasoning?.summary).toBe('auto');
+ expect(result?.reasoning?.effort).toBe('medium');
+ });
+
+ it('should not include reasoning when no reasoning-related properties', () => {
+ const payload = {
+ model: 'gpt-4o',
+ messages: [],
+ temperature: 0.7,
+ } as any;
+
+ const result = params.chatCompletion?.handlePayload?.(payload);
+
+ expect(result).toBeDefined();
+ expect(result?.reasoning).toBeUndefined();
+ });
+
+ it('should preserve other payload properties', () => {
+ const payload = {
+ model: 'gpt-4o',
+ messages: [],
+ temperature: 0.7,
+ top_p: 0.9,
+ max_tokens: 1024,
+ reasoning_effort: 'high' as const,
+ } as any;
+
+ const result = params.chatCompletion?.handlePayload?.(payload);
+
+ expect(result).toBeDefined();
+ expect(result?.temperature).toBe(0.7);
+ expect(result?.top_p).toBe(0.9);
+ expect(result?.max_tokens).toBe(1024);
+ expect(result?.reasoning?.effort).toBe('high');
+ });
+ });
+
+ describe('Routers Configuration', () => {
+ it('should configure routers with correct endpoints', () => {
+ const mockOptions = { baseURL: 'https://zenmux.ai/api/v1' };
+ const routers = params.routers(mockOptions);
+
+ expect(routers).toBeDefined();
+ expect(Array.isArray(routers)).toBe(true);
+
+ // Check anthropic router
+ const anthropicRouter = routers.find((r) => r.apiType === 'anthropic');
+ expect(anthropicRouter).toBeDefined();
+ expect(anthropicRouter?.options.baseURL).toContain('/api/anthropic');
+
+ // Check google router
+ const googleRouter = routers.find((r) => r.apiType === 'google');
+ expect(googleRouter).toBeDefined();
+ expect(googleRouter?.options.baseURL).toContain('/api/vertex-ai');
+
+ // Check openai router (default)
+ const openaiRouter = routers.find((r) => r.apiType === 'openai');
+ expect(openaiRouter).toBeDefined();
+ expect(openaiRouter?.options.baseURL).toContain('/api/v1');
+ });
+
+ it('should strip version paths from baseURL', () => {
+ const mockOptions = { baseURL: 'https://zenmux.ai/v1' };
+ const routers = params.routers(mockOptions);
+
+ const anthropicRouter = routers.find((r) => r.apiType === 'anthropic');
+ expect(anthropicRouter?.options.baseURL).toBe('https://zenmux.ai/api/anthropic');
+ });
+
+ it('should use default baseURL when not provided', () => {
+ const mockOptions = {}; // No baseURL provided
+ const routers = params.routers(mockOptions);
+
+ const anthropicRouter = routers.find((r) => r.apiType === 'anthropic');
+ expect(anthropicRouter?.options.baseURL).toBe('https://zenmux.ai/api/anthropic');
+
+ const googleRouter = routers.find((r) => r.apiType === 'google');
+ expect(googleRouter?.options.baseURL).toBe('https://zenmux.ai/api/vertex-ai');
+
+ const openaiRouter = routers.find((r) => r.apiType === 'openai');
+ expect(openaiRouter?.options.baseURL).toBe('https://zenmux.ai/api/v1');
+ });
+ });
+ describe('Models Function', () => {
+ it('should fetch and process models correctly', async () => {
+ const mockClient = {
+ apiKey: 'test-key',
+ baseURL: 'https://zenmux.ai/api/v1',
+ models: {
+ list: vi.fn().mockResolvedValue({
+ data: [
+ {
+ id: 'openai/gpt-4o-mini',
+ object: 'model',
+ created: 1755177025,
+ owned_by: 'openai',
+ },
+ {
+ id: 'anthropic/claude-3-5-sonnet-20241022',
+ object: 'model',
+ created: 1755177025,
+ owned_by: 'anthropic',
+ },
+ ],
+ }),
+ },
+ } as any;
+
+ // Mock processMultiProviderModelList to return processed models
+ mockProcessMultiProviderModelList.mockResolvedValue([
+ {
+ id: 'openai/gpt-4o-mini',
+ displayName: 'GPT-4o Mini',
+ providerId: 'openai',
+ },
+ {
+ id: 'anthropic/claude-3-5-sonnet-20241022',
+ displayName: 'Claude 3.5 Sonnet',
+ providerId: 'anthropic',
+ },
+ ] as any);
+
+ const models = await params.models({ client: mockClient });
+
+ expect(models).toBeDefined();
+ expect(Array.isArray(models)).toBe(true);
+ expect(models.length).toBeGreaterThan(0);
+ });
+
+ it('should handle empty model list', async () => {
+ const mockClient = {
+ apiKey: 'test-key',
+ baseURL: 'https://zenmux.ai/api/v1',
+ models: {
+ list: vi.fn().mockResolvedValue({
+ data: [],
+ }),
+ },
+ } as any;
+
+ // Mock processMultiProviderModelList
+ mockProcessMultiProviderModelList.mockResolvedValue([]);
+
+ const models = await params.models({ client: mockClient });
+
+ expect(models).toBeDefined();
+ expect(Array.isArray(models)).toBe(true);
+ expect(models.length).toBe(0);
+ });
+ });
+ });
+});
diff --git a/packages/model-runtime/src/providers/zenmux/index.ts b/packages/model-runtime/src/providers/zenmux/index.ts
new file mode 100644
index 00000000000..0f14473c095
--- /dev/null
+++ b/packages/model-runtime/src/providers/zenmux/index.ts
@@ -0,0 +1,84 @@
+import { LOBE_DEFAULT_MODEL_LIST, ModelProvider } from 'model-bank';
+import urlJoin from 'url-join';
+
+import { createRouterRuntime } from '../../core/RouterRuntime';
+import { CreateRouterRuntimeOptions } from '../../core/RouterRuntime/createRuntime';
+import { detectModelProvider, processMultiProviderModelList } from '../../utils/modelParse';
+
+export interface ZenMuxModelCard {
+ created: number;
+ id: string;
+ object: string;
+ owned_by: string;
+}
+
+const DEFAULT_BASE_URL = 'https://zenmux.ai';
+
+export const params = {
+ chatCompletion: {
+ handlePayload: (payload) => {
+ const { reasoning_effort, thinking, reasoning, ...rest } = payload;
+
+ const finalReasoning = {
+ ...reasoning,
+ ...(reasoning_effort && { effort: reasoning_effort }),
+ ...(thinking?.budget_tokens && { max_tokens: thinking.budget_tokens }),
+ ...(thinking?.type === 'enabled' && { enabled: true }),
+ ...(thinking?.type === 'disabled' && { enabled: false }),
+ };
+
+ const hasReasoning = Object.keys(finalReasoning).length > 0;
+
+ return {
+ ...rest,
+ ...(hasReasoning && { reasoning: finalReasoning }),
+ } as any;
+ },
+ },
+ debug: {
+ chatCompletion: () => process.env.DEBUG_ZENMUX_CHAT_COMPLETION === '1',
+ },
+ id: ModelProvider.ZenMux,
+ models: async ({ client: openAIClient }) => {
+ const modelsPage = (await openAIClient.models.list()) as any;
+ const modelList: ZenMuxModelCard[] = modelsPage.data || [];
+
+ return processMultiProviderModelList(modelList, 'zenmux');
+ },
+ routers: (options) => {
+ const baseURL = options.baseURL || DEFAULT_BASE_URL;
+ const userBaseURL = baseURL.replace(/\/v\d+[a-z]*\/?$/, '').replace(/\/api\/?$/, '');
+
+ return [
+ {
+ apiType: 'anthropic',
+ models: LOBE_DEFAULT_MODEL_LIST.map((m) => m.id).filter(
+ (id) => detectModelProvider(id) === 'anthropic',
+ ),
+ options: {
+ ...options,
+ baseURL: urlJoin(userBaseURL, '/api/anthropic'),
+ },
+ },
+ {
+ apiType: 'google',
+ models: LOBE_DEFAULT_MODEL_LIST.map((m) => m.id).filter(
+ (id) => detectModelProvider(id) === 'google',
+ ),
+ options: {
+ ...options,
+ baseURL: urlJoin(userBaseURL, '/api/vertex-ai'),
+ },
+ },
+ {
+ apiType: 'openai',
+ options: {
+ ...options,
+ baseURL: urlJoin(userBaseURL, '/api/v1'),
+ },
+ },
+ ];
+ },
+} satisfies CreateRouterRuntimeOptions;
+
+export const LobeZenMuxAI = createRouterRuntime(params);
diff --git a/packages/model-runtime/src/runtimeMap.ts b/packages/model-runtime/src/runtimeMap.ts
index 4f01442e392..ab3624b2ccb 100644
--- a/packages/model-runtime/src/runtimeMap.ts
+++ b/packages/model-runtime/src/runtimeMap.ts
@@ -61,6 +61,7 @@ import { LobeVolcengineAI } from './providers/volcengine';
import { LobeWenxinAI } from './providers/wenxin';
import { LobeXAI } from './providers/xai';
import { LobeXinferenceAI } from './providers/xinference';
+import { LobeZenMuxAI } from './providers/zenmux';
import { LobeZeroOneAI } from './providers/zeroone';
import { LobeZhipuAI } from './providers/zhipu';
@@ -128,6 +129,7 @@ export const providerRuntimeMap = {
wenxin: LobeWenxinAI,
xai: LobeXAI,
xinference: LobeXinferenceAI,
+ zenmux: LobeZenMuxAI,
zeroone: LobeZeroOneAI,
zhipu: LobeZhipuAI,
};
diff --git a/packages/types/src/user/settings/keyVaults.ts b/packages/types/src/user/settings/keyVaults.ts
index ddb7275af54..7bd0bb20650 100644
--- a/packages/types/src/user/settings/keyVaults.ts
+++ b/packages/types/src/user/settings/keyVaults.ts
@@ -117,6 +117,7 @@ export interface UserKeyVaults extends SearchEngineKeyVaults {
wenxin?: OpenAICompatibleKeyVault;
xai?: OpenAICompatibleKeyVault;
xinference?: OpenAICompatibleKeyVault;
+ zenmux?: OpenAICompatibleKeyVault;
zeroone?: OpenAICompatibleKeyVault;
zhipu?: OpenAICompatibleKeyVault;
}
diff --git a/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/ResolutionSelect.tsx b/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/ResolutionSelect.tsx
new file mode 100644
index 00000000000..f453b1a99ac
--- /dev/null
+++ b/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/components/ResolutionSelect.tsx
@@ -0,0 +1,88 @@
+import { createStyles } from 'antd-style';
+import { memo, useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+import { Flexbox } from 'react-layout-kit';
+
+import { useGenerationConfigParam } from '@/store/image/slices/generationConfig/hooks';
+
+const useStyles = createStyles(({ css, token }) => ({
+ button: css`
+ cursor: pointer;
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ min-width: 60px;
+ height: 32px;
+ padding-block: 0;
+ padding-inline: 16px;
+ border: 1px solid ${token.colorBorder};
+ border-radius: ${token.borderRadius}px;
+
+ font-size: 14px;
+ font-weight: 500;
+ color: ${token.colorText};
+
+ background: ${token.colorBgContainer};
+
+ transition: all 0.2s ease;
+
+ &:hover {
+ border-color: ${token.colorPrimary};
+ background: ${token.colorBgTextHover};
+ }
+ `,
+
+ container: css`
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ `,
+
+ selectedButton: css`
+ border-color: ${token.colorPrimary};
+ color: ${token.colorPrimary};
+ background: ${token.colorPrimaryBg};
+
+ &:hover {
+ border-color: ${token.colorPrimary};
+ color: ${token.colorPrimary};
+ background: ${token.colorPrimaryBgHover};
+ }
+ `,
+}));
+
+const ResolutionSelect = memo(() => {
+ const { t } = useTranslation('image');
+ const { value, setValue, enumValues } = useGenerationConfigParam('resolution');
+ const { styles, cx } = useStyles();
+
+ const handleClick = useCallback(
+ (resolution: string) => {
+ setValue(resolution);
+ },
+ [setValue],
+ );
+
+ if (!enumValues || enumValues.length === 0) {
+ return null;
+ }
+
+ return (
+ <Flexbox className={styles.container} horizontal>
+ {enumValues.map((resolution) => (
+ <button
+ className={cx(styles.button, value === resolution && styles.selectedButton)}
+ key={resolution}
+ onClick={() => handleClick(resolution)}
+ type="button"
+ >
+ {t(`config.resolution.options.${resolution}`, { defaultValue: resolution })}
+ </button>
+ ))}
+ </Flexbox>
+ );
+});
+
+export default ResolutionSelect;
diff --git a/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/index.tsx b/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/index.tsx
index 227418df470..b8d9e0924a3 100644
--- a/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/index.tsx
+++ b/src/app/[variants]/(main)/image/@menu/features/ConfigPanel/index.tsx
@@ -19,6 +19,7 @@ import ImageUrl from './components/ImageUrl';
import ImageUrlsUpload from './components/ImageUrlsUpload';
import ModelSelect from './components/ModelSelect';
import QualitySelect from './components/QualitySelect';
+import ResolutionSelect from './components/ResolutionSelect';
import SeedNumberInput from './components/SeedNumberInput';
import SizeSelect from './components/SizeSelect';
import StepsSliderInput from './components/StepsSliderInput';
@@ -54,6 +55,7 @@ const ConfigPanel = memo(() => {
const isSupportImageUrl = useImageStore(isSupportedParamSelector('imageUrl'));
const isSupportSize = useImageStore(isSupportedParamSelector('size'));
const isSupportQuality = useImageStore(isSupportedParamSelector('quality'));
+ const isSupportResolution = useImageStore(isSupportedParamSelector('resolution'));
const isSupportSeed = useImageStore(isSupportedParamSelector('seed'));
const isSupportSteps = useImageStore(isSupportedParamSelector('steps'));
const isSupportCfg = useImageStore(isSupportedParamSelector('cfg'));
@@ -78,6 +80,7 @@ const ConfigPanel = memo(() => {
isSupportImageUrl,
isSupportSize,
isSupportQuality,
+ isSupportResolution,
isSupportSeed,
isSupportSteps,
isSupportCfg,
@@ -168,6 +171,12 @@ const ConfigPanel = memo(() => {
</ConfigItemLayout>
)}
+ {isSupportResolution && (
+ <ConfigItemLayout label={t('config.resolution.label')}>
+ <ResolutionSelect />
+ </ConfigItemLayout>
+ )}
+
{showDimensionControl && <DimensionControlGroup />}
{isSupportSteps && (
diff --git a/src/config/modelProviders/index.ts b/src/config/modelProviders/index.ts
index bcde6aa9a57..83f5724ca96 100644
--- a/src/config/modelProviders/index.ts
+++ b/src/config/modelProviders/index.ts
@@ -64,6 +64,7 @@ import VolcengineProvider from './volcengine';
import WenxinProvider from './wenxin';
import XAIProvider from './xai';
import XinferenceProvider from './xinference';
+import ZenMuxProvider from './zenmux';
import ZeroOneProvider from './zeroone';
import ZhiPuProvider from './zhipu';
@@ -190,6 +191,7 @@ export const DEFAULT_MODEL_PROVIDER_LIST = [
CometAPIProvider,
VercelAIGatewayProvider,
CerebrasProvider,
+ ZenMuxProvider,
];
export const filterEnabledModels = (provider: ModelProviderCard) => {
@@ -266,5 +268,6 @@ export { default as VolcengineProviderCard } from './volcengine';
export { default as WenxinProviderCard } from './wenxin';
export { default as XAIProviderCard } from './xai';
export { default as XinferenceProviderCard } from './xinference';
+export { default as ZenMuxProviderCard } from './zenmux';
export { default as ZeroOneProviderCard } from './zeroone';
export { default as ZhiPuProviderCard } from './zhipu';
diff --git a/src/config/modelProviders/zenmux.ts b/src/config/modelProviders/zenmux.ts
new file mode 100644
index 00000000000..ea3a1e7c572
--- /dev/null
+++ b/src/config/modelProviders/zenmux.ts
@@ -0,0 +1,21 @@
+import { ModelProviderCard } from '@/types/llm';
+
+const ZenMux: ModelProviderCard = {
+ chatModels: [],
+ checkModel: 'openai/gpt-5-nano',
+ description:
+ 'ZenMux 是一个统一的 AI 服务聚合平台,支持 OpenAI、Anthropic、Google VertexAI 等多种主流 AI 服务接口。提供灵活的路由能力,让您可以轻松切换和管理不同的 AI 模型。',
+ id: 'zenmux',
+ name: 'ZenMux',
+ settings: {
+ disableBrowserRequest: true, // CORS error
+ proxyUrl: {
+ placeholder: 'https://zenmux.ai',
+ },
+ sdkType: 'router',
+ showModelFetcher: true,
+ },
+ url: 'https://zenmux.ai',
+};
+
+export default ZenMux;
diff --git a/src/envs/llm.ts b/src/envs/llm.ts
index 4443b6d3987..de88ada8b87 100644
--- a/src/envs/llm.ts
+++ b/src/envs/llm.ts
@@ -209,6 +209,9 @@ export const getLLMConfig = () => {
ENABLED_CEREBRAS: z.boolean(),
CEREBRAS_API_KEY: z.string().optional(),
+
+ ENABLED_ZENMUX: z.boolean(),
+ ZENMUX_API_KEY: z.string().optional(),
},
runtimeEnv: {
API_KEY_SELECT_MODE: process.env.API_KEY_SELECT_MODE,
@@ -416,6 +419,9 @@ export const getLLMConfig = () => {
ENABLED_CEREBRAS: !!process.env.CEREBRAS_API_KEY,
CEREBRAS_API_KEY: process.env.CEREBRAS_API_KEY,
+
+ ENABLED_ZENMUX: !!process.env.ZENMUX_API_KEY,
+ ZENMUX_API_KEY: process.env.ZENMUX_API_KEY,
},
});
};
diff --git a/src/locales/default/image.ts b/src/locales/default/image.ts
index 6ee8647fc36..641b69e7e5e 100644
--- a/src/locales/default/image.ts
+++ b/src/locales/default/image.ts
@@ -37,6 +37,14 @@ export default {
standard: '标准',
},
},
+ resolution: {
+ label: '分辨率',
+ options: {
+ '1K': '1K',
+ '2K': '2K',
+ '4K': '4K',
+ },
+ },
seed: {
label: '种子',
random: '随机种子',
diff --git a/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts b/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts
index e2f1725488f..890b3a7bc3f 100644
--- a/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts
+++ b/src/store/chat/slices/aiChat/actions/__tests__/conversationLifecycle.test.ts
@@ -2,6 +2,7 @@ import { act, renderHook } from '@testing-library/react';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { aiChatService } from '@/services/aiChat';
+import { getSessionStoreState } from '@/store/session';
import { useChatStore } from '../../../../store';
import { TEST_CONTENT, TEST_IDS, createMockMessage } from './fixtures';
@@ -30,6 +31,8 @@ beforeEach(() => {
resetTestEnvironment();
setupMockSelectors();
spyOnMessageService();
+ const sessionStore = getSessionStoreState();
+ vi.spyOn(sessionStore, 'triggerSessionUpdate').mockResolvedValue(undefined);
act(() => {
useChatStore.setState({
diff --git a/src/store/chat/slices/aiChat/actions/streamingExecutor.ts b/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
index 5a5587077fa..175b930a13c 100644
--- a/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
+++ b/src/store/chat/slices/aiChat/actions/streamingExecutor.ts
@@ -530,6 +530,17 @@ export const streamingExecutor: StateCreator<
get().completeOperation(reasoningOperationId);
reasoningOperationId = undefined;
}
+ break;
+ }
+
+ case 'stop': {
+ // Complete reasoning operation when receiving stop signal
+ if (!duration && reasoningOperationId) {
+ duration = Date.now() - thinkingStartAt;
+ get().completeOperation(reasoningOperationId);
+ reasoningOperationId = undefined;
+ }
+ break;
}
}
},