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.

♻️ refactor: load models through model bank slot (#14877)

YuTengjing0911c2a94c13
diff --git a/locales/en-US/image.json b/locales/en-US/image.json
index 17e8b5923ca..1dd1b3227de 100644
--- a/locales/en-US/image.json
+++ b/locales/en-US/image.json
@@ -20,6 +20,7 @@
"config.resolution.options.1K": "1K",
"config.resolution.options.2K": "2K",
"config.resolution.options.4K": "4K",
+ "config.resolution.options.512": "512px",
"config.seed.label": "Seed",
"config.seed.random": "Random Seed",
"config.size.label": "Size",
diff --git a/locales/zh-CN/image.json b/locales/zh-CN/image.json
index f7b902ef930..2af2d0f2dd8 100644
--- a/locales/zh-CN/image.json
+++ b/locales/zh-CN/image.json
@@ -20,6 +20,7 @@
"config.resolution.options.1K": "1K",
"config.resolution.options.2K": "2K",
"config.resolution.options.4K": "4K",
+ "config.resolution.options.512": "512px",
"config.seed.label": "种子",
"config.seed.random": "随机种子",
"config.size.label": "尺寸",
diff --git a/package.json b/package.json
index cee1ef54b2c..9f2c9b57889 100644
--- a/package.json
+++ b/package.json
@@ -241,6 +241,7 @@
"@lobechat/builtin-tools": "workspace:*",
"@lobechat/business-config": "workspace:*",
"@lobechat/business-const": "workspace:*",
+ "@lobechat/business-model-bank": "workspace:*",
"@lobechat/business-model-runtime": "workspace:*",
"@lobechat/chat-adapter-feishu": "workspace:*",
"@lobechat/chat-adapter-line": "workspace:*",
diff --git a/packages/business/model-bank/package.json b/packages/business/model-bank/package.json
new file mode 100644
index 00000000000..6e78a702eca
--- /dev/null
+++ b/packages/business/model-bank/package.json
@@ -0,0 +1,13 @@
+{
+ "name": "@lobechat/business-model-bank",
+ "version": "1.0.0",
+ "private": true,
+ "exports": {
+ ".": "./src/index.ts",
+ "./model-config": "./src/model-config.ts"
+ },
+ "main": "./src/index.ts",
+ "dependencies": {
+ "model-bank": "workspace:*"
+ }
+}
diff --git a/packages/business/model-bank/src/index.ts b/packages/business/model-bank/src/index.ts
new file mode 100644
index 00000000000..19949a6d6bc
--- /dev/null
+++ b/packages/business/model-bank/src/index.ts
@@ -0,0 +1 @@
+export * from './model-config';
diff --git a/packages/business/model-bank/src/model-config.ts b/packages/business/model-bank/src/model-config.ts
new file mode 100644
index 00000000000..156998b2c0b
--- /dev/null
+++ b/packages/business/model-bank/src/model-config.ts
@@ -0,0 +1,31 @@
+import type { AiFullModelCard } from 'model-bank';
+import { loadModels as loadModelBankModels, ModelProvider } from 'model-bank';
+
+interface LobeHubModelConfig {
+ models: AiFullModelCard[];
+ planCardModels: string[];
+ updatedAt?: string;
+ version: number;
+}
+
+const getDefaultLobeHubModelConfig = (): LobeHubModelConfig => ({
+ models: [],
+ planCardModels: [],
+ version: 1,
+});
+
+const loadLobeHubModelConfig = async (): Promise<LobeHubModelConfig> =>
+ getDefaultLobeHubModelConfig();
+
+export const loadModels = async () =>
+ loadModelBankModels({
+ providerLoaders: {
+ [ModelProvider.LobeHub]: loadLobeHubModels,
+ },
+ });
+
+const loadLobeHubModels = async (): Promise<AiFullModelCard[]> =>
+ (await loadLobeHubModelConfig()).models;
+
+export const loadLobeHubPlanCardModels = async (): Promise<string[]> =>
+ (await loadLobeHubModelConfig()).planCardModels;
diff --git a/packages/business/model-runtime/package.json b/packages/business/model-runtime/package.json
index 3cfc5387393..39c6ed809d0 100644
--- a/packages/business/model-runtime/package.json
+++ b/packages/business/model-runtime/package.json
@@ -5,8 +5,5 @@
"exports": {
".": "./src/index.ts"
},
- "main": "./src/index.ts",
- "dependencies": {
- "model-bank": "workspace:*"
- }
+ "main": "./src/index.ts"
}
diff --git a/packages/database/package.json b/packages/database/package.json
index 9c49d0c7f13..a7eaf57b973 100644
--- a/packages/database/package.json
+++ b/packages/database/package.json
@@ -16,6 +16,7 @@
"dependencies": {
"@lobechat/agent-templates": "workspace:*",
"@lobechat/business-const": "workspace:*",
+ "@lobechat/business-model-bank": "workspace:*",
"@lobechat/const": "workspace:*",
"@lobechat/conversation-flow": "workspace:*",
"@lobechat/types": "workspace:*",
diff --git a/packages/database/src/models/aiModel.ts b/packages/database/src/models/aiModel.ts
index 6699b17f234..1f1542741e7 100644
--- a/packages/database/src/models/aiModel.ts
+++ b/packages/database/src/models/aiModel.ts
@@ -190,12 +190,15 @@ export class AiModelModel {
}
// Get default model list to preserve type information
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
- const defaultModelMap = new Map(LOBE_DEFAULT_MODEL_LIST.map((m) => [m.id, m]));
+ const { loadModels } = await import('@lobechat/business-model-bank/model-config');
+ const defaultModels = await loadModels();
+ const defaultModelMap = new Map(defaultModels.map((m) => [`${m.providerId}:${m.id}`, m]));
// Prepare all records for batch upsert
const allRecords = models.map((modelId) => {
- const defaultModel = defaultModelMap.get(modelId);
+ const defaultModel =
+ defaultModelMap.get(`${providerId}:${modelId}`) ??
+ defaultModels.find((model) => model.id === modelId);
const record: typeof aiModels.$inferInsert = {
enabled,
id: modelId,
diff --git a/packages/database/src/repositories/aiInfra/__tests__/getAiProviderModelList.test.ts b/packages/database/src/repositories/aiInfra/__tests__/getAiProviderModelList.test.ts
index 9af3a5c75f6..ab61c5ea94a 100644
--- a/packages/database/src/repositories/aiInfra/__tests__/getAiProviderModelList.test.ts
+++ b/packages/database/src/repositories/aiInfra/__tests__/getAiProviderModelList.test.ts
@@ -11,6 +11,13 @@ const mockProviderConfigs = {
anthropic: { enabled: false },
};
+vi.mock('@lobechat/business-model-bank/model-config', async () => {
+ const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ return {
+ loadModels: vi.fn().mockResolvedValue(LOBE_DEFAULT_MODEL_LIST),
+ };
+});
+
let serverDB: LobeChatDatabase;
let repo: AiInfraRepos;
diff --git a/packages/database/src/repositories/aiInfra/index.ts b/packages/database/src/repositories/aiInfra/index.ts
index f38ed04411f..aaf75aa12b4 100644
--- a/packages/database/src/repositories/aiInfra/index.ts
+++ b/packages/database/src/repositories/aiInfra/index.ts
@@ -1,4 +1,5 @@
import { BRANDING_PROVIDER } from '@lobechat/business-const';
+import { loadModels } from '@lobechat/business-model-bank/model-config';
import type {
AiProviderDetailItem,
AiProviderListItem,
@@ -9,7 +10,6 @@ import type {
import { isEmpty } from 'es-toolkit/compat';
import type { AIChatModelCard, AiProviderModelListItem, EnabledAiModel } from 'model-bank';
import { AiModelSourceEnum, isAiModelVisible } from 'model-bank';
-import * as modelBank from 'model-bank';
import { DEFAULT_MODEL_PROVIDER_LIST } from 'model-bank/modelProviders';
import pMap from 'p-map';
@@ -127,6 +127,7 @@ export class AiInfraRepos {
aiProviderModel: AiProviderModel;
private readonly providerConfigs: Record<string, ProviderConfig>;
aiModelModel: AiModelModel;
+ private modelBankModelsPromise?: ReturnType<typeof loadModels>;
constructor(
db: LobeChatDatabase,
@@ -460,17 +461,20 @@ export class AiInfraRepos {
/**
* Fetch builtin models from config
*/
+ private getModelBankModels = () => {
+ this.modelBankModelsPromise ??= loadModels();
+ return this.modelBankModelsPromise;
+ };
+
private fetchBuiltinModels = async (
providerId: string,
): Promise<AiProviderModelListItem[] | undefined> => {
try {
- // TODO: when model-bank is a separate module, we will try import from model-bank/[prividerId] again
- // @ts-expect-error providerId is string
- const providerModels = modelBank[providerId];
-
// use the serverModelLists as the defined server model list
// fallback to empty array for custom provider
- const presetList = this.providerConfigs[providerId]?.serverModelLists || providerModels || [];
+ const presetList =
+ this.providerConfigs[providerId]?.serverModelLists ||
+ (await this.getModelBankModels()).filter((model) => model.providerId === providerId);
return (presetList as AIChatModelCard[]).map<AiProviderModelListItem>((m) => ({
...m,
diff --git a/packages/model-bank/package.json b/packages/model-bank/package.json
index c8cb0106291..59d8d1bad46 100644
--- a/packages/model-bank/package.json
+++ b/packages/model-bank/package.json
@@ -32,7 +32,6 @@
"./google": "./src/aiModels/google.ts",
"./glmCodingPlan": "./src/aiModels/glmCodingPlan.ts",
"./groq": "./src/aiModels/groq.ts",
- "./lobehub": "./src/aiModels/lobehub/index.ts",
"./higress": "./src/aiModels/higress.ts",
"./huggingface": "./src/aiModels/huggingface.ts",
"./hunyuan": "./src/aiModels/hunyuan.ts",
@@ -54,6 +53,7 @@
"./ollama": "./src/aiModels/ollama.ts",
"./ollamacloud": "./src/aiModels/ollamacloud.ts",
"./openai": "./src/aiModels/openai.ts",
+ "./imageParameters": "./src/const/imageParameters.ts",
"./opencodeCodingPlan": "./src/aiModels/opencodeCodingPlan.ts",
"./opencodeZen": "./src/aiModels/opencodeZen.ts",
"./openrouter": "./src/aiModels/openrouter.ts",
diff --git a/packages/model-bank/src/aiModels/__tests__/index.test.ts b/packages/model-bank/src/aiModels/__tests__/index.test.ts
new file mode 100644
index 00000000000..ac0da0faaf5
--- /dev/null
+++ b/packages/model-bank/src/aiModels/__tests__/index.test.ts
@@ -0,0 +1,61 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { ModelProvider } from '../../const/modelProvider';
+import { loadModels, LOBE_DEFAULT_MODEL_LIST } from '../index';
+
+describe('loadModels', () => {
+ it('returns the static model list by default', async () => {
+ await expect(loadModels()).resolves.toBe(LOBE_DEFAULT_MODEL_LIST);
+ });
+
+ it('overrides provider models with injected async loaders', async () => {
+ const loader = vi.fn().mockResolvedValue([
+ {
+ enabled: true,
+ id: 'injected-lobehub-model',
+ type: 'chat',
+ },
+ ]);
+
+ const models = await loadModels({
+ providerLoaders: {
+ [ModelProvider.LobeHub]: loader,
+ },
+ });
+
+ expect(loader).toHaveBeenCalledTimes(1);
+ expect(models).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({
+ enabled: true,
+ id: 'injected-lobehub-model',
+ providerId: ModelProvider.LobeHub,
+ source: 'builtin',
+ type: 'chat',
+ }),
+ ]),
+ );
+ });
+
+ it('ignores undefined provider loaders', async () => {
+ await expect(
+ loadModels({
+ providerLoaders: {
+ [ModelProvider.LobeHub]: undefined,
+ },
+ }),
+ ).resolves.toBe(LOBE_DEFAULT_MODEL_LIST);
+ });
+
+ it('propagates injected loader errors without falling back to static models', async () => {
+ const loader = vi.fn().mockRejectedValue(new Error('model config missing'));
+
+ await expect(
+ loadModels({
+ providerLoaders: {
+ [ModelProvider.LobeHub]: loader,
+ },
+ }),
+ ).rejects.toThrow('model config missing');
+ });
+});
diff --git a/packages/model-bank/src/aiModels/aihubmix.ts b/packages/model-bank/src/aiModels/aihubmix.ts
index 01d132741a9..0722e729c5f 100644
--- a/packages/model-bank/src/aiModels/aihubmix.ts
+++ b/packages/model-bank/src/aiModels/aihubmix.ts
@@ -1,5 +1,5 @@
-import { type AIChatModelCard, type AIImageModelCard } from '../types/aiModel';
-import { gptImage2Schema } from './lobehub';
+import { gptImage2Schema } from '../const/imageParameters';
+import type { AIChatModelCard, AIImageModelCard } from '../types/aiModel';
const aihubmixChatModels: AIChatModelCard[] = [
{
diff --git a/packages/model-bank/src/aiModels/google.ts b/packages/model-bank/src/aiModels/google.ts
index b09e03520d2..70128e67cbe 100644
--- a/packages/model-bank/src/aiModels/google.ts
+++ b/packages/model-bank/src/aiModels/google.ts
@@ -1,5 +1,10 @@
-import { type ModelParamsSchema } from '../standard-parameters';
-import { type AIChatModelCard, type AIImageModelCard, type AIVideoModelCard } from '../types';
+import {
+ nanoBanana2Parameters,
+ nanoBananaParameters,
+ nanoBananaProParameters,
+} from '../const/imageParameters';
+import type { ModelParamsSchema } from '../standard-parameters';
+import type { AIChatModelCard, AIImageModelCard, AIVideoModelCard } from '../types';
/**
* gemini implicit caching not extra cost
@@ -732,65 +737,6 @@ export const imagenGenParameters: ModelParamsSchema = {
prompt: { default: '' },
};
-const NANO_BANANA_ASPECT_RATIOS = [
- 'auto',
- '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
-];
-
-const NANO_BANANA_2_ASPECT_RATIOS = [...NANO_BANANA_ASPECT_RATIOS, '1:4', '4:1', '1:8', '8:1'];
-
-export const nanoBananaParameters: ModelParamsSchema = {
- aspectRatio: {
- default: 'auto',
- enum: NANO_BANANA_ASPECT_RATIOS,
- },
- imageUrls: {
- default: [],
- },
- prompt: { default: '' },
-};
-
-export const nanoBananaProParameters: ModelParamsSchema = {
- aspectRatio: {
- default: 'auto',
- enum: NANO_BANANA_ASPECT_RATIOS,
- },
- imageUrls: {
- default: [],
- },
- prompt: { default: '' },
- resolution: {
- default: '1K',
- enum: ['1K', '2K', '4K'],
- },
-};
-
-export const nanoBanana2Parameters: ModelParamsSchema = {
- aspectRatio: {
- default: 'auto',
- enum: NANO_BANANA_2_ASPECT_RATIOS,
- },
- imageUrls: {
- default: [],
- },
- prompt: { default: '' },
- resolution: {
- default: '1K',
- // Gemini image generation API accepts `"512" | "1K" | "2K" | "4K"`.
- // See https://ai.google.dev/gemini-api/docs/image-generation
- enum: ['512', '1K', '2K', '4K'],
- },
-};
-
const googleImageModels: AIImageModelCard[] = [
{
displayName: 'Nano Banana 2',
diff --git a/packages/model-bank/src/aiModels/index.ts b/packages/model-bank/src/aiModels/index.ts
index 667550607e2..b039053fe5d 100644
--- a/packages/model-bank/src/aiModels/index.ts
+++ b/packages/model-bank/src/aiModels/index.ts
@@ -1,5 +1,4 @@
-import { ENABLE_BUSINESS_FEATURES } from '@lobechat/business-const';
-
+import type { ModelProvider } from '../const/modelProvider';
import { type AiFullModelCard, type LobeDefaultAiModelListItem } from '../types/aiModel';
import { default as ai21 } from './ai21';
import { default as ai302 } from './ai302';
@@ -35,7 +34,6 @@ import { default as internlm } from './internlm';
import { default as jina } from './jina';
import { default as kimicodingplan } from './kimiCodingPlan';
import { default as lmstudio } from './lmstudio';
-import { default as lobehub } from './lobehub/index';
import { default as longcat } from './longcat';
import { default as minimax } from './minimax';
import { default as minimaxcodingplan } from './minimaxCodingPlan';
@@ -83,8 +81,13 @@ import { default as zenmux } from './zenmux';
import { default as zeroone } from './zeroone';
import { default as zhipu } from './zhipu';
+type ModelProviderLoader = () => Promise<AiFullModelCard[]>;
type ModelsMap = Record<string, AiFullModelCard[]>;
+export interface LoadModelsOptions {
+ providerLoaders?: Partial<Record<ModelProvider, ModelProviderLoader | undefined>>;
+}
+
const buildDefaultModelList = (map: ModelsMap): LobeDefaultAiModelListItem[] => {
let models: LobeDefaultAiModelListItem[] = [];
@@ -102,7 +105,7 @@ const buildDefaultModelList = (map: ModelsMap): LobeDefaultAiModelListItem[] =>
return models;
};
-export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
+const staticModelMap: ModelsMap = {
ai21,
ai302,
ai360,
@@ -138,7 +141,6 @@ export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
kimicodingplan,
lmstudio,
longcat,
- ...(ENABLE_BUSINESS_FEATURES ? { lobehub } : {}),
minimax,
minimaxcodingplan,
mistral,
@@ -184,8 +186,39 @@ export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList({
zenmux,
zeroone,
zhipu,
-});
+};
+
+export const LOBE_DEFAULT_MODEL_LIST = buildDefaultModelList(staticModelMap);
+
+export const loadModels = async (
+ options?: LoadModelsOptions,
+): Promise<LobeDefaultAiModelListItem[]> => {
+ const providerLoaders = options?.providerLoaders;
+ if (!providerLoaders || Object.keys(providerLoaders).length === 0) {
+ return LOBE_DEFAULT_MODEL_LIST;
+ }
+
+ const validProviderLoaders = Object.entries(providerLoaders).flatMap(([provider, loader]) =>
+ typeof loader === 'function' ? ([[provider as ModelProvider, loader]] as const) : [],
+ );
+
+ if (validProviderLoaders.length === 0) {
+ return LOBE_DEFAULT_MODEL_LIST;
+ }
+
+ const modelMap = { ...staticModelMap };
+ const entries = await Promise.all(
+ validProviderLoaders.map(async ([provider, loader]) => [provider, await loader()] as const),
+ );
+
+ for (const [provider, models] of entries) {
+ modelMap[provider] = models;
+ }
+
+ return buildDefaultModelList(modelMap);
+};
+export { gptImage1Schema, gptImage2Schema } from '../const/imageParameters';
export { default as ai21 } from './ai21';
export { default as ai302 } from './ai302';
export { default as ai360 } from './ai360';
@@ -220,7 +253,6 @@ export { default as internlm } from './internlm';
export { default as jina } from './jina';
export { default as kimicodingplan } from './kimiCodingPlan';
export { default as lmstudio } from './lmstudio';
-export { gptImage1Schema, default as lobehub } from './lobehub/index';
export { default as longcat } from './longcat';
export { default as minimax } from './minimax';
export { default as minimaxcodingplan } from './minimaxCodingPlan';
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/anthropic.ts b/packages/model-bank/src/aiModels/lobehub/chat/anthropic.ts
deleted file mode 100644
index 7c66cddd4e2..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/anthropic.ts
+++ /dev/null
@@ -1,268 +0,0 @@
-import { type AIChatModelCard } from '../../../types/aiModel';
-
-export const anthropicChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 1_000_000,
- description: "Claude Sonnet 4.6 is Anthropic's best combination of speed and intelligence.",
- displayName: 'Claude Sonnet 4.6',
- enabled: true,
- id: 'claude-sonnet-4-6',
- maxOutput: 64_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 3.75, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-02-18',
- settings: {
- extendParams: ['disableContextCaching', 'enableAdaptiveThinking', 'effort'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 200_000,
- description: "Claude Sonnet 4.5 is Anthropic's most intelligent model to date.",
- displayName: 'Claude Sonnet 4.5',
- id: 'claude-sonnet-4-5-20250929',
- maxOutput: 8192,
- pricing: {
- units: [
- { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 3.75, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-09-30',
- settings: {
- extendParams: ['disableContextCaching', 'enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 200_000,
- description:
- "Claude Sonnet 4 is Anthropic's most intelligent model to date, offering near-instant responses or extended step-by-step thinking with fine-grained control for API users.",
- displayName: 'Claude Sonnet 4',
- id: 'claude-sonnet-4-20250514',
- maxOutput: 8192,
- pricing: {
- units: [
- { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- {
- lookup: { prices: { '1h': 6, '5m': 3.75 }, pricingParams: ['ttl'] },
- name: 'textInput_cacheWrite',
- strategy: 'lookup',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2025-05-23',
- settings: {
- extendParams: ['disableContextCaching', 'enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 1_000_000,
- description:
- "Claude Opus 4.7 is Anthropic's most capable generally available model for complex reasoning and agentic coding.",
- displayName: 'Claude Opus 4.7',
- enabled: true,
- id: 'claude-opus-4-7',
- maxOutput: 128_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 6.25, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-04-16',
- settings: {
- disabledParams: ['temperature', 'top_p'],
- extendParams: ['disableContextCaching', 'enableAdaptiveThinking', 'opus47Effort'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 1_000_000,
- description:
- "Claude Opus 4.6 is Anthropic's most intelligent model for building agents and coding.",
- displayName: 'Claude Opus 4.6',
- enabled: true,
- id: 'claude-opus-4-6',
- maxOutput: 128_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 6.25, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-02-05',
- settings: {
- extendParams: ['disableContextCaching', 'enableAdaptiveThinking', 'effort'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- structuredOutput: true,
- vision: true,
- },
- contextWindowTokens: 200_000,
- description:
- "Claude Opus 4.5 is Anthropic's flagship model, combining excellent intelligence and scalable performance for the highest-quality reasoning tasks.",
- displayName: 'Claude Opus 4.5',
- id: 'claude-opus-4-5-20251101',
- maxOutput: 64_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 25, strategy: 'fixed', unit: 'millionTokens' },
- {
- lookup: { prices: { '1h': 10, '5m': 6.25 }, pricingParams: ['ttl'] },
- name: 'textInput_cacheWrite',
- strategy: 'lookup',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2025-11-24',
- settings: {
- extendParams: ['disableContextCaching', 'enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 200_000,
- description:
- "Claude Opus 4.1 is Anthropic's latest and most capable model for highly complex tasks, excelling in performance, intelligence, fluency, and understanding.",
- displayName: 'Claude Opus 4.1',
- id: 'claude-opus-4-1-20250805',
- maxOutput: 32_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 75, strategy: 'fixed', unit: 'millionTokens' },
- {
- lookup: { prices: { '1h': 30, '5m': 18.75 }, pricingParams: ['ttl'] },
- name: 'textInput_cacheWrite',
- strategy: 'lookup',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2025-08-05',
- settings: {
- extendParams: ['disableContextCaching', 'enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 200_000,
- description:
- "Claude Opus 4 is Anthropic's most powerful model for highly complex tasks, excelling in performance, intelligence, fluency, and understanding.",
- displayName: 'Claude Opus 4',
- id: 'claude-opus-4-20250514',
- maxOutput: 32_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 75, strategy: 'fixed', unit: 'millionTokens' },
- {
- lookup: { prices: { '1h': 30, '5m': 18.75 }, pricingParams: ['ttl'] },
- name: 'textInput_cacheWrite',
- strategy: 'lookup',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2025-05-23',
- settings: {
- extendParams: ['disableContextCaching', 'enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- structuredOutput: true,
- vision: true,
- },
- contextWindowTokens: 200_000,
- description:
- "Claude Haiku 4.5 is Anthropic's fastest and most intelligent Haiku model, with lightning speed and extended thinking.",
- displayName: 'Claude Haiku 4.5',
- enabled: true,
- id: 'claude-haiku-4-5-20251001',
- maxOutput: 64_000,
- pricing: {
- units: [
- { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
- {
- lookup: { prices: { '1h': 2, '5m': 1.25 }, pricingParams: ['ttl'] },
- name: 'textInput_cacheWrite',
- strategy: 'lookup',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2025-10-16',
- settings: {
- extendParams: ['disableContextCaching', 'enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/deepseek.ts b/packages/model-bank/src/aiModels/lobehub/chat/deepseek.ts
deleted file mode 100644
index 9a62edae95d..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/deepseek.ts
+++ /dev/null
@@ -1,120 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-export const deepseekChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 1_000_000,
- description:
- 'DeepSeek V4 Pro is the flagship of the V4 family, purpose-built for high-intensity reasoning, agent workflows, and long-horizon planning with a 1M context window. Thinking mode is on by default and toggleable via the `thinking` parameter.',
- displayName: 'DeepSeek V4 Pro',
- enabled: true,
- id: 'deepseek-v4-pro',
- maxOutput: 384_000,
- pricing: {
- units: [
- {
- name: 'textInput_cacheRead',
- originalRate: 0.0145,
- rate: 0.003625,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- {
- name: 'textInput',
- originalRate: 1.74,
- rate: 0.435,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- {
- name: 'textOutput',
- originalRate: 3.48,
- rate: 0.87,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-04-24',
- settings: {
- extendParams: ['deepseekV4ReasoningEffort'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 1_000_000,
- description:
- 'DeepSeek V4 Flash is the cost-efficient member of the V4 family with a 1M context window and hybrid thinking. Toggle thinking via the `thinking` parameter; non-thinking mode targets latency-sensitive workflows while thinking mode enables deeper reasoning.',
- displayName: 'DeepSeek V4 Flash',
- enabled: true,
- id: 'deepseek-v4-flash',
- maxOutput: 384_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.0028, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 0.14, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-04-24',
- settings: {
- extendParams: ['deepseekV4ReasoningEffort'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- },
- contextWindowTokens: 1_000_000,
- // Per official docs: deepseek-chat is now a compatibility alias that points
- // to the non-thinking mode of deepseek-v4-flash and will be deprecated.
- // Pricing and sizing mirror deepseek-v4-flash since that is what the endpoint serves.
- description:
- 'Compatibility alias for DeepSeek V4 Flash non-thinking mode. Slated for deprecation — use DeepSeek V4 Flash instead.',
- displayName: 'DeepSeek V3.2 (routes to V4 Flash)',
- id: 'deepseek-chat',
- legacy: true,
- maxOutput: 384_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.0028, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 0.14, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-12-01',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 1_000_000,
- // Per official docs: deepseek-reasoner is now a compatibility alias that
- // points to the thinking mode of deepseek-v4-flash and will be deprecated.
- description:
- 'Compatibility alias for DeepSeek V4 Flash thinking mode. Slated for deprecation — use DeepSeek V4 Flash instead.',
- displayName: 'DeepSeek V3.2 Thinking (routes to V4 Flash)',
- id: 'deepseek-reasoner',
- legacy: true,
- maxOutput: 384_000,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.0028, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 0.14, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.28, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-12-01',
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/google.ts b/packages/model-bank/src/aiModels/lobehub/chat/google.ts
deleted file mode 100644
index 236a0e1bc0e..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/google.ts
+++ /dev/null
@@ -1,448 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-export const googleChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- structuredOutput: true,
- video: true,
- vision: true,
- },
- contextWindowTokens: 1_048_576 + 65_536,
- description:
- "Gemini's most intelligent model built for speed, combining frontier intelligence with superior search and grounding.",
- displayName: 'Gemini 3.5 Flash',
- enabled: true,
- id: 'gemini-3.5-flash',
- maxOutput: 65_536,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'videoInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'audioInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
- {
- lookup: { prices: { '1h': 1 }, pricingParams: ['ttl'] },
- name: 'textInput_cacheWrite',
- strategy: 'lookup',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-05-19',
- settings: {
- extendParams: ['thinkingLevel', 'urlContext'],
- searchImpl: 'params',
- searchProvider: 'google',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- structuredOutput: true,
- video: true,
- vision: true,
- },
- contextWindowTokens: 1_048_576 + 65_536,
- description:
- 'Gemini 3.1 Pro Preview improves on Gemini 3 Pro with enhanced reasoning capabilities (ARC-AGI-2 77.1%) and adds medium thinking level support.',
- displayName: 'Gemini 3.1 Pro Preview',
- enabled: true,
- id: 'gemini-3.1-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: 'imageInput',
- strategy: 'tiered',
- tiers: [
- { rate: 2, upTo: 200_000 },
- { rate: 4, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'videoInput',
- strategy: 'tiered',
- tiers: [
- { rate: 2, upTo: 200_000 },
- { rate: 4, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'audioInput',
- 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: '2026-02-19',
- settings: {
- extendParams: ['thinkingLevel3', 'urlContext'],
- searchImpl: 'params',
- searchProvider: 'google',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- structuredOutput: true,
- video: true,
- vision: true,
- },
- contextWindowTokens: 1_048_576 + 65_536,
- description:
- "Gemini 3.1 Flash-Lite is Google's most cost-efficient multimodal model, optimized for high-volume agentic tasks, translation, and data processing.",
- displayName: 'Gemini 3.1 Flash-Lite',
- enabled: true,
- id: 'gemini-3.1-flash-lite',
- maxOutput: 65_536,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'audioInput_cacheRead', rate: 0.05, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'videoInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'audioInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-05-07',
- settings: {
- extendParams: ['thinkingLevel', 'urlContext'],
- 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 Flash Preview is Google's latest best-value model, improving on Gemini 2.5 Flash.",
- displayName: 'Gemini 3 Flash Preview',
- id: 'gemini-3-flash-preview',
- maxOutput: 65_536,
- pricing: {
- units: [
- {
- name: 'textInput',
- rate: 0.5,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- { name: 'imageInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'videoInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'audioInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
- {
- name: 'textInput_cacheRead',
- rate: 0.05,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-12-17',
- settings: {
- extendParams: ['thinkingLevel', 'urlContext'],
- searchImpl: 'params',
- searchProvider: 'google',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- structuredOutput: true,
- video: true,
- vision: true,
- },
- contextWindowTokens: 1_048_576 + 65_536,
- description:
- "Gemini 3.1 Flash-Lite Preview is Google's most cost-efficient multimodal model, optimized for high-volume agentic tasks, translation, and data processing.",
- displayName: 'Gemini 3.1 Flash-Lite Preview',
- id: 'gemini-3.1-flash-lite-preview',
- maxOutput: 65_536,
- pricing: {
- units: [
- { name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'videoInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'audioInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-04',
- settings: {
- extendParams: ['thinkingLevel', 'urlContext'],
- 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 2.5 Pro is Google's most advanced reasoning model, able to reason over code, math, and STEM problems and analyze large datasets, codebases, and documents with long context.",
- displayName: 'Gemini 2.5 Pro',
- id: 'gemini-2.5-pro',
- maxOutput: 65_536,
- pricing: {
- units: [
- {
- name: 'textInput_cacheRead',
- strategy: 'tiered',
- tiers: [
- { rate: 0.31, upTo: 200_000 },
- { rate: 0.625, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textInput',
- strategy: 'tiered',
- tiers: [
- { rate: 1.25, upTo: 200_000 },
- { rate: 2.5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'imageInput',
- strategy: 'tiered',
- tiers: [
- { rate: 1.25, upTo: 200_000 },
- { rate: 2.5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'videoInput',
- strategy: 'tiered',
- tiers: [
- { rate: 1.25, upTo: 200_000 },
- { rate: 2.5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'audioInput',
- strategy: 'tiered',
- tiers: [
- { rate: 1.25, upTo: 200_000 },
- { rate: 2.5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textOutput',
- strategy: 'tiered',
- tiers: [
- { rate: 10, upTo: 200_000 },
- { rate: 15, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2025-06-17',
- 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 2.5 Flash is Google's best-value model with full capabilities.",
- displayName: 'Gemini 2.5 Flash',
- id: 'gemini-2.5-flash',
- maxOutput: 65_536,
- pricing: {
- units: [
- {
- name: 'textInput_cacheRead',
- rate: 0.03,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- {
- name: 'textInput',
- rate: 0.3,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- { name: 'imageInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'videoInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'audioInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-06-17',
- settings: {
- extendParams: ['enableReasoning', 'reasoningBudgetToken'],
- searchImpl: 'params',
- searchProvider: 'google',
- },
- type: 'chat',
- },
- {
- abilities: {
- imageOutput: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 131_072 + 32_768,
- description:
- 'Gemini 3.1 Flash Image (Nano Banana 2) delivers Pro-level image quality at Flash speed with multimodal chat support.',
- displayName: 'Nano Banana 2',
- enabled: true,
- id: 'gemini-3.1-flash-image-preview',
- maxOutput: 32_768,
- pricing: {
- approximatePricePerImage: 0.067,
- units: [
- { name: 'imageOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-02-26',
- settings: {
- searchImpl: 'params',
- searchProvider: 'google',
- },
- type: 'chat',
- },
- {
- abilities: {
- imageOutput: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 131_072 + 32_768,
- description:
- "Gemini 3 Pro Image (Nano Banana Pro) is Google's image generation model and also supports multimodal chat.",
- displayName: 'Nano Banana Pro',
- enabled: true,
- 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: 'imageInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- settings: {
- searchImpl: 'params',
- searchProvider: 'google',
- },
- type: 'chat',
- },
- {
- abilities: {
- imageOutput: true,
- vision: true,
- },
- contextWindowTokens: 65_536 + 32_768,
- description:
- "Nano Banana is Google's newest, fastest, and most efficient native multimodal model, enabling conversational image generation and editing.",
- displayName: 'Nano Banana',
- id: 'gemini-2.5-flash-image',
- maxOutput: 32_768,
- pricing: {
- approximatePricePerImage: 0.039,
- units: [
- { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-08-26',
- settings: {
- extendParams: ['imageAspectRatio'],
- },
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/index.ts b/packages/model-bank/src/aiModels/lobehub/chat/index.ts
deleted file mode 100644
index 67e3ed4ed7a..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/index.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-import { anthropicChatModels } from './anthropic';
-import { deepseekChatModels } from './deepseek';
-import { googleChatModels } from './google';
-import { mappingChatModels } from './mapping';
-import { minimaxChatModels } from './minimax';
-import { moonshotChatModels } from './moonshot';
-import { openaiChatModels } from './openai';
-import { xaiChatModels } from './xai';
-import { xiaomimimoChatModels } from './xiaomimimo';
-import { zhipuChatModels } from './zhipu';
-
-export const lobehubChatModels: AIChatModelCard[] = [
- ...deepseekChatModels,
- ...anthropicChatModels,
- ...googleChatModels,
- ...openaiChatModels,
- ...xaiChatModels,
- ...moonshotChatModels,
- ...minimaxChatModels,
- ...zhipuChatModels,
- ...xiaomimimoChatModels,
- ...mappingChatModels,
-];
-
-export { anthropicChatModels } from './anthropic';
-export { deepseekChatModels } from './deepseek';
-export { googleChatModels } from './google';
-export { mappingChatModels } from './mapping';
-export { minimaxChatModels } from './minimax';
-export { moonshotChatModels } from './moonshot';
-export { openaiChatModels } from './openai';
-export { xaiChatModels } from './xai';
-export { xiaomimimoChatModels } from './xiaomimimo';
-export { zhipuChatModels } from './zhipu';
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/mapping.ts b/packages/model-bank/src/aiModels/lobehub/chat/mapping.ts
deleted file mode 100644
index af1d5fca1b2..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/mapping.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-export const mappingChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- enabled: true,
- id: 'lobehub-onboarding-v1',
- settings: {
- extendParams: ['enableReasoning'],
- },
- type: 'chat',
- visible: false,
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/minimax.ts b/packages/model-bank/src/aiModels/lobehub/chat/minimax.ts
deleted file mode 100644
index 1abb4e57f40..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/minimax.ts
+++ /dev/null
@@ -1,187 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-export const minimaxChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 204_800,
- description:
- 'First self-evolving model with top-tier coding and agentic performance (~60 tps).',
- displayName: 'MiniMax M2.7',
- enabled: true,
- id: 'MiniMax-M2.7',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.06, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-18',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 204_800,
- description: 'Same performance as M2.7 with significantly faster inference (~100 tps).',
- displayName: 'MiniMax M2.7 Highspeed',
- enabled: true,
- id: 'MiniMax-M2.7-highspeed',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.06, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.4, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-18',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 204_800,
- description:
- 'Optimized for code generation and refactoring, delivering peak performance with ultimate value to master complex tasks.',
- displayName: 'MiniMax M2.5',
- enabled: true,
- id: 'MiniMax-M2.5',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.03, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-02-12',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 204_800,
- description: 'Same performance as M2.5 with significantly faster inference.',
- displayName: 'MiniMax M2.5 Highspeed',
- enabled: true,
- id: 'MiniMax-M2.5-highspeed',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.06, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.4, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-02-12',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 204_800,
- description:
- 'Powerful multilingual programming capabilities, comprehensively upgraded programming experience.',
- displayName: 'MiniMax M2.1',
- id: 'MiniMax-M2.1',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.03, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-12-23',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 204_800,
- description:
- 'Powerful multilingual programming capabilities with faster and more efficient inference.',
- displayName: 'MiniMax M2.1 Highspeed',
- id: 'MiniMax-M2.1-highspeed',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.06, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.4, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-12-23',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 204_800,
- description:
- 'Powerful multilingual programming capabilities with faster and more efficient inference.',
- displayName: 'MiniMax M2.1 Lightning',
- enabled: false,
- id: 'MiniMax-M2.1-Lightning',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.03, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.4, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-12-23',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- },
- contextWindowTokens: 204_800,
- description: 'Built for efficient coding and agent workflows.',
- displayName: 'MiniMax M2',
- id: 'MiniMax-M2-Stable',
- enabled: false,
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheWrite', rate: 0.375, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.03, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.2, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-10-27',
- settings: {
- searchImpl: 'params',
- },
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/moonshot.ts b/packages/model-bank/src/aiModels/lobehub/chat/moonshot.ts
deleted file mode 100644
index cd6aa317141..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/moonshot.ts
+++ /dev/null
@@ -1,156 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-export const moonshotChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- structuredOutput: true,
- video: true,
- vision: true,
- },
- contextWindowTokens: 262_144,
- description:
- "Kimi K2.6 is Kimi's latest and most capable model, delivering stronger long-horizon coding, instruction following, and self-correction while supporting text, image, and video inputs plus chat and agent tasks.",
- displayName: 'Kimi K2.6',
- enabled: true,
- id: 'kimi-k2.6',
- maxOutput: 32_768,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.95, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.16, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-04-20',
- settings: {
- extendParams: ['enableReasoning'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- structuredOutput: true,
- video: true,
- vision: true,
- },
- contextWindowTokens: 262_144,
- description:
- 'Kimi K2.5 is Kimi\'s most versatile model to date, featuring a native multimodal architecture that supports both vision and text inputs, "thinking" and "non-thinking" modes, and both conversational and agent tasks.',
- displayName: 'Kimi K2.5',
- enabled: true,
- id: 'kimi-k2.5',
- maxOutput: 32_768,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-01-27',
- settings: {
- extendParams: ['enableReasoning'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- search: true,
- },
- contextWindowTokens: 262_144,
- description:
- 'kimi-k2 is an MoE foundation model with strong coding and agent capabilities (1T total params, 32B active). Based on kimi-k2-0711-preview, with enhanced agentic coding abilities and better context understanding.',
- displayName: 'Kimi K2',
- id: 'kimi-k2-0905-preview',
- pricing: {
- units: [
- { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-09-05',
- settings: {
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- search: true,
- },
- contextWindowTokens: 262_144,
- description:
- 'High-speed version of kimi-k2, always aligned with the latest kimi-k2. Same model parameters, output speed up to 60–100 tokens/sec.',
- displayName: 'Kimi K2 Turbo',
- id: 'kimi-k2-turbo-preview',
- pricing: {
- units: [
- { name: 'textInput', rate: 1.15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-09-05',
- settings: {
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- },
- contextWindowTokens: 262_144,
- description:
- 'K2 thinking model with general agentic and reasoning capabilities, specializing in deep reasoning tasks via multi-step tool use.',
- displayName: 'Kimi K2 Thinking',
- id: 'kimi-k2-thinking',
- pricing: {
- units: [
- { name: 'textInput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-11-06',
- settings: {
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- },
- contextWindowTokens: 262_144,
- description:
- 'High-speed version of kimi-k2-thinking, suitable for scenarios requiring both deep reasoning and extremely fast responses.',
- displayName: 'Kimi K2 Thinking Turbo',
- id: 'kimi-k2-thinking-turbo',
- pricing: {
- units: [
- { name: 'textInput', rate: 1.15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-11-06',
- settings: {
- searchImpl: 'params',
- },
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/openai.ts b/packages/model-bank/src/aiModels/lobehub/chat/openai.ts
deleted file mode 100644
index 1e834404ce3..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/openai.ts
+++ /dev/null
@@ -1,533 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-export const openaiChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 1_050_000,
- description:
- "GPT-5.5 is OpenAI's latest frontier model for complex professional work, coding, and agentic tasks.",
- displayName: 'GPT-5.5',
- enabled: true,
- id: 'gpt-5.5',
- maxOutput: 128_000,
- pricing: {
- units: [
- {
- name: 'textInput',
- strategy: 'tiered',
- tiers: [
- { rate: 5, upTo: 272_000 },
- { rate: 10, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textInput_cacheRead',
- strategy: 'tiered',
- tiers: [
- { rate: 0.5, upTo: 272_000 },
- { rate: 1, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textOutput',
- strategy: 'tiered',
- tiers: [
- { rate: 30, upTo: 272_000 },
- { rate: 45, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-04-23',
- settings: {
- extendParams: ['gpt5_2ReasoningEffort', 'textVerbosity'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 1_050_000,
- description:
- "GPT-5.4 is OpenAI's latest model for complex professional work and a drop-in replacement for GPT-5.2 and GPT-5.3 Codex.",
- displayName: 'GPT-5.4',
- enabled: true,
- id: 'gpt-5.4',
- maxOutput: 128_000,
- pricing: {
- units: [
- {
- name: 'textInput',
- strategy: 'tiered',
- tiers: [
- { rate: 2.5, upTo: 272_000 },
- { rate: 5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textInput_cacheRead',
- strategy: 'tiered',
-
- tiers: [
- { rate: 0.25, upTo: 272_000 },
- { rate: 0.5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textOutput',
- strategy: 'tiered',
-
- tiers: [
- { rate: 15, upTo: 272_000 },
- { rate: 22.5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-03-05',
- settings: {
- extendParams: ['gpt5_2ReasoningEffort', 'textVerbosity'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 1_050_000,
- description:
- 'GPT-5.4 Pro uses more compute to think harder and provide the best answers for the hardest problems.',
- displayName: 'GPT-5.4 Pro',
- enabled: true,
- id: 'gpt-5.4-pro',
- maxOutput: 128_000,
- pricing: {
- units: [
- {
- name: 'textInput',
- strategy: 'tiered',
- tiers: [
- { rate: 30, upTo: 272_000 },
- { rate: 60, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textOutput',
- strategy: 'tiered',
-
- tiers: [
- { rate: 180, upTo: 272_000 },
- { rate: 270, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-03-05',
- settings: {
- extendParams: ['gpt5_2ProReasoningEffort', 'textVerbosity'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 400_000,
- description:
- "GPT-5.4 mini is OpenAI's strongest mini model for coding, computer use, and subagents.",
- displayName: 'GPT-5.4 mini',
- enabled: true,
- id: 'gpt-5.4-mini',
- maxOutput: 128_000,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.75, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.075, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 4.5, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-18',
- settings: {
- extendParams: ['gpt5_2ReasoningEffort', 'textVerbosity'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 400_000,
- description:
- "GPT-5.4 nano is OpenAI's cheapest GPT-5.4-class model for simple high-volume tasks.",
- displayName: 'GPT-5.4 nano',
- enabled: true,
- id: 'gpt-5.4-nano',
- maxOutput: 128_000,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.02, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-18',
- settings: {
- extendParams: ['gpt5_2ReasoningEffort', 'textVerbosity'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 400_000,
- description:
- "GPT-5.2 — OpenAI's flagship model optimized for coding and agent tasks across industries.",
- displayName: 'GPT-5.2',
- enabled: true,
- id: 'gpt-5.2',
- maxOutput: 128_000,
- pricing: {
- units: [
- { name: 'textInput', rate: 1.75, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.175, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 14, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-12-11',
- settings: {
- extendParams: ['gpt5_2ReasoningEffort', 'textVerbosity'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 400_000,
- description:
- 'GPT-5.1 — a flagship model optimized for coding and agent tasks with configurable reasoning effort and longer context.',
- displayName: 'GPT-5.1',
- enabled: true,
- id: 'gpt-5.1',
- maxOutput: 128_000,
- pricing: {
- units: [
- { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.125, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-11-13',
- settings: {
- extendParams: ['gpt5_1ReasoningEffort', 'textVerbosity'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 400_000,
- description:
- 'The best model for cross-domain coding and agent tasks. GPT-5 leaps in accuracy, speed, reasoning, context awareness, structured thinking, and problem solving.',
- displayName: 'GPT-5',
- id: 'gpt-5',
- maxOutput: 128_000,
- pricing: {
- units: [
- { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.13, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-08-07',
- settings: {
- extendParams: ['reasoningEffort'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 400_000,
- description:
- 'A faster, more cost-efficient GPT-5 variant for well-defined tasks, delivering quicker responses while maintaining quality.',
- displayName: 'GPT-5 mini',
- enabled: true,
- id: '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' },
- { name: 'textInput_cacheRead', rate: 0.03, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-08-07',
- settings: {
- extendParams: ['reasoningEffort'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 400_000,
- description:
- 'The fastest and most cost-effective GPT-5 variant, ideal for latency- and cost-sensitive applications.',
- displayName: 'GPT-5 nano',
- id: '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' },
- { name: 'textInput_cacheRead', rate: 0.01, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-08-07',
- type: 'chat',
- },
- {
- abilities: {
- vision: true,
- },
- contextWindowTokens: 400_000,
- description:
- 'The GPT-5 model used in ChatGPT, combining strong understanding and generation for conversational applications.',
- displayName: 'GPT-5 Chat',
- enabled: true,
- id: 'gpt-5-chat-latest',
- maxOutput: 128_000,
- pricing: {
- units: [
- { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.13, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-08-07',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 1_047_576,
- description:
- 'GPT-4.1 is our flagship model for complex tasks and cross-domain problem solving.',
- displayName: 'GPT-4.1',
- id: 'gpt-4.1',
- maxOutput: 32_768,
- pricing: {
- units: [
- { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-04-14',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 1_047_576,
- description:
- 'GPT-4.1 mini balances intelligence, speed, and cost, making it attractive for many use cases.',
- displayName: 'GPT-4.1 mini',
- id: 'gpt-4.1-mini',
- maxOutput: 32_768,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.6, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-04-14',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 1_047_576,
- description:
- 'GPT-4.1 mini balances intelligence, speed, and cost, making it attractive for many use cases.',
- displayName: 'GPT-4.1 nano',
- id: 'gpt-4.1-nano',
- maxOutput: 32_768,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.025, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-04-14',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description:
- "GPT-4o mini is OpenAI's latest model after GPT-4 Omni, supporting text+image input with text output. It is their most advanced small model, far cheaper than recent frontier models and over 60% cheaper than GPT-3.5 Turbo, while maintaining top-tier intelligence (82% MMLU).",
- displayName: 'GPT-4o mini',
- id: 'gpt-4o-mini',
- maxOutput: 16_385,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.15, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.075, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2024-07-18',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description:
- 'ChatGPT-4o is a dynamic model updated in real time. It combines strong understanding and generation for large-scale use cases like customer support, education, and technical support.',
- displayName: 'GPT-4o',
- id: 'gpt-4o',
- pricing: {
- units: [
- { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2024-05-13',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description:
- 'The latest GPT-4 Turbo adds vision. Visual requests support JSON mode and function calling. It is a cost-effective multimodal model that balances accuracy and efficiency for real-time applications.',
- displayName: 'GPT-4 Turbo',
- id: 'gpt-4-turbo',
- pricing: {
- units: [
- { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 200_000,
- description:
- 'o3 is a strong all-round model that sets a new bar for math, science, programming, and visual reasoning. It excels at technical writing and instruction following, and can analyze text, code, and images for multi-step problems.',
- displayName: 'o3',
- id: 'o3',
- maxOutput: 100_000,
- pricing: {
- units: [
- { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-04-17',
- settings: {
- extendParams: ['reasoningEffort'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 200_000,
- description:
- 'o4-mini is the latest small o-series model, optimized for fast, effective reasoning with high efficiency in coding and vision tasks.',
- displayName: 'o4-mini',
- id: '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' },
- { name: 'textInput_cacheRead', rate: 0.275, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-04-17',
- settings: {
- extendParams: ['reasoningEffort'],
- },
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/xai.ts b/packages/model-bank/src/aiModels/lobehub/chat/xai.ts
deleted file mode 100644
index a175b170f48..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/xai.ts
+++ /dev/null
@@ -1,150 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-export const xaiChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 1_000_000,
- description: 'The most truth-seeking large language model in the world',
- displayName: 'Grok 4.3',
- enabled: true,
- id: 'grok-4.3',
- 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: 1.25, upTo: 200_000 },
- { rate: 2.5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textOutput',
- strategy: 'tiered',
- tiers: [
- { rate: 2.5, upTo: 200_000 },
- { rate: 5, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-05-01',
- settings: {
- extendParams: ['grok4_3ReasoningEffort'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 2_000_000,
- description: 'Intelligent, blazing-fast model that reasons before responding',
- displayName: 'Grok 4.20 Beta',
- enabled: true,
- id: 'grok-4.20-beta-0309-reasoning',
- 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: 6, upTo: 200_000 },
- { rate: 12, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-03-09',
- settings: {
- searchImpl: 'params',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 2_000_000,
- description: 'A non-reasoning variant for simple use cases',
- displayName: 'Grok 4.20 Beta (Non-Reasoning)',
- enabled: true,
- id: 'grok-4.20-beta-0309-non-reasoning',
- 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: 6, upTo: 200_000 },
- { rate: 12, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-03-09',
- settings: {
- searchImpl: 'params',
- },
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/xiaomimimo.ts b/packages/model-bank/src/aiModels/lobehub/chat/xiaomimimo.ts
deleted file mode 100644
index d1bd0936d93..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/xiaomimimo.ts
+++ /dev/null
@@ -1,235 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-// Authoritative pricing + capability + RPM/TPM reference:
-// https://platform.xiaomimimo.com/docs/pricing (SPA — fetch via chrome-devtools MCP, not WebFetch)
-// Model detail pages:
-// https://mimo.xiaomi.com/mimo-v2-5-pro (URL uses dashes for dots)
-// https://mimo.xiaomi.com/mimo-v2-5
-// IMPORTANT: Xiaomi's Token Plan (Credits subscription) billing and the
-// per-token API billing are separate. Announcements like "unified 256K/1M
-// Credit multiplier" only affect Token Plan; the per-token API billing still
-// keeps context-tiered pricing (0-256K / 256K-1M). Always cross-check
-// /docs/pricing when updating these rates.
-export const xiaomimimoChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: false,
- },
- contextWindowTokens: 1_000_000,
- description:
- 'Xiaomi MiMo-V2.5-Pro is the flagship of the MiMo-V2.5 series. It retains the 1T total / 42B active hybrid-attention architecture with a 1M context window, and delivers major gains in general agentic capabilities, complex software engineering, and long-horizon tasks (more than a thousand tool calls per task). Performance on demanding agentic benchmarks is comparable to Claude Opus 4.6.',
- displayName: 'MiMo-V2.5 Pro',
- enabled: true,
- id: 'mimo-v2.5-pro',
- maxOutput: 131_072,
- pricing: {
- units: [
- {
- name: 'textInput',
- strategy: 'tiered',
- tiers: [
- { rate: 1, upTo: 256_000 },
- { rate: 2, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textInput_cacheRead',
- strategy: 'tiered',
- tiers: [
- { rate: 0.2, upTo: 256_000 },
- { rate: 0.4, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- // Cache write is temporarily free per official announcement
- // TODO: restore actual pricing when promotion ends
- { name: 'textInput_cacheWrite', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- {
- name: 'textOutput',
- strategy: 'tiered',
- tiers: [
- { rate: 3, upTo: 256_000 },
- { rate: 6, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-04-22',
- settings: {
- extendParams: ['enableReasoning'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: false,
- video: true,
- vision: true,
- },
- contextWindowTokens: 1_000_000,
- description:
- 'Xiaomi MiMo-V2.5 is a native omni-modal Agent foundation model with 1M context that understands images, video, audio, and text in a unified architecture. It delivers Pro-level agentic performance at roughly half the inference cost, with stronger multimodal perception than MiMo-V2-Omni and faster inference — a strong fit for latency-sensitive, multi-step agent frameworks.',
- displayName: 'MiMo-V2.5',
- enabled: true,
- id: 'mimo-v2.5',
- maxOutput: 131_072,
- pricing: {
- units: [
- {
- name: 'textInput',
- strategy: 'tiered',
- tiers: [
- { rate: 0.4, upTo: 256_000 },
- { rate: 0.8, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textInput_cacheRead',
- strategy: 'tiered',
- tiers: [
- { rate: 0.08, upTo: 256_000 },
- { rate: 0.16, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- // Cache write is temporarily free per official announcement
- // TODO: restore actual pricing when promotion ends
- { name: 'textInput_cacheWrite', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- {
- name: 'textOutput',
- strategy: 'tiered',
- tiers: [
- { rate: 2, upTo: 256_000 },
- { rate: 4, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-04-22',
- settings: {
- extendParams: ['enableReasoning'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: false,
- },
- contextWindowTokens: 1_000_000,
- description:
- 'Xiaomi MiMo-V2-Pro features over 1 trillion parameters (42B activated), an innovative hybrid attention architecture, and supports ultra-long context up to 1M tokens. Designed for high-intensity agent workflows with strong generalization from coding to real-world task execution.',
- displayName: 'MiMo-V2 Pro',
- enabled: true,
- id: 'mimo-v2-pro',
- maxOutput: 131_072,
- pricing: {
- units: [
- {
- name: 'textInput',
- strategy: 'tiered',
- tiers: [
- { rate: 1, upTo: 256_000 },
- { rate: 2, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- {
- name: 'textInput_cacheRead',
- strategy: 'tiered',
- tiers: [
- { rate: 0.2, upTo: 256_000 },
- { rate: 0.4, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- // Cache write is temporarily free per official announcement
- // TODO: restore actual pricing when promotion ends
- { name: 'textInput_cacheWrite', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- {
- name: 'textOutput',
- strategy: 'tiered',
- tiers: [
- { rate: 3, upTo: 256_000 },
- { rate: 6, upTo: 'infinity' },
- ],
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-03-18',
- settings: {
- extendParams: ['enableReasoning'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: false,
- video: true,
- vision: true,
- },
- contextWindowTokens: 262_144,
- description:
- 'MiMo-V2-Omni is a full-modality model integrating text, vision, and speech, unifying perception and action in a single architecture. It enables native multimodal perception, tool usage, and GUI operations for complex real-world interaction scenarios.',
- displayName: 'MiMo-V2 Omni',
- enabled: true,
- id: 'mimo-v2-omni',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.08, strategy: 'fixed', unit: 'millionTokens' },
- // Cache write is temporarily free per official announcement
- // TODO: restore actual pricing when promotion ends
- { name: 'textInput_cacheWrite', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-18',
- settings: {
- extendParams: ['enableReasoning'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: false,
- },
- contextWindowTokens: 262_144,
- description:
- 'MiMo-V2-Flash is a 309B MoE model (15B activated) optimized for extreme inference efficiency. It ranks among the top open-source models in agent benchmarks while delivering 2x generation speed at minimal cost.',
- displayName: 'MiMo-V2 Flash',
- enabled: true,
- id: 'mimo-v2-flash',
- maxOutput: 65_536,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.01, strategy: 'fixed', unit: 'millionTokens' },
- // Cache write is temporarily free per official announcement
- // TODO: restore actual pricing when promotion ends
- { name: 'textInput_cacheWrite', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-03',
- settings: {
- extendParams: ['enableReasoning'],
- },
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/chat/zhipu.ts b/packages/model-bank/src/aiModels/lobehub/chat/zhipu.ts
deleted file mode 100644
index b3dab730510..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/chat/zhipu.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import type { AIChatModelCard } from '../../../types/aiModel';
-
-// price: https://docs.z.ai/guides/overview/pricing
-// ref: https://docs.z.ai/guides/llm/glm-5.1
-
-export const zhipuChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: false,
- },
- contextWindowTokens: 200_000,
- description:
- "Zai's latest flagship model, aligned with Claude Opus 4.6 on overall and coding capabilities. Excels at long-horizon tasks with autonomous work up to 8 hours, an ideal foundation for Autonomous Agents and long-horizon Coding Agents.",
- displayName: 'GLM-5.1',
- enabled: true,
- id: 'glm-5.1',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 1.4, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.26, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 4.4, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-03-27',
- settings: {
- extendParams: ['enableReasoning'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- },
- contextWindowTokens: 200_000,
- description:
- "Zai's new-generation flagship foundation model, designed for Agentic Engineering, capable of providing reliable productivity in complex system engineering and long-range Agent tasks.",
- displayName: 'GLM-5',
- enabled: true,
- id: 'glm-5',
- maxOutput: 131_072,
- pricing: {
- units: [
- { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 3.2, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-02-12',
- settings: {
- extendParams: ['enableReasoning'],
- searchImpl: 'params',
- },
- type: 'chat',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/embedding.ts b/packages/model-bank/src/aiModels/lobehub/embedding.ts
deleted file mode 100644
index 069b1dc9b94..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/embedding.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import type { AIEmbeddingModelCard } from '../../types/aiModel';
-
-export const lobehubEmbeddingModels: AIEmbeddingModelCard[] = [
- {
- contextWindowTokens: 8192,
- description:
- 'An efficient, cost-effective next-generation embedding model for retrieval and RAG scenarios.',
- displayName: 'Text Embedding 3 Small',
- enabled: true,
- id: 'text-embedding-3-small',
- maxDimension: 1536,
- pricing: {
- currency: 'USD',
- units: [{ name: 'textInput', rate: 0.02, strategy: 'fixed', unit: 'millionTokens' }],
- },
- releasedAt: '2024-01-25',
- type: 'embedding',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/findModel.ts b/packages/model-bank/src/aiModels/lobehub/findModel.ts
deleted file mode 100644
index ccd1692d708..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/findModel.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import type { AiModelType } from 'model-bank';
-
-import { lobehubChatModels } from './chat';
-import { lobehubEmbeddingModels } from './embedding';
-import { lobehubImageModels } from './image';
-import { lobehubVideoModels } from './video';
-
-export const allModels = [
- ...lobehubChatModels,
- ...lobehubEmbeddingModels,
- ...lobehubImageModels,
- ...lobehubVideoModels,
-];
-
-export const findLobeHubModel = (id: string) => allModels.find((m) => m.id === id);
-
-export const isLobeHubModelAvailable = (id: string, expectedType: AiModelType) => {
- const model = findLobeHubModel(id);
- return !!model && model.type === expectedType;
-};
diff --git a/packages/model-bank/src/aiModels/lobehub/image.ts b/packages/model-bank/src/aiModels/lobehub/image.ts
deleted file mode 100644
index 901183f2aed..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/image.ts
+++ /dev/null
@@ -1,313 +0,0 @@
-import type { AIImageModelCard } from '../../types/aiModel';
-import { huanyuanImageParamsSchema, qwenEditParamsSchema, qwenImageParamsSchema } from '../fal';
-import {
- gptImage1Schema,
- gptImage2Schema,
- imagenBaseParameters,
- nanoBanana2Parameters,
- nanoBananaParameters,
- nanoBananaProParameters,
-} from './utils';
-
-export const lobehubImageModels: AIImageModelCard[] = [
- {
- description:
- 'Gemini 3.1 Flash Image (Nano Banana 2) delivers Pro-level image quality at Flash speed with multimodal chat support.',
- displayName: 'Nano Banana 2',
- enabled: true,
- id: 'gemini-3.1-flash-image-preview:image',
- parameters: nanoBanana2Parameters,
- pricing: {
- approximatePricePerImage: 0.067,
- units: [
- { name: 'imageOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput', rate: 0.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-02-26',
- type: 'image',
- },
- {
- description:
- "Gemini 3 Pro Image (Nano Banana Pro) is Google's image generation model and also supports multimodal chat.",
- displayName: 'Nano Banana Pro',
- enabled: true,
- id: 'gemini-3-pro-image-preview:image',
- 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' },
- ],
- },
- releasedAt: '2025-11-18',
- type: 'image',
- },
- {
- description:
- "Nano Banana is Google's newest, fastest, and most efficient native multimodal model, enabling conversational image generation and editing.",
- displayName: 'Nano Banana',
- id: 'gemini-2.5-flash-image:image',
- parameters: nanoBananaParameters,
- pricing: {
- approximatePricePerImage: 0.039,
- units: [
- { name: 'textInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-08-26',
- type: 'image',
- },
- {
- description: 'Imagen 4th generation text-to-image model series',
- displayName: 'Imagen 4 Fast',
- id: 'imagen-4.0-fast-generate-001',
- organization: 'Deepmind',
- parameters: imagenBaseParameters,
- pricing: {
- units: [{ name: 'imageGeneration', rate: 0.02, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2025-08-15',
- type: 'image',
- },
- {
- description: 'Imagen 4th generation text-to-image model series',
- displayName: 'Imagen 4',
- id: 'imagen-4.0-generate-001',
- organization: 'Deepmind',
- parameters: imagenBaseParameters,
- pricing: {
- units: [{ name: 'imageGeneration', rate: 0.04, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2025-08-15',
- type: 'image',
- },
- {
- description: 'Imagen 4th generation text-to-image model series Ultra version',
- displayName: 'Imagen 4 Ultra',
- id: 'imagen-4.0-ultra-generate-001',
- organization: 'Deepmind',
- parameters: imagenBaseParameters,
- pricing: {
- units: [{ name: 'imageGeneration', rate: 0.06, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2025-08-15',
- type: 'image',
- },
- {
- description:
- "OpenAI's next-generation multimodal image model with native reasoning, up to 4K resolution, near-perfect text rendering, and high-fidelity multilingual support.",
- displayName: 'GPT Image 2',
- enabled: true,
- id: 'gpt-image-2',
- parameters: gptImage2Schema,
- pricing: {
- // Medium quality at 1024x1024: ~1767 output tokens * $30/M = $0.053 per image.
- // Source: https://developers.openai.com/api/docs/guides/image-generation#calculating-costs
- approximatePricePerImage: 0.053,
- units: [
- { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput_cacheRead', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2026-04-21',
- type: 'image',
- },
- {
- description:
- 'An enhanced GPT Image 1 model with 4× faster generation, more precise editing, and improved text rendering.',
- displayName: 'GPT Image 1.5',
- enabled: true,
- id: 'gpt-image-1.5',
- parameters: gptImage1Schema,
- pricing: {
- approximatePricePerImage: 0.034,
- units: [
- { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput_cacheRead', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageOutput', rate: 32, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-12-16',
- type: 'image',
- },
- {
- description: 'ChatGPT native multimodal image generation model.',
- displayName: 'GPT Image 1',
- id: 'gpt-image-1',
- parameters: gptImage1Schema,
- pricing: {
- approximatePricePerImage: 0.042,
- units: [
- { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageInput_cacheRead', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'imageOutput', rate: 40, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'image',
- },
- {
- description:
- 'The latest DALL·E model, released in November 2023, supports more realistic, accurate image generation with stronger detail.',
- displayName: 'DALL·E 3',
- id: 'dall-e-3',
- parameters: {
- prompt: { default: '' },
- quality: {
- default: 'standard',
- enum: ['standard', 'hd'],
- },
- size: {
- default: '1024x1024',
- enum: ['1024x1024', '1792x1024', '1024x1792'],
- },
- },
- pricing: {
- approximatePricePerImage: 0.004,
- units: [
- {
- lookup: {
- prices: {
- hd_1024x1024: 0.08,
- hd_1024x1792: 0.12,
- hd_1792x1024: 0.12,
- standard_1024x1024: 0.04,
- standard_1024x1792: 0.08,
- standard_1792x1024: 0.08,
- },
- pricingParams: ['quality', 'size'],
- },
- name: 'imageGeneration',
- strategy: 'lookup',
- unit: 'image',
- },
- ],
- },
- type: 'image',
- },
- {
- description:
- 'ByteDance-Seedream-5.0-lite by BytePlus features web-retrieval-augmented generation for real-time information, enhanced complex prompt interpretation, and improved reference consistency for professional visual creation.',
- displayName: 'Seedream 5 Lite',
- enabled: true,
- id: 'seedream-5-0-260128',
- parameters: {
- imageUrls: { default: [], maxCount: 14, maxFileSize: 10 * 1024 * 1024 },
- prompt: { default: '' },
- seed: { default: null },
- size: {
- default: '2048x2048',
- enum: [
- '2048x2048',
- '2560x1440',
- '1440x2560',
- '3072x2048',
- '2048x3072',
- '2560x2048',
- '2048x2560',
- '3072x1920',
- '1920x3072',
- ],
- },
- },
- pricing: {
- units: [{ name: 'imageGeneration', rate: 0.035, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2026-02-24',
- type: 'image',
- },
- {
- description:
- 'Seedream 4.5, built by ByteDance Seed team, supports multi-image editing and composition. Features enhanced subject consistency, precise instruction following, spatial logic understanding, aesthetic expression, poster layout and logo design with high-precision text-image rendering.',
- displayName: 'Seedream 4.5',
- enabled: true,
- id: 'fal-ai/bytedance/seedream/v4.5',
- parameters: {
- height: { default: 2048, max: 4096, min: 1920, step: 1 },
- imageUrls: { default: [], maxCount: 10, maxFileSize: 10 * 1024 * 1024 },
- prompt: { default: '' },
- seed: { default: null },
- width: { default: 2048, max: 4096, min: 1920, step: 1 },
- },
- pricing: {
- units: [{ name: 'imageGeneration', rate: 0.04, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2025-12-04',
- type: 'image',
- },
- {
- description:
- 'Seedream 4.0, built by ByteDance Seed, supports text and image inputs for highly controllable, high-quality image generation from prompts.',
- displayName: 'Seedream 4.0',
- id: 'fal-ai/bytedance/seedream/v4',
- parameters: {
- height: { default: 1024, max: 4096, min: 1024, step: 1 },
- imageUrls: { default: [], maxCount: 10, maxFileSize: 10 * 1024 * 1024 },
- prompt: {
- default: '',
- },
- seed: { default: null },
- width: { default: 1024, max: 4096, min: 1024, step: 1 },
- },
- pricing: {
- units: [{ name: 'imageGeneration', rate: 0.03, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2025-09-09',
- type: 'image',
- },
- {
- description: 'A powerful native multimodal image generation model.',
- displayName: 'HunyuanImage 3.0',
- enabled: true,
- id: 'fal-ai/hunyuan-image/v3',
- parameters: huanyuanImageParamsSchema,
- pricing: {
- // Original price: 0.1 x 1024 x 1024 / 100_0000 = 0.1048576$
- units: [{ name: 'imageGeneration', rate: 0.11, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2025-09-28',
- type: 'image',
- },
- {
- description:
- 'A professional image editing model from the Qwen team, supporting semantic and appearance edits, precise Chinese/English text editing, style transfer, rotation, and more.',
- displayName: 'Qwen Edit',
- enabled: true,
- id: 'fal-ai/qwen-image-edit',
- parameters: qwenEditParamsSchema,
- pricing: {
- // https://fal.ai/models/fal-ai/qwen-image-edit
- // Original price: 0.03 x 1328 x 1328 / 100_0000 = 0.05290752
- units: [{ name: 'imageGeneration', rate: 0.06, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2025-08-19',
- type: 'image',
- },
- {
- description:
- 'A powerful image generation model from the Qwen team with strong Chinese text rendering and diverse visual styles.',
- displayName: 'Qwen Image',
- enabled: true,
- id: 'fal-ai/qwen-image',
- parameters: qwenImageParamsSchema,
- pricing: {
- // Original price: 0.02 x 1328 x 1328 / 100_0000 = 0.03527168
- units: [{ name: 'imageGeneration', rate: 0.04, strategy: 'fixed', unit: 'image' }],
- },
- releasedAt: '2025-08-04',
- type: 'image',
- },
-];
diff --git a/packages/model-bank/src/aiModels/lobehub/index.ts b/packages/model-bank/src/aiModels/lobehub/index.ts
deleted file mode 100644
index 2d30dcc68a4..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/index.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { allModels } from './findModel';
-
-export { lobehubChatModels } from './chat';
-export { lobehubEmbeddingModels } from './embedding';
-export * from './findModel';
-export { lobehubImageModels } from './image';
-export * from './utils';
-export {
- lobehubVideoModels,
- seedance15ProParams,
- seedance20FastParams,
- seedance20Params,
-} from './video';
-
-export default allModels;
diff --git a/packages/model-bank/src/aiModels/lobehub/utils.test.ts b/packages/model-bank/src/aiModels/lobehub/utils.test.ts
deleted file mode 100644
index ea1037b5a6c..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/utils.test.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import { describe, expect, it } from 'vitest';
-
-import { lobehubChatModels } from './chat';
-import { lobehubEmbeddingModels } from './embedding';
-import { findLobeHubModel, isLobeHubModelAvailable } from './findModel';
-import { lobehubImageModels } from './image';
-import { lobehubVideoModels } from './video';
-
-describe('findLobeHubModel', () => {
- it('prioritizes hosted DeepSeek models in the chat model list', () => {
- expect(lobehubChatModels.slice(0, 2).map((model) => model.id)).toEqual([
- 'deepseek-v4-pro',
- 'deepseek-v4-flash',
- ]);
- });
-
- it('returns the model when id exists in chat models', () => {
- const sample = lobehubChatModels[0];
- expect(findLobeHubModel(sample.id)).toMatchObject({ id: sample.id, type: 'chat' });
- });
-
- it('returns runtime-only hidden alias models', () => {
- expect(findLobeHubModel('lobehub-onboarding-v1')).toMatchObject({
- enabled: true,
- id: 'lobehub-onboarding-v1',
- type: 'chat',
- visible: false,
- });
- });
-
- it('returns the model when id exists in image / video / embedding models', () => {
- if (lobehubImageModels[0]) {
- expect(findLobeHubModel(lobehubImageModels[0].id)?.type).toBe('image');
- }
- if (lobehubVideoModels[0]) {
- expect(findLobeHubModel(lobehubVideoModels[0].id)?.type).toBe('video');
- }
- if (lobehubEmbeddingModels[0]) {
- expect(findLobeHubModel(lobehubEmbeddingModels[0].id)?.type).toBe('embedding');
- }
- });
-
- it('returns undefined for deprecated/unknown model ids', () => {
- expect(findLobeHubModel('claude-3-5-sonnet-latest')).toBeUndefined();
- expect(findLobeHubModel('gpt-3.5-turbo')).toBeUndefined();
- expect(findLobeHubModel('')).toBeUndefined();
- });
-});
-
-describe('isLobeHubModelAvailable', () => {
- it('returns true when id and expected type both match', () => {
- const sample = lobehubChatModels[0];
- expect(isLobeHubModelAvailable(sample.id, 'chat')).toBe(true);
- });
-
- it('treats runtime-only hidden alias models as available', () => {
- expect(isLobeHubModelAvailable('lobehub-onboarding-v1', 'chat')).toBe(true);
- });
-
- it('returns false when id matches but type differs', () => {
- const sample = lobehubChatModels[0];
- expect(isLobeHubModelAvailable(sample.id, 'image')).toBe(false);
- expect(isLobeHubModelAvailable(sample.id, 'video')).toBe(false);
- });
-
- it('returns false for deprecated/unknown ids regardless of type', () => {
- expect(isLobeHubModelAvailable('claude-3-5-sonnet-latest', 'chat')).toBe(false);
- expect(isLobeHubModelAvailable('seedance-2.0-lite', 'video')).toBe(false);
- });
-});
diff --git a/packages/model-bank/src/aiModels/lobehub/video.ts b/packages/model-bank/src/aiModels/lobehub/video.ts
deleted file mode 100644
index 25b538e7c56..00000000000
--- a/packages/model-bank/src/aiModels/lobehub/video.ts
+++ /dev/null
@@ -1,151 +0,0 @@
-import {
- PRESET_VIDEO_ASPECT_RATIOS,
- PRESET_VIDEO_RESOLUTIONS,
- type VideoModelParamsSchema,
-} from '../../standard-parameters/video';
-import { type AIVideoModelCard } from '../../types/aiModel';
-
-export const seedance20Params: VideoModelParamsSchema = {
- aspectRatio: {
- default: 'adaptive',
- enum: ['adaptive', ...PRESET_VIDEO_ASPECT_RATIOS],
- },
- duration: { default: 5, max: 15, min: 4 },
- endImageUrl: {
- aspectRatio: { max: 2.5, min: 0.4 },
- default: null,
- height: { max: 6000, min: 300 },
- maxFileSize: 30 * 1024 * 1024,
- requiresImageUrl: true,
- width: { max: 6000, min: 300 },
- },
- generateAudio: { default: true },
- imageUrls: {
- aspectRatio: { max: 2.5, min: 0.4 },
- default: [],
- height: { max: 6000, min: 300 },
- maxCount: 9,
- maxFileSize: 30 * 1024 * 1024,
- width: { max: 6000, min: 300 },
- },
- prompt: { default: '' },
- resolution: {
- default: '720p',
- enum: PRESET_VIDEO_RESOLUTIONS,
- },
- seed: { default: null },
-};
-
-export const seedance20FastParams: VideoModelParamsSchema = {
- ...seedance20Params,
- resolution: {
- default: '720p',
- enum: ['480p', '720p'],
- },
-};
-
-export const seedance15ProParams: VideoModelParamsSchema = {
- aspectRatio: {
- default: 'adaptive',
- enum: ['adaptive', ...PRESET_VIDEO_ASPECT_RATIOS],
- },
- cameraFixed: { default: false },
- duration: { default: 5, max: 12, min: 4 },
- endImageUrl: {
- aspectRatio: { max: 2.5, min: 0.4 },
- default: null,
- height: { max: 6000, min: 300 },
- maxFileSize: 30 * 1024 * 1024,
- requiresImageUrl: true,
- width: { max: 6000, min: 300 },
- },
- generateAudio: { default: true },
- imageUrl: {
- aspectRatio: { max: 2.5, min: 0.4 },
- default: null,
- height: { max: 6000, min: 300 },
- maxFileSize: 30 * 1024 * 1024,
- width: { max: 6000, min: 300 },
- },
- prompt: { default: '' },
- resolution: {
- default: '720p',
- enum: PRESET_VIDEO_RESOLUTIONS,
- },
- seed: { default: null },
-};
-
-export const lobehubVideoModels: AIVideoModelCard[] = [
- {
- description:
- 'Seedance 2.0 by ByteDance is the most powerful video generation model, supporting multimodal reference video generation, video editing, video extension, text-to-video, and image-to-video with synchronized audio.',
- displayName: 'Seedance 2.0',
- enabled: true,
- id: 'dreamina-seedance-2-0-260128',
- organization: 'ByteDance',
- parameters: seedance20Params,
- pricing: {
- approximatePricePerVideo: 0.76,
- units: [
- {
- lookup: {
- pricingParams: ['resolution'],
- prices: { '1080p': 7.7, '480p': 7, '720p': 7 },
- },
- name: 'videoGeneration',
- strategy: 'lookup',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-01-28',
- type: 'video',
- },
- {
- description:
- 'Seedance 2.0 Fast by ByteDance offers the same capabilities as Seedance 2.0 with faster generation speeds at a more competitive price.',
- displayName: 'Seedance 2.0 Fast',
- enabled: true,
- id: 'dreamina-seedance-2-0-fast-260128',
- organization: 'ByteDance',
- parameters: seedance20FastParams,
- pricing: {
- approximatePricePerVideo: 0.6,
- units: [
- {
- name: 'videoGeneration',
- rate: 5.6,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2026-01-28',
- type: 'video',
- },
- {
- description:
- 'Seedance 1.5 Pro by ByteDance supports text-to-video, image-to-video (first frame, first+last frame), and audio generation synchronized with visuals.',
- displayName: 'Seedance 1.5 Pro',
- enabled: true,
- id: 'seedance-1-5-pro-251215',
- organization: 'ByteDance',
- parameters: seedance15ProParams,
- pricing: {
- approximatePricePerVideo: 0.25,
- units: [
- {
- lookup: {
- pricingParams: ['generateAudio'],
- prices: { false: 1.2, true: 2.4 },
- },
- name: 'videoGeneration',
- strategy: 'lookup',
- unit: 'millionTokens',
- },
- ],
- },
- releasedAt: '2025-12-15',
- type: 'video',
- },
-];
diff --git a/packages/model-bank/src/aiModels/openai.ts b/packages/model-bank/src/aiModels/openai.ts
index 0dc077e269a..8313a6ad1f6 100644
--- a/packages/model-bank/src/aiModels/openai.ts
+++ b/packages/model-bank/src/aiModels/openai.ts
@@ -1,13 +1,13 @@
-import {
- type AIChatModelCard,
- type AIEmbeddingModelCard,
- type AIImageModelCard,
- type AIRealtimeModelCard,
- type AISTTModelCard,
- type AITTSModelCard,
- type AIVideoModelCard,
+import { gptImage1Schema, gptImage2Schema } from '../const/imageParameters';
+import type {
+ AIChatModelCard,
+ AIEmbeddingModelCard,
+ AIImageModelCard,
+ AIRealtimeModelCard,
+ AISTTModelCard,
+ AITTSModelCard,
+ AIVideoModelCard,
} from '../types/aiModel';
-import { gptImage1Schema, gptImage2Schema } from './lobehub';
export const openaiChatModels: AIChatModelCard[] = [
{
diff --git a/packages/model-bank/src/aiModels/vertexai.ts b/packages/model-bank/src/aiModels/vertexai.ts
index 5cca45d1f7e..60e15ead827 100644
--- a/packages/model-bank/src/aiModels/vertexai.ts
+++ b/packages/model-bank/src/aiModels/vertexai.ts
@@ -1,5 +1,6 @@
-import { type AIChatModelCard, type AIImageModelCard } from '../types/aiModel';
-import { imagenGenParameters, nanoBananaParameters } from './google';
+import { nanoBananaParameters } from '../const/imageParameters';
+import type { AIChatModelCard, AIImageModelCard } from '../types/aiModel';
+import { imagenGenParameters } from './google';
// ref: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models
const vertexaiChatModels: AIChatModelCard[] = [
diff --git a/packages/model-bank/src/aiModels/volcengine.ts b/packages/model-bank/src/aiModels/volcengine.ts
index f08256fbbc4..e162df3d264 100644
--- a/packages/model-bank/src/aiModels/volcengine.ts
+++ b/packages/model-bank/src/aiModels/volcengine.ts
@@ -1,12 +1,78 @@
+import {
+ PRESET_VIDEO_ASPECT_RATIOS,
+ PRESET_VIDEO_RESOLUTIONS,
+ type VideoModelParamsSchema,
+} from '../standard-parameters/video';
import {
type AIChatModelCard,
type AIImageModelCard,
type AIVideoModelCard,
} from '../types/aiModel';
-import { seedance15ProParams, seedance20Params } from './lobehub/video';
// https://www.volcengine.com/docs/82379/1330310
+const seedance20Params: VideoModelParamsSchema = {
+ aspectRatio: {
+ default: 'adaptive',
+ enum: ['adaptive', ...PRESET_VIDEO_ASPECT_RATIOS],
+ },
+ duration: { default: 5, max: 15, min: 4 },
+ endImageUrl: {
+ aspectRatio: { max: 2.5, min: 0.4 },
+ default: null,
+ height: { max: 6000, min: 300 },
+ maxFileSize: 30 * 1024 * 1024,
+ requiresImageUrl: true,
+ width: { max: 6000, min: 300 },
+ },
+ generateAudio: { default: true },
+ imageUrls: {
+ aspectRatio: { max: 2.5, min: 0.4 },
+ default: [],
+ height: { max: 6000, min: 300 },
+ maxCount: 9,
+ maxFileSize: 30 * 1024 * 1024,
+ width: { max: 6000, min: 300 },
+ },
+ prompt: { default: '' },
+ resolution: {
+ default: '720p',
+ enum: PRESET_VIDEO_RESOLUTIONS,
+ },
+ seed: { default: null },
+};
+
+const seedance15ProParams: VideoModelParamsSchema = {
+ aspectRatio: {
+ default: 'adaptive',
+ enum: ['adaptive', ...PRESET_VIDEO_ASPECT_RATIOS],
+ },
+ cameraFixed: { default: false },
+ duration: { default: 5, max: 12, min: 4 },
+ endImageUrl: {
+ aspectRatio: { max: 2.5, min: 0.4 },
+ default: null,
+ height: { max: 6000, min: 300 },
+ maxFileSize: 30 * 1024 * 1024,
+ requiresImageUrl: true,
+ width: { max: 6000, min: 300 },
+ },
+ generateAudio: { default: true },
+ imageUrl: {
+ aspectRatio: { max: 2.5, min: 0.4 },
+ default: null,
+ height: { max: 6000, min: 300 },
+ maxFileSize: 30 * 1024 * 1024,
+ width: { max: 6000, min: 300 },
+ },
+ prompt: { default: '' },
+ resolution: {
+ default: '720p',
+ enum: PRESET_VIDEO_RESOLUTIONS,
+ },
+ seed: { default: null },
+};
+
const doubaoChatModels: AIChatModelCard[] = [
{
abilities: {
diff --git a/packages/model-bank/src/aiModels/lobehub/utils.ts b/packages/model-bank/src/const/imageParameters.ts
similarity index 67%
rename from packages/model-bank/src/aiModels/lobehub/utils.ts
rename to packages/model-bank/src/const/imageParameters.ts
index 0f2c8ab5773..47ceb4b4d3f 100644
--- a/packages/model-bank/src/aiModels/lobehub/utils.ts
+++ b/packages/model-bank/src/const/imageParameters.ts
@@ -1,15 +1,6 @@
-import type { ModelParamsSchema } from 'model-bank';
+import type { ModelParamsSchema } from '../standard-parameters';
-// Common parameters for Imagen models
-export const imagenBaseParameters: ModelParamsSchema = {
- aspectRatio: {
- default: '1:1',
- enum: ['1:1', '16:9', '9:16', '3:4', '4:3'],
- },
- prompt: { default: '' },
-};
-
-export const NANO_BANANA_ASPECT_RATIOS = [
+const NANO_BANANA_ASPECT_RATIOS = [
'auto',
'1:1', // 1024x1024 / 2048x2048 / 4096x4096
'2:3', // 848x1264 / 1696x2528 / 3392x5056
@@ -23,6 +14,35 @@ export const NANO_BANANA_ASPECT_RATIOS = [
'21:9', // 1584x672 / 3168x1344 / 6336x2688
];
+const NANO_BANANA_2_ASPECT_RATIOS = [...NANO_BANANA_ASPECT_RATIOS, '1:4', '4:1', '1:8', '8:1'];
+
+export const gptImage1Schema: ModelParamsSchema = {
+ imageUrls: { default: [], maxCount: 1, maxFileSize: 5 * 1024 * 1024 },
+ prompt: { default: '' },
+ size: {
+ default: 'auto',
+ enum: ['auto', '1024x1024', '1536x1024', '1024x1536'],
+ },
+};
+
+export const gptImage2Schema: ModelParamsSchema = {
+ imageUrls: { default: [], maxCount: 1, maxFileSize: 5 * 1024 * 1024 },
+ prompt: { default: '' },
+ size: {
+ default: 'auto',
+ enum: [
+ 'auto',
+ '1024x1024',
+ '1536x1024',
+ '1024x1536',
+ '2048x2048',
+ '2048x1152',
+ '3840x2160',
+ '2160x3840',
+ ],
+ },
+};
+
export const nanoBananaParameters: ModelParamsSchema = {
aspectRatio: {
default: 'auto',
@@ -49,14 +69,6 @@ export const nanoBananaProParameters: ModelParamsSchema = {
},
};
-export const NANO_BANANA_2_ASPECT_RATIOS = [
- ...NANO_BANANA_ASPECT_RATIOS,
- '1:4',
- '4:1',
- '1:8',
- '8:1',
-];
-
export const nanoBanana2Parameters: ModelParamsSchema = {
aspectRatio: {
default: 'auto',
@@ -68,37 +80,8 @@ export const nanoBanana2Parameters: ModelParamsSchema = {
prompt: { default: '' },
resolution: {
default: '1K',
+ // Gemini image generation API accepts `"512" | "1K" | "2K" | "4K"`.
+ // See https://ai.google.dev/gemini-api/docs/image-generation
enum: ['512', '1K', '2K', '4K'],
},
};
-
-export const gptImage1Schema = {
- imageUrls: { default: [], maxCount: 1, maxFileSize: 5 * 1024 * 1024 },
- prompt: { default: '' },
- size: {
- default: 'auto',
- enum: ['auto', '1024x1024', '1536x1024', '1024x1536'],
- },
-};
-
-// gpt-image-2 accepts any resolution satisfying: max edge ≤ 3840px, both edges
-// multiples of 16px, aspect ratio ≤ 3:1, pixels between 655,360 and 8,294,400.
-// Until the schema/UI supports free-form W×H input, we expose the official
-// "Popular sizes" list from https://developers.openai.com/docs/guides/image-generation.
-export const gptImage2Schema = {
- imageUrls: { default: [], maxCount: 1, maxFileSize: 5 * 1024 * 1024 },
- prompt: { default: '' },
- size: {
- default: 'auto',
- enum: [
- 'auto',
- '1024x1024',
- '1536x1024',
- '1024x1536',
- '2048x2048',
- '2048x1152',
- '3840x2160',
- '2160x3840',
- ],
- },
-};
diff --git a/packages/model-bank/src/exports.test.ts b/packages/model-bank/src/exports.test.ts
index e3905b5e570..ace0161c282 100644
--- a/packages/model-bank/src/exports.test.ts
+++ b/packages/model-bank/src/exports.test.ts
@@ -14,9 +14,9 @@ describe('model-bank package.json exports should cover all aiModels files', () =
};
const allModelFiles = readdirSync(aiModelsDir)
- .filter((f) => f.endsWith('.ts'))
+ .filter((f) => f.endsWith('.ts') && !f.endsWith('.test.ts'))
.map((f) => f.replace(/\.ts$/, ''))
- // 排除非 provider 文件,如 index、类型声明等
+ // Exclude non-provider entry files.
.filter((name) => !['index'].includes(name));
it('every aiModels file should be exported in package.json.exports', () => {
diff --git a/packages/model-bank/src/index.ts b/packages/model-bank/src/index.ts
index 8604e8cde00..412b7e1b22c 100644
--- a/packages/model-bank/src/index.ts
+++ b/packages/model-bank/src/index.ts
@@ -2,3 +2,4 @@ export * from './aiModels';
export * from './const/modelProvider';
export * from './standard-parameters';
export * from './types';
+export * from './utils';
diff --git a/packages/model-bank/src/utils.ts b/packages/model-bank/src/utils.ts
new file mode 100644
index 00000000000..84c5d018cc5
--- /dev/null
+++ b/packages/model-bank/src/utils.ts
@@ -0,0 +1,15 @@
+import type { AiModelType, LobeDefaultAiModelListItem } from './types';
+
+export const isProviderModelAvailable = (
+ models: LobeDefaultAiModelListItem[],
+ providerId: string,
+ id: string,
+ expectedType: AiModelType,
+): boolean =>
+ models.some(
+ (model) =>
+ model.providerId === providerId &&
+ model.id === id &&
+ model.enabled !== false &&
+ model.type === expectedType,
+ );
diff --git a/packages/model-bank/tsdown.config.ts b/packages/model-bank/tsdown.config.ts
index d5bfaa21c2a..a081c0fa581 100644
--- a/packages/model-bank/tsdown.config.ts
+++ b/packages/model-bank/tsdown.config.ts
@@ -12,7 +12,6 @@ export default defineConfig({
'src/modelProviders/lobehub.ts',
'src/types/index.ts',
'src/aiModels/*.ts',
- 'src/aiModels/lobehub/index.ts',
],
fixedExtension: false,
format: ['esm'],
diff --git a/packages/model-runtime/package.json b/packages/model-runtime/package.json
index 7d9d37f1748..97cd56a3d8b 100644
--- a/packages/model-runtime/package.json
+++ b/packages/model-runtime/package.json
@@ -19,6 +19,7 @@
"@fal-ai/client": "^1.7.2",
"@google/genai": "^1.43.0",
"@huggingface/inference": "^4.13.4",
+ "@lobechat/business-model-bank": "workspace:*",
"@lobechat/business-model-runtime": "workspace:*",
"@lobechat/const": "workspace:*",
"@lobechat/utils": "workspace:*",
diff --git a/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts b/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts
index 67fda1432f0..a44c4d7796f 100644
--- a/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts
+++ b/packages/model-runtime/src/core/usageConverters/utils/computeChatCost.test.ts
@@ -4,7 +4,6 @@ import anthropicChatModels from 'model-bank/anthropic';
import azureChatModels from 'model-bank/azure';
import deepseekChatModels from 'model-bank/deepseek';
import googleChatModels from 'model-bank/google';
-import { lobehubChatModels } from 'model-bank/lobehub';
import openaiChatModels from 'model-bank/openai';
import vertexAiModels from 'model-bank/vertexai';
import { describe, expect, it } from 'vitest';
@@ -133,6 +132,12 @@ describe('computeChatPricing', () => {
});
describe('LobeHub-hosted DeepSeek', () => {
+ interface HostedPricingCase {
+ expectedCredits: Record<string, number>;
+ expectedUnits: Pricing['units'];
+ modelId: string;
+ }
+
const usage: ModelTokensUsage = {
inputCacheMissTokens: 1_000_000,
inputCachedTokens: 1_000_000,
@@ -143,7 +148,7 @@ describe('computeChatPricing', () => {
totalTokens: 3_000_000,
};
- it.each([
+ const hostedPricingCases = [
{
expectedCredits: {
textInput: 140_000,
@@ -214,12 +219,12 @@ describe('computeChatPricing', () => {
],
modelId: 'deepseek-reasoner',
},
- ])(
+ ] satisfies HostedPricingCase[];
+
+ it.each(hostedPricingCases)(
'applies LobeHub-hosted official pricing for $modelId',
({ expectedCredits, expectedUnits, modelId }) => {
- const pricing = lobehubChatModels.find((model) => model.id === modelId)?.pricing;
- expect(pricing).toBeDefined();
- expect(pricing?.units).toEqual(expectedUnits);
+ const pricing: Pricing = { units: expectedUnits };
const result = computeChatCost(pricing, usage);
expect(result).toBeDefined();
@@ -364,7 +369,7 @@ describe('computeChatPricing', () => {
});
it('charges Gemini 3.1 Flash-Lite cached audio and cache writes across Google cards', () => {
- const modelLists = [googleChatModels, lobehubChatModels, vertexAiModels];
+ const modelLists = [googleChatModels, vertexAiModels];
for (const models of modelLists) {
const pricing = models.find(
@@ -412,11 +417,16 @@ describe('computeChatPricing', () => {
}
});
- it('charges multimodal input units for LobeHub-hosted Gemini 3 Flash', () => {
- const pricing = lobehubChatModels.find(
- (model: { id: string }) => model.id === 'gemini-3-flash-preview',
- )?.pricing;
- expect(pricing).toBeDefined();
+ it('charges multimodal input units for custom Gemini 3 Flash pricing', () => {
+ const pricing: Pricing = {
+ units: [
+ { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'imageInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'videoInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'audioInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ };
const usage: ModelTokensUsage = {
inputAudioTokens: 400,
@@ -443,11 +453,16 @@ describe('computeChatPricing', () => {
expect(breakdown.find((item) => item.unit.name === 'textOutput')?.credits).toBe(30);
});
- it('charges multimodal input units for LobeHub-hosted tiered Gemini Pro', () => {
- const pricing = lobehubChatModels.find(
- (model: { id: string }) => model.id === 'gemini-2.5-pro',
- )?.pricing;
- expect(pricing).toBeDefined();
+ it('charges multimodal input units for custom Gemini Pro pricing', () => {
+ const pricing: Pricing = {
+ units: [
+ { name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'imageInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'videoInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'audioInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ };
const usage: ModelTokensUsage = {
inputAudioTokens: 400,
@@ -556,10 +571,14 @@ describe('computeChatPricing', () => {
});
it('charges image input at the official Gemini 3.1 Flash Image rate', () => {
- const pricing = lobehubChatModels.find(
- (model: { id: string }) => model.id === 'gemini-3.1-flash-image-preview',
- )?.pricing;
- expect(pricing).toBeDefined();
+ const pricing: Pricing = {
+ units: [
+ { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'imageInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'imageOutput', rate: 60, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ };
const usage: ModelTokensUsage = {
inputImageTokens: 200,
diff --git a/packages/model-runtime/src/utils/getFallbackModelProperty.test.ts b/packages/model-runtime/src/utils/getFallbackModelProperty.test.ts
index 65ea227dd88..3138a14157c 100644
--- a/packages/model-runtime/src/utils/getFallbackModelProperty.test.ts
+++ b/packages/model-runtime/src/utils/getFallbackModelProperty.test.ts
@@ -1,61 +1,117 @@
-import { describe, expect, it, vi } from 'vitest';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
import { getModelPropertyWithFallback } from './getFallbackModelProperty';
-// Mock LOBE_DEFAULT_MODEL_LIST for testing
-vi.mock('model-bank', () => ({
- LOBE_DEFAULT_MODEL_LIST: [
+const { loadModelsMock, mockModelList } = vi.hoisted(() => ({
+ loadModelsMock: vi.fn(),
+ mockModelList: [
{
- id: 'gpt-4',
- providerId: 'openai',
- type: 'chat',
- displayName: 'GPT-4',
- contextWindowTokens: 8192,
- enabled: true,
abilities: {
functionCall: true,
vision: true,
},
+ contextWindowTokens: 8192,
+ displayName: 'GPT-4',
+ enabled: true,
+ id: 'gpt-4',
parameters: {
- temperature: 0.7,
maxTokens: 4096,
+ temperature: 0.7,
},
+ providerId: 'openai',
+ type: 'chat',
},
{
- id: 'gpt-4',
- providerId: 'azure',
- type: 'chat',
- displayName: 'GPT-4 Azure',
- contextWindowTokens: 8192,
- enabled: true,
abilities: {
functionCall: true,
},
+ contextWindowTokens: 8192,
+ displayName: 'GPT-4 Azure',
+ enabled: true,
+ id: 'gpt-4',
+ providerId: 'azure',
+ type: 'chat',
},
{
+ contextWindowTokens: 200000,
+ displayName: 'Claude 3',
+ enabled: false,
id: 'claude-3',
providerId: 'anthropic',
type: 'chat',
- displayName: 'Claude 3',
- contextWindowTokens: 200000,
- enabled: false,
},
{
- id: 'dall-e-3',
- providerId: 'openai',
- type: 'image',
displayName: 'DALL-E 3',
enabled: true,
+ id: 'dall-e-3',
parameters: {
- size: '1024x1024',
quality: 'standard',
+ size: '1024x1024',
},
+ providerId: 'openai',
+ type: 'image',
},
],
}));
+vi.mock('@lobechat/business-model-bank/model-config', () => ({
+ loadModels: loadModelsMock,
+}));
+
describe('getModelPropertyWithFallback', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ loadModelsMock.mockResolvedValue([...mockModelList]);
+ });
+
describe('when providerId is specified', () => {
+ it('should use injected LobeHub model config before static fallback', async () => {
+ loadModelsMock.mockResolvedValue([
+ ...mockModelList,
+ {
+ providerId: 'lobehub',
+ source: 'builtin',
+ enabled: true,
+ id: 'injected-model',
+ type: 'chat',
+ displayName: 'Injected LobeHub Model',
+ },
+ ]);
+
+ const result = await getModelPropertyWithFallback('injected-model', 'displayName', 'lobehub');
+
+ expect(loadModelsMock).toHaveBeenCalledTimes(1);
+ expect(result).toBe('Injected LobeHub Model');
+ });
+
+ it('should propagate loadModels errors instead of falling back to static defaults', async () => {
+ loadModelsMock.mockRejectedValue(new Error('model config missing'));
+
+ await expect(
+ getModelPropertyWithFallback('injected-model', 'displayName', 'lobehub'),
+ ).rejects.toThrow('model config missing');
+ });
+
+ it('should prefer the injected LobeHub model over another provider with the same id', async () => {
+ loadModelsMock.mockResolvedValue([
+ {
+ displayName: 'Static Same ID',
+ id: 'same-model',
+ providerId: 'openai',
+ type: 'chat',
+ },
+ {
+ displayName: 'Injected LobeHub Model',
+ id: 'same-model',
+ providerId: 'lobehub',
+ type: 'chat',
+ },
+ ]);
+
+ const result = await getModelPropertyWithFallback('same-model', 'displayName', 'lobehub');
+ expect(result).toBe('Injected LobeHub Model');
+ });
+
it('should return exact match value when model exists with specified provider', async () => {
const result = await getModelPropertyWithFallback('gpt-4', 'displayName', 'openai');
expect(result).toBe('GPT-4');
diff --git a/packages/model-runtime/src/utils/getFallbackModelProperty.ts b/packages/model-runtime/src/utils/getFallbackModelProperty.ts
index f151f21d433..7bbcd97466c 100644
--- a/packages/model-runtime/src/utils/getFallbackModelProperty.ts
+++ b/packages/model-runtime/src/utils/getFallbackModelProperty.ts
@@ -1,4 +1,8 @@
-import type { AiFullModelCard } from 'model-bank';
+import type { AiFullModelCard, LobeDefaultAiModelListItem } from 'model-bank';
+
+interface BusinessModelConfigModule {
+ loadModels: () => Promise<LobeDefaultAiModelListItem[]>;
+}
/**
* Get the model property value, first from the specified provider, and then from other providers as a fallback.
@@ -12,13 +16,13 @@ export const getModelPropertyWithFallback = async <T>(
propertyName: keyof AiFullModelCard,
providerId?: string,
): Promise<T> => {
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ const { loadModels } =
+ (await import('@lobechat/business-model-bank/model-config')) as BusinessModelConfigModule;
+ const models = await loadModels();
// Step 1: If providerId is provided, prioritize an exact match (same provider + same id)
if (providerId) {
- const exactMatch = LOBE_DEFAULT_MODEL_LIST.find(
- (m) => m.id === modelId && m.providerId === providerId,
- );
+ const exactMatch = models.find((m) => m.id === modelId && m.providerId === providerId);
if (exactMatch && exactMatch[propertyName] !== undefined) {
return exactMatch[propertyName] as T;
@@ -26,7 +30,7 @@ export const getModelPropertyWithFallback = async <T>(
}
// Step 2: Fallback to a match ignoring the provider (match id only)
- const fallbackMatch = LOBE_DEFAULT_MODEL_LIST.find((m) => m.id === modelId);
+ const fallbackMatch = models.find((m) => m.id === modelId);
if (fallbackMatch && fallbackMatch[propertyName] !== undefined) {
return fallbackMatch[propertyName] as T;
diff --git a/packages/model-runtime/src/utils/getModelPricing.test.ts b/packages/model-runtime/src/utils/getModelPricing.test.ts
new file mode 100644
index 00000000000..408001fcfa6
--- /dev/null
+++ b/packages/model-runtime/src/utils/getModelPricing.test.ts
@@ -0,0 +1,72 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+const loadModelsMock = vi.hoisted(() => vi.fn());
+
+vi.mock('@lobechat/business-model-bank/model-config', () => ({
+ loadModels: loadModelsMock,
+}));
+
+const { getModelPricing } = await import('./getModelPricing');
+
+describe('getModelPricing', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ loadModelsMock.mockResolvedValue([
+ {
+ id: 'gpt-4o',
+ pricing: {
+ units: [{ name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' }],
+ },
+ providerId: 'openai',
+ },
+ {
+ id: 'gpt-4o',
+ pricing: {
+ units: [{ name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' }],
+ },
+ providerId: 'other-provider',
+ },
+ ]);
+ });
+
+ it('should use injected LobeHub pricing before same-id fallback pricing', async () => {
+ loadModelsMock.mockResolvedValue([
+ {
+ id: 'injected-only-model',
+ pricing: {
+ units: [{ name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' }],
+ },
+ providerId: 'openai',
+ },
+ {
+ id: 'injected-only-model',
+ pricing: {
+ units: [{ name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' }],
+ },
+ providerId: 'lobehub',
+ },
+ ]);
+
+ const result = await getModelPricing('injected-only-model', 'lobehub');
+
+ expect(result).toEqual({
+ units: [{ name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' }],
+ });
+ });
+
+ it('should propagate loadModels errors instead of falling back to static defaults', async () => {
+ loadModelsMock.mockRejectedValue(new Error('model config missing'));
+
+ await expect(getModelPricing('injected-only-model', 'lobehub')).rejects.toThrow(
+ 'model config missing',
+ );
+ });
+
+ it('should use provider pricing when the provider match exists', async () => {
+ const result = await getModelPricing('gpt-4o', 'openai');
+
+ expect(result).toEqual({
+ units: [{ name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' }],
+ });
+ });
+});
diff --git a/packages/model-runtime/src/utils/getModelPricing.ts b/packages/model-runtime/src/utils/getModelPricing.ts
index 781699c43e4..0de8b37f6f3 100644
--- a/packages/model-runtime/src/utils/getModelPricing.ts
+++ b/packages/model-runtime/src/utils/getModelPricing.ts
@@ -1,4 +1,10 @@
-import type { Pricing } from 'model-bank';
+import type { LobeDefaultAiModelListItem, Pricing } from 'model-bank';
+
+const BUSINESS_MODEL_CONFIG_MODULE = '@lobechat/business-model-bank/model-config';
+
+interface BusinessModelConfigModule {
+ loadModels: () => Promise<LobeDefaultAiModelListItem[]>;
+}
/**
* 1. First try to get pricing from the specified provider
@@ -11,13 +17,14 @@ export async function getModelPricing(
model: string,
provider?: string,
): Promise<Pricing | undefined> {
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ const { loadModels } = (await import(
+ /* @vite-ignore */ BUSINESS_MODEL_CONFIG_MODULE
+ )) as BusinessModelConfigModule;
+ const models = await loadModels();
// 1. First try to get pricing from the specified provider
if (provider) {
- const exactMatch = LOBE_DEFAULT_MODEL_LIST.find(
- (m) => m.id === model && m.providerId === provider,
- );
+ const exactMatch = models.find((m) => m.id === model && m.providerId === provider);
if (exactMatch?.pricing) {
return exactMatch.pricing;
@@ -25,7 +32,7 @@ export async function getModelPricing(
}
// 2. If not found, try to get pricing from other providers with the same model name
- const fallbackMatch = LOBE_DEFAULT_MODEL_LIST.find((m) => m.id === model);
+ const fallbackMatch = models.find((m) => m.id === model);
if (fallbackMatch?.pricing) {
return fallbackMatch.pricing;
diff --git a/packages/model-runtime/src/utils/modelParse.test.ts b/packages/model-runtime/src/utils/modelParse.test.ts
index c5b6c1f9f96..a663f7c675d 100644
--- a/packages/model-runtime/src/utils/modelParse.test.ts
+++ b/packages/model-runtime/src/utils/modelParse.test.ts
@@ -1,5 +1,5 @@
import type { ChatModelCard } from '@lobechat/types';
-import { afterEach, describe, expect, it, vi } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import {
detectModelProvider,
@@ -10,7 +10,8 @@ import {
} from './modelParse';
// Mock the imported LOBE_DEFAULT_MODEL_LIST
-const { mockDefaultModelList } = vi.hoisted(() => ({
+const { loadModelsMock, mockDefaultModelList } = vi.hoisted(() => ({
+ loadModelsMock: vi.fn(),
mockDefaultModelList: [
{
contextWindowTokens: 8192,
@@ -114,6 +115,8 @@ vi.mock('model-bank', () => ({
options: ['chat', 'embedding', 'tts', 'stt', 'image', 'video', 'text2music', 'realtime'],
},
LOBE_DEFAULT_MODEL_LIST: mockDefaultModelList,
+ loadModels: vi.fn().mockResolvedValue(mockDefaultModelList),
+ ModelProvider: { LobeHub: 'lobehub' },
// 新增 provider 专用清单,供 findKnownModelByProvider 使用
google: [
{
@@ -124,9 +127,17 @@ vi.mock('model-bank', () => ({
],
}));
+vi.mock('@lobechat/business-model-bank/model-config', () => ({
+ loadModels: loadModelsMock,
+}));
+
describe('modelParse', () => {
+ beforeEach(() => {
+ loadModelsMock.mockResolvedValue(mockDefaultModelList);
+ });
+
afterEach(() => {
- vi.restoreAllMocks();
+ vi.clearAllMocks();
});
describe('detectModelProvider', () => {
@@ -553,6 +564,41 @@ describe('modelParse', () => {
expect(unknown.vision).toBe(false);
});
+ it('should use business model metadata when parsing mixed provider models', async () => {
+ loadModelsMock.mockResolvedValueOnce([
+ ...mockDefaultModelList,
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ vision: true,
+ },
+ contextWindowTokens: 131_072,
+ displayName: 'Business Only Model',
+ enabled: true,
+ id: 'business-only-model',
+ maxOutput: 8192,
+ source: 'builtin',
+ type: 'chat',
+ },
+ ]);
+
+ const result = await processMultiProviderModelList([{ id: 'business-only-model' }]);
+
+ expect(loadModelsMock).toHaveBeenCalledTimes(1);
+ expect(result).toEqual([
+ expect.objectContaining({
+ contextWindowTokens: 131_072,
+ displayName: 'Business Only Model',
+ functionCall: true,
+ id: 'business-only-model',
+ maxOutput: 8192,
+ reasoning: true,
+ vision: true,
+ }),
+ ]);
+ });
+
it('should ignore invalid remote type values in mixed provider processing', async () => {
const modelList = [{ id: 'newapi-custom-model', type: 'model' }];
diff --git a/packages/model-runtime/src/utils/modelParse.ts b/packages/model-runtime/src/utils/modelParse.ts
index 4a98842dbb2..30ba91d61f2 100644
--- a/packages/model-runtime/src/utils/modelParse.ts
+++ b/packages/model-runtime/src/utils/modelParse.ts
@@ -1,6 +1,13 @@
import type { ChatModelCard } from '@lobechat/types';
-import type { AIBaseModelCard, AiModelSettings, AiModelType, ExtendParamsType } from 'model-bank';
-import { AiModelTypeSchema } from 'model-bank';
+import type {
+ AIBaseModelCard,
+ AiFullModelCard,
+ AiModelSettings,
+ AiModelType,
+ ExtendParamsType,
+ LobeDefaultAiModelListItem,
+} from 'model-bank';
+import { AiModelTypeSchema, ModelProvider } from 'model-bank';
import type { ModelProviderKey } from '../types';
@@ -194,6 +201,11 @@ export const IMAGE_MODEL_KEYWORDS = [
export const EMBEDDING_MODEL_KEYWORDS = ['embedding', 'embed', 'bge', 'm3e'] as const;
const AI_MODEL_TYPE_SET = new Set<AiModelType>(AiModelTypeSchema.options);
+const BUSINESS_MODEL_CONFIG_MODULE = '@lobechat/business-model-bank/model-config';
+
+interface BusinessModelConfigModule {
+ loadModels: () => Promise<LobeDefaultAiModelListItem[]>;
+}
const normalizeModelType = (value: unknown): AiModelType | undefined => {
if (typeof value !== 'string') return undefined;
@@ -446,19 +458,30 @@ const mergeSettings = (
* @param provider Model provider
* @returns Local configuration of the model provider
*/
-const getProviderLocalConfig = async (provider?: ModelProviderKey): Promise<any[] | null> => {
- let providerLocalConfig: any[] | null = null;
- if (provider) {
- try {
- const modules = await import('model-bank');
-
- providerLocalConfig = modules[provider];
- } catch {
- // If configuration file doesn't exist or import fails, keep as null
- providerLocalConfig = null;
- }
+const getProviderLocalConfig = async (
+ provider?: ModelProviderKey,
+): Promise<AiFullModelCard[] | null> => {
+ if (!provider) return null;
+
+ if (provider === ModelProvider.LobeHub) {
+ const { loadModels } = (await import(
+ /* @vite-ignore */ BUSINESS_MODEL_CONFIG_MODULE
+ )) as BusinessModelConfigModule;
+ const models = await loadModels();
+ return models.filter((model) => model.providerId === ModelProvider.LobeHub);
+ }
+
+ try {
+ const modules = (await import('model-bank')) as unknown as Record<
+ ModelProviderKey,
+ AiFullModelCard[] | undefined
+ >;
+
+ return modules[provider] ?? null;
+ } catch {
+ // If configuration file doesn't exist or import fails, keep as null
+ return null;
}
- return providerLocalConfig;
};
/**
@@ -635,7 +658,8 @@ export const processModelList = async (
config: ModelProcessorConfig,
provider?: keyof typeof MODEL_LIST_CONFIGS,
): Promise<ChatModelCard[]> => {
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ const { loadModels } = await import('model-bank');
+ const builtinModels = await loadModels();
// If provider is provided, try to get the local configuration for that provider
const providerLocalConfig = await getProviderLocalConfig(provider as ModelProviderKey);
@@ -651,9 +675,7 @@ export const processModelList = async (
// If not found, fall back to global configuration
if (!knownModel) {
- knownModel = LOBE_DEFAULT_MODEL_LIST.find(
- (m) => model.id.toLowerCase() === m.id.toLowerCase(),
- );
+ knownModel = builtinModels.find((m) => model.id.toLowerCase() === m.id.toLowerCase());
}
const processedModel = processModelCard(model, config, knownModel);
@@ -688,7 +710,9 @@ export const processMultiProviderModelList = async (
modelList: Array<{ id: string }>,
providerid?: ModelProviderKey,
): Promise<ChatModelCard[]> => {
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ const { loadModels } =
+ (await import('@lobechat/business-model-bank/model-config')) as BusinessModelConfigModule;
+ const builtinModels = await loadModels();
// If providerid is provided, try to get the local configuration for that provider
const providerLocalConfig = await getProviderLocalConfig(providerid);
@@ -703,9 +727,7 @@ export const processMultiProviderModelList = async (
// If not found, fall back to global configuration
if (!knownModel) {
- knownModel = LOBE_DEFAULT_MODEL_LIST.find(
- (m) => model.id.toLowerCase() === m.id.toLowerCase(),
- );
+ knownModel = builtinModels.find((m) => model.id.toLowerCase() === m.id.toLowerCase());
}
const includeKnownExtendParams =
diff --git a/scripts/buildSitemapIndex/index.ts b/scripts/buildSitemapIndex/index.ts
index fdb2dcbe559..83f686b0e16 100644
--- a/scripts/buildSitemapIndex/index.ts
+++ b/scripts/buildSitemapIndex/index.ts
@@ -1,8 +1,9 @@
import { writeFileSync } from 'node:fs';
-import { resolve } from 'node:path';
+import path from 'node:path';
import dotenv from 'dotenv';
+import { RedisKeyNamespace, resetPrefixedRedisClient } from '@/libs/redis';
import { Sitemap } from '@/server/sitemap';
dotenv.config();
@@ -10,8 +11,21 @@ dotenv.config();
const genSitemap = async () => {
const sitemapModule = new Sitemap();
const sitemapIndexXML = await sitemapModule.getIndex();
- const filename = resolve(__dirname, '../../', 'public', 'sitemap-index.xml');
+ const filename = path.resolve(__dirname, '../../', 'public', 'sitemap-index.xml');
writeFileSync(filename, sitemapIndexXML);
};
-genSitemap().catch(console.error);
+const main = async () => {
+ try {
+ await genSitemap();
+ } finally {
+ console.log('[build-sitemap] Closing LobeHub Redis client');
+ await resetPrefixedRedisClient(RedisKeyNamespace.LOBEHUB);
+ console.log('[build-sitemap] Closed LobeHub Redis client');
+ }
+};
+
+main().catch((error) => {
+ console.error(error);
+ process.exitCode = 1;
+});
diff --git a/src/business/client/model-bank/loadModels.ts b/src/business/client/model-bank/loadModels.ts
new file mode 100644
index 00000000000..e00eef5542e
--- /dev/null
+++ b/src/business/client/model-bank/loadModels.ts
@@ -0,0 +1 @@
+export { loadModels } from '@lobechat/business-model-bank/model-config';
diff --git a/src/locales/default/image.ts b/src/locales/default/image.ts
index bf6c0c4b2af..746ee87082c 100644
--- a/src/locales/default/image.ts
+++ b/src/locales/default/image.ts
@@ -17,6 +17,7 @@ export default {
'config.quality.options.hd': 'High Definition',
'config.quality.options.standard': 'Standard',
'config.resolution.label': 'Resolution',
+ 'config.resolution.options.512': '512px',
'config.resolution.options.1K': '1K',
'config.resolution.options.2K': '2K',
'config.resolution.options.4K': '4K',
diff --git a/src/locales/default/models.ts b/src/locales/default/models.ts
index 7072eab3e12..ac7b57a49e2 100644
--- a/src/locales/default/models.ts
+++ b/src/locales/default/models.ts
@@ -8,4 +8,26 @@ LOBE_DEFAULT_MODEL_LIST.forEach((model) => {
locales[`${model.id}.description`] = model.description;
});
+// #region LobeHub online model descriptions
+const lobeHubOnlineModelLocales = {
+ 'grok-4.20-beta-0309-reasoning.description':
+ 'Intelligent, blazing-fast model that reasons before responding',
+ 'grok-4.20-beta-0309-non-reasoning.description': 'A non-reasoning variant for simple use cases',
+ 'MiniMax-M2.1-Lightning.description':
+ 'Powerful multilingual programming capabilities with faster and more efficient inference.',
+ 'seedream-5-0-260128.description':
+ 'ByteDance-Seedream-5.0-lite by BytePlus features web-retrieval-augmented generation for real-time information, enhanced complex prompt interpretation, and improved reference consistency for professional visual creation.',
+ 'fal-ai/bytedance/seedream/v4.5.description':
+ 'Seedream 4.5, built by ByteDance Seed team, supports multi-image editing and composition. Features enhanced subject consistency, precise instruction following, spatial logic understanding, aesthetic expression, poster layout and logo design with high-precision text-image rendering.',
+ 'dreamina-seedance-2-0-260128.description':
+ 'Seedance 2.0 by ByteDance is the most powerful video generation model, supporting multimodal reference video generation, video editing, video extension, text-to-video, and image-to-video with synchronized audio.',
+ 'dreamina-seedance-2-0-fast-260128.description':
+ 'Seedance 2.0 Fast by ByteDance offers the same capabilities as Seedance 2.0 with faster generation speeds at a more competitive price.',
+ 'seedance-1-5-pro-251215.description':
+ 'Seedance 1.5 Pro by ByteDance supports text-to-video, image-to-video (first frame, first+last frame), and audio generation synchronized with visuals.',
+} satisfies Record<`${string}.description`, string>;
+
+Object.assign(locales, lobeHubOnlineModelLocales);
+// #endregion
+
export default locales;
diff --git a/src/server/globalConfig/genServerAiProviderConfig.test.ts b/src/server/globalConfig/genServerAiProviderConfig.test.ts
index 08ec4589384..ddaaf05638e 100644
--- a/src/server/globalConfig/genServerAiProviderConfig.test.ts
+++ b/src/server/globalConfig/genServerAiProviderConfig.test.ts
@@ -182,28 +182,50 @@ describe('genServerAiProvidersConfig', () => {
expect(Array.isArray(result[provider].serverModelLists)).toBe(true);
});
});
+
+ it('should allow LobeHub models to come from the async model bank loader', async () => {
+ const result = await genServerAiProvidersConfig({});
+
+ expect(result).toHaveProperty('lobehub');
+ expect(result.lobehub).toHaveProperty('serverModelLists');
+ expect(Array.isArray(result.lobehub.serverModelLists)).toBe(true);
+ });
});
describe('genServerAiProvidersConfig Error Handling', () => {
- it('should throw error when a provider is not found in aiModels', async () => {
- // Reset all mocks to create a clean test environment
+ it('should throw error when a non-LobeHub provider is not found in aiModels', async () => {
vi.resetModules();
- // Mock dependencies with a missing provider scenario
vi.doMock('model-bank', () => ({
- // Explicitly set openai to undefined to simulate missing provider
- openai: undefined,
+ ModelProvider: {
+ Anthropic: 'anthropic',
+ LobeHub: 'lobehub',
+ OpenAI: 'openai',
+ },
anthropic: [
{
- id: 'claude-3',
displayName: 'Claude 3',
- type: 'chat',
enabled: true,
+ id: 'claude-3',
+ type: 'chat',
},
],
}));
- vi.doMock('@/config/llm', () => ({
+ vi.doMock('@/business/client/model-bank/loadModels', () => ({
+ loadModels: vi.fn(async () => [
+ {
+ abilities: {},
+ enabled: true,
+ id: 'claude-3',
+ providerId: 'anthropic',
+ source: 'builtin',
+ type: 'chat',
+ },
+ ]),
+ }));
+
+ vi.doMock('@/envs/llm', () => ({
getLLMConfig: vi.fn(() => ({})),
}));
@@ -212,22 +234,12 @@ describe('genServerAiProvidersConfig Error Handling', () => {
transformToAiModelList: vi.fn(async () => []),
}));
- // Mock ModelProvider to include the missing provider
- vi.doMock('model-bank', () => ({
- ModelProvider: {
- openai: 'openai', // This exists in enum
- anthropic: 'anthropic', // This exists in both enum and aiModels
- },
- }));
-
- // Import the function with the new mocks
const { genServerAiProvidersConfig } = await import(
'./genServerAiProviderConfig?v=' + Date.now()
);
- // This should throw because 'openai' is in ModelProvider but not in aiModels
await expect(async () => {
await genServerAiProvidersConfig({});
- }).rejects.toThrow();
+ }).rejects.toThrow('Provider [openai] not found in aiModels');
});
});
diff --git a/src/server/globalConfig/genServerAiProviderConfig.ts b/src/server/globalConfig/genServerAiProviderConfig.ts
index 7c0f2f2a5c8..67b98c4aa55 100644
--- a/src/server/globalConfig/genServerAiProviderConfig.ts
+++ b/src/server/globalConfig/genServerAiProviderConfig.ts
@@ -1,8 +1,8 @@
import { type ProviderConfig } from '@lobechat/types';
-import { type AiFullModelCard } from 'model-bank';
-import { ModelProvider } from 'model-bank';
+import { type AiFullModelCard, type LobeDefaultAiModelListItem, ModelProvider } from 'model-bank';
import * as AiModels from 'model-bank';
+import { loadModels } from '@/business/client/model-bank/loadModels';
import { getLLMConfig } from '@/envs/llm';
import { extractEnabledModels, transformToAiModelList } from '@/utils/server/parseModels';
@@ -14,18 +14,30 @@ interface ProviderSpecificConfig {
withDeploymentName?: boolean;
}
+const groupModelsByProvider = (models: LobeDefaultAiModelListItem[]) =>
+ models.reduce<Record<string, AiFullModelCard[]>>((map, model) => {
+ const providerModels = map[model.providerId] ?? [];
+ providerModels.push(model);
+ map[model.providerId] = providerModels;
+ return map;
+ }, {});
+
export const genServerAiProvidersConfig = async (
specificConfig: Record<any, ProviderSpecificConfig>,
) => {
const llmConfig = getLLMConfig() as Record<string, any>;
+ const builtinModels = groupModelsByProvider(await loadModels());
+ const staticModels = AiModels as unknown as Record<string, AiFullModelCard[] | undefined>;
// Process all providers concurrently
const providerConfigs = await Promise.all(
Object.values(ModelProvider).map(async (provider) => {
const providerUpperCase = provider.toUpperCase();
- const aiModels = AiModels[provider] as AiFullModelCard[];
+ const hasStaticModels = Object.hasOwn(staticModels, provider);
+ const staticProviderModels = hasStaticModels ? staticModels[provider] : undefined;
+ const aiModels = builtinModels[provider] ?? staticProviderModels ?? [];
- if (!aiModels)
+ if (provider !== ModelProvider.LobeHub && !hasStaticModels)
throw new Error(
`Provider [${provider}] not found in aiModels, please make sure you have exported the provider in the \`aiModels/index.ts\``,
);
diff --git a/src/server/modules/AgentRuntime/RuntimeExecutors.ts b/src/server/modules/AgentRuntime/RuntimeExecutors.ts
index 57449afdcb5..dc6eb832650 100644
--- a/src/server/modules/AgentRuntime/RuntimeExecutors.ts
+++ b/src/server/modules/AgentRuntime/RuntimeExecutors.ts
@@ -396,7 +396,8 @@ export const createRuntimeExecutors = (
const agentConfig = ctx.agentConfig;
let processedMessages;
if (agentConfig) {
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ const { loadModels } = await import('@/business/client/model-bank/loadModels');
+ const builtinModels = await loadModels();
// Extract <refer_topic> tags from messages and fetch summaries.
// Skip if messages already contain injected topic_reference_context
@@ -626,15 +627,13 @@ export const createRuntimeExecutors = (
userTimezone: ctx.userTimezone,
capabilities: {
isCanUseFC: (m: string, p: string) => {
- const info = LOBE_DEFAULT_MODEL_LIST.find(
- (item) => item.id === m && item.providerId === p,
- );
+ const info = builtinModels.find((item) => item.id === m && item.providerId === p);
return info?.abilities?.functionCall ?? true;
},
isCanUseVideo: (m: string, p: string) => {
const info =
- LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === m && item.providerId === p) ??
- LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === m);
+ builtinModels.find((item) => item.id === m && item.providerId === p) ??
+ builtinModels.find((item) => item.id === m);
return info?.abilities?.video ?? false;
},
isCanUseVision: (m: string, p: string) => {
@@ -643,8 +642,8 @@ export const createRuntimeExecutors = (
// fall back to a cross-provider lookup by model id when the
// (model, provider) pair has no direct entry.
const info =
- LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === m && item.providerId === p) ??
- LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === m);
+ builtinModels.find((item) => item.id === m && item.providerId === p) ??
+ builtinModels.find((item) => item.id === m);
return info?.abilities?.vision ?? false;
},
},
diff --git a/src/server/modules/AgentRuntime/__tests__/RuntimeExecutors.test.ts b/src/server/modules/AgentRuntime/__tests__/RuntimeExecutors.test.ts
index 038fa12b1ef..cac0dbb17e3 100644
--- a/src/server/modules/AgentRuntime/__tests__/RuntimeExecutors.test.ts
+++ b/src/server/modules/AgentRuntime/__tests__/RuntimeExecutors.test.ts
@@ -9,6 +9,23 @@ import { createRuntimeExecutors, type RuntimeExecutorContext } from '../RuntimeE
const mockCreateCompressionGroup = vi.fn();
const mockFinalizeCompression = vi.fn();
+const mockBuiltinModels = vi.hoisted(() => [
+ {
+ abilities: { functionCall: true, video: false, vision: true },
+ id: 'gpt-4',
+ providerId: 'openai',
+ },
+ {
+ abilities: { functionCall: false, video: false, vision: false },
+ id: 'no-tools-model',
+ providerId: 'test-provider',
+ },
+ {
+ abilities: { functionCall: true, video: true, vision: true },
+ id: 'gemini-3.1-flash-lite-preview',
+ providerId: 'google',
+ },
+]);
// Mock dependencies
vi.mock('@/server/modules/ModelRuntime', () => ({
@@ -30,25 +47,13 @@ vi.mock('@lobechat/model-runtime', () => ({
consumeStreamUntilDone: vi.fn().mockResolvedValue(undefined),
}));
+vi.mock('@/business/client/model-bank/loadModels', () => ({
+ loadModels: vi.fn().mockResolvedValue(mockBuiltinModels),
+}));
+
// model-bank is a TypeScript source file that cannot be dynamically imported in vitest
vi.mock('model-bank', () => ({
- LOBE_DEFAULT_MODEL_LIST: [
- {
- abilities: { functionCall: true, video: false, vision: true },
- id: 'gpt-4',
- providerId: 'openai',
- },
- {
- abilities: { functionCall: false, video: false, vision: false },
- id: 'no-tools-model',
- providerId: 'test-provider',
- },
- {
- abilities: { functionCall: true, video: true, vision: true },
- id: 'gemini-3.1-flash-lite-preview',
- providerId: 'google',
- },
- ],
+ LOBE_DEFAULT_MODEL_LIST: mockBuiltinModels,
}));
describe('RuntimeExecutors', () => {
diff --git a/src/server/routers/lambda/__tests__/video.test.ts b/src/server/routers/lambda/__tests__/video.test.ts
index d077eb319c3..2c6c2ea1a72 100644
--- a/src/server/routers/lambda/__tests__/video.test.ts
+++ b/src/server/routers/lambda/__tests__/video.test.ts
@@ -9,6 +9,7 @@ import { AsyncTaskStatus } from '@/types/asyncTask';
const {
mockAfter,
mockCreateVideo,
+ mockLoadModels,
mockProcessBackgroundVideoPolling,
mockResolveBusinessModelMapping,
mockServerDB,
@@ -18,11 +19,13 @@ const {
const mockServerDB = { transaction: mockTransaction };
const mockCreateVideo = vi.fn();
const mockAfter = vi.fn((cb: () => void) => cb());
+ const mockLoadModels = vi.fn();
const mockProcessBackgroundVideoPolling = vi.fn().mockResolvedValue(undefined);
const mockResolveBusinessModelMapping = vi.fn();
return {
mockAfter,
mockCreateVideo,
+ mockLoadModels,
mockProcessBackgroundVideoPolling,
mockResolveBusinessModelMapping,
mockServerDB,
@@ -55,6 +58,9 @@ vi.mock('@lobechat/business-model-runtime', async (importOriginal) => ({
resolveBusinessModelMapping: (...args: [string, string]) =>
mockResolveBusinessModelMapping(...args),
}));
+vi.mock('@lobechat/business-model-bank/model-config', () => ({
+ loadModels: mockLoadModels,
+}));
vi.mock('@/business/server/video-generation/getVideoFreeQuota', () => ({
getVideoFreeQuota: vi.fn().mockResolvedValue({ remaining: 10 }),
}));
@@ -140,6 +146,15 @@ describe('videoRouter', () => {
resolvedModelId: model,
}),
);
+ mockLoadModels.mockResolvedValue([
+ {
+ abilities: {},
+ enabled: true,
+ id: 'dreamina-seedance-2-0-260128',
+ providerId: 'lobehub',
+ type: 'video',
+ },
+ ]);
});
describe('createVideo - async strategy routing', () => {
diff --git a/src/server/routers/lambda/image/index.test.ts b/src/server/routers/lambda/image/index.test.ts
index 9cc4d3bb349..d763563bfc0 100644
--- a/src/server/routers/lambda/image/index.test.ts
+++ b/src/server/routers/lambda/image/index.test.ts
@@ -12,6 +12,7 @@ const {
mockAsyncTaskModelUpdate,
mockChargeBeforeGenerate,
mockCreateAsyncCaller,
+ mockLoadModels,
mockResolveBusinessModelMapping,
} = vi.hoisted(() => ({
mockServerDB: {
@@ -22,6 +23,7 @@ const {
mockAsyncTaskModelUpdate: vi.fn(),
mockChargeBeforeGenerate: vi.fn(),
mockCreateAsyncCaller: vi.fn(),
+ mockLoadModels: vi.fn(),
mockResolveBusinessModelMapping: vi.fn(),
}));
@@ -61,6 +63,10 @@ vi.mock('@lobechat/business-model-runtime', async (importOriginal) => ({
mockResolveBusinessModelMapping(...args),
}));
+vi.mock('@lobechat/business-model-bank/model-config', () => ({
+ loadModels: mockLoadModels,
+}));
+
// Mock async caller
vi.mock('@/server/routers/async/caller', () => ({
createAsyncCaller: mockCreateAsyncCaller,
@@ -118,6 +124,15 @@ describe('imageRouter', () => {
mockChargeBeforeGenerate.mockResolvedValue(undefined);
mockGetKeyFromFullUrl.mockResolvedValue(null);
mockGetFullFileUrl.mockResolvedValue(null);
+ mockLoadModels.mockResolvedValue([
+ {
+ abilities: {},
+ enabled: true,
+ id: 'gpt-image-1',
+ providerId: 'lobehub',
+ type: 'image',
+ },
+ ]);
// Setup default transaction mock
const mockBatch = {
diff --git a/src/server/routers/lambda/image/index.ts b/src/server/routers/lambda/image/index.ts
index b1b76dfa45a..f0f3f22cffa 100644
--- a/src/server/routers/lambda/image/index.ts
+++ b/src/server/routers/lambda/image/index.ts
@@ -1,10 +1,11 @@
import { BRANDING_PROVIDER } from '@lobechat/business-const';
+import { loadModels } from '@lobechat/business-model-bank/model-config';
import { resolveBusinessModelMapping } from '@lobechat/business-model-runtime';
import { ChatErrorType } from '@lobechat/types';
import { TRPCError } from '@trpc/server';
import debug from 'debug';
import { and, eq } from 'drizzle-orm';
-import { isLobeHubModelAvailable } from 'model-bank/lobehub';
+import { isProviderModelAvailable } from 'model-bank';
import { z } from 'zod';
import { chargeBeforeGenerate } from '@/business/server/image-generation/chargeBeforeGenerate';
@@ -69,7 +70,10 @@ export const imageRouter = router({
// Reject lobehub model ids that are no longer in the model bank so callers get a
// clear error instead of an opaque downstream failure when the underlying channel
// can't serve the requested id.
- if (provider === BRANDING_PROVIDER && !isLobeHubModelAvailable(resolvedModelId, 'image')) {
+ if (
+ provider === BRANDING_PROVIDER &&
+ !isProviderModelAvailable(await loadModels(), BRANDING_PROVIDER, resolvedModelId, 'image')
+ ) {
throw new TRPCError({
cause: { data: { modelType: 'image', requestedModel: model } },
code: 'BAD_REQUEST',
diff --git a/src/server/routers/lambda/video/index.ts b/src/server/routers/lambda/video/index.ts
index 17e8c1b8284..17dc601f204 100644
--- a/src/server/routers/lambda/video/index.ts
+++ b/src/server/routers/lambda/video/index.ts
@@ -1,6 +1,7 @@
import { randomBytes } from 'node:crypto';
import { BRANDING_PROVIDER } from '@lobechat/business-const';
+import { loadModels } from '@lobechat/business-model-bank/model-config';
import {
buildMappedBusinessModelFields,
resolveBusinessModelMapping,
@@ -9,7 +10,7 @@ import { ChatErrorType, RequestTrigger } from '@lobechat/types';
import { TRPCError } from '@trpc/server';
import debug from 'debug';
import { and, eq } from 'drizzle-orm';
-import { isLobeHubModelAvailable } from 'model-bank/lobehub';
+import { isProviderModelAvailable } from 'model-bank';
import { after } from 'next/server';
import { z } from 'zod';
@@ -79,7 +80,10 @@ export const videoRouter = router({
// Reject lobehub model ids that are no longer in the model bank so callers get a
// clear error instead of an opaque downstream failure when the resolved channel
// model is no longer in the model bank.
- if (provider === BRANDING_PROVIDER && !isLobeHubModelAvailable(resolvedModelId, 'video')) {
+ if (
+ provider === BRANDING_PROVIDER &&
+ !isProviderModelAvailable(await loadModels(), BRANDING_PROVIDER, resolvedModelId, 'video')
+ ) {
throw new TRPCError({
cause: { data: { modelType: 'video', requestedModel: model } },
code: 'BAD_REQUEST',
diff --git a/src/server/services/agentSignal/policies/analyzeIntent/actions/userMemory.ts b/src/server/services/agentSignal/policies/analyzeIntent/actions/userMemory.ts
index e7b7995fac9..29bb1f33ef1 100644
--- a/src/server/services/agentSignal/policies/analyzeIntent/actions/userMemory.ts
+++ b/src/server/services/agentSignal/policies/analyzeIntent/actions/userMemory.ts
@@ -151,12 +151,11 @@ const toManifestRecord = (manifestMap: Map<string, LobeToolManifest>) => {
};
const createFunctionCallSupportChecker = async () => {
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ const { loadModels } = await import('@/business/client/model-bank/loadModels');
+ const builtinModels = await loadModels();
return (model: string, provider: string) => {
- const info = LOBE_DEFAULT_MODEL_LIST.find(
- (item) => item.id === model && item.providerId === provider,
- );
+ const info = builtinModels.find((item) => item.id === model && item.providerId === provider);
return info?.abilities?.functionCall ?? true;
};
diff --git a/src/server/services/aiAgent/index.ts b/src/server/services/aiAgent/index.ts
index c250121726e..325350ce83e 100644
--- a/src/server/services/aiAgent/index.ts
+++ b/src/server/services/aiAgent/index.ts
@@ -873,8 +873,9 @@ export class AiAgentService {
let klavisManifests: LobeToolManifest[] = [];
let agentPlugins: string[] = [...(agentConfig?.plugins ?? []), ...(additionalPluginIds || [])];
- // model-bank is needed both for tool support check and model metadata
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ // Model metadata is needed both for tool support checks and agent-management context.
+ const { loadModels } = await import('@/business/client/model-bank/loadModels');
+ const builtinModels = await loadModels();
// Resolve S3 keys in imageList/videoList before visual tool activation checks and context build.
const fileService = new FileService(this.db, this.userId);
const postProcessUrl = (path: string | null) => fileService.getFullFileUrl(path);
@@ -919,7 +920,7 @@ export class AiAgentService {
// 5b. Get model abilities from model-bank for function calling support check
const isModelSupportToolUse = (m: string, p: string) => {
- const info = LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === m && item.providerId === p);
+ const info = builtinModels.find((item) => item.id === m && item.providerId === p);
return info?.abilities?.functionCall ?? true;
};
@@ -978,8 +979,8 @@ export class AiAgentService {
// Dynamically inject turn-scoped builtin tools.
const hasTopicReference = /refer_topic/.test(prompt ?? '');
const modelAbilities =
- LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === model && item.providerId === provider)
- ?.abilities ?? LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === model)?.abilities;
+ builtinModels.find((item) => item.id === model && item.providerId === provider)
+ ?.abilities ?? builtinModels.find((item) => item.id === model)?.abilities;
const externalFileTypes = files?.map((file) => file.mimeType ?? '') ?? [];
let attachedFileTypes: string[] = [];
if (attachedFileIds && attachedFileIds.length > 0) {
@@ -1347,8 +1348,8 @@ export class AiAgentService {
// Only include enabled chat models
if (!userModel.enabled || userModel.type !== 'chat') continue;
- // Get model info from LOBE_DEFAULT_MODEL_LIST for full metadata
- const modelInfo = LOBE_DEFAULT_MODEL_LIST.find(
+ // Get model info from builtin metadata for full metadata.
+ const modelInfo = builtinModels.find(
(m) => m.id === userModel.id && m.providerId === userModel.providerId,
);
diff --git a/src/server/services/discover/index.test.ts b/src/server/services/discover/index.test.ts
index 1808f661dd5..d6b4d6417b2 100644
--- a/src/server/services/discover/index.test.ts
+++ b/src/server/services/discover/index.test.ts
@@ -74,6 +74,13 @@ vi.mock('model-bank', async (importOriginal) => {
};
});
+vi.mock('@/business/client/model-bank/loadModels', async () => {
+ const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ return {
+ loadModels: vi.fn().mockResolvedValue(LOBE_DEFAULT_MODEL_LIST),
+ };
+});
+
vi.mock('@/config/modelProviders', async (importOriginal) => {
const actual = await importOriginal();
return {
diff --git a/src/server/services/discover/index.ts b/src/server/services/discover/index.ts
index 840c6f1dfdc..b7bc73e94a8 100644
--- a/src/server/services/discover/index.ts
+++ b/src/server/services/discover/index.ts
@@ -75,6 +75,11 @@ import { MarketService } from '@/server/services/market';
const log = debug('lobe-server:discover');
+const loadBuiltinModels = async () => {
+ const { loadModels } = await import('@/business/client/model-bank/loadModels');
+ return loadModels();
+};
+
export interface DiscoverServiceOptions {
/** Access token from OIDC flow (legacy) */
accessToken?: string;
@@ -1292,15 +1297,15 @@ export class DiscoverService {
private _getProviderList = async (): Promise<DiscoverProviderItem[]> => {
log('_getProviderList: fetching provider list');
- const [{ LOBE_DEFAULT_MODEL_LIST }, { DEFAULT_MODEL_PROVIDER_LIST }] = await Promise.all([
- import('model-bank'),
+ const [builtinModels, { DEFAULT_MODEL_PROVIDER_LIST }] = await Promise.all([
+ loadBuiltinModels(),
import('model-bank/modelProviders'),
]);
const result = DEFAULT_MODEL_PROVIDER_LIST.map((item) => {
const models = uniq(
- LOBE_DEFAULT_MODEL_LIST.filter((m) => m.providerId === item.id && isAiModelVisible(m)).map(
- (m) => m.id,
- ),
+ builtinModels
+ .filter((m) => m.providerId === item.id && isAiModelVisible(m))
+ .map((m) => m.id),
);
const provider = {
...item,
@@ -1321,7 +1326,7 @@ export class DiscoverService {
}): Promise<DiscoverProviderDetail | undefined> => {
log('getProviderDetail: params=%O', params);
const { identifier, locale, withReadme } = params;
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ const builtinModels = await loadBuiltinModels();
const all = await this._getProviderList();
const provider = all.find((item) => item.identifier === identifier);
if (!provider) {
@@ -1367,7 +1372,7 @@ export class DiscoverService {
const result = {
...provider,
models: uniqBy(
- LOBE_DEFAULT_MODEL_LIST.filter((m) => m.providerId === provider.id && isAiModelVisible(m)),
+ builtinModels.filter((m) => m.providerId === provider.id && isAiModelVisible(m)),
(item) => item.id,
),
readme,
@@ -1457,8 +1462,8 @@ export class DiscoverService {
private _getRawModelList = async (): Promise<DiscoverModelItem[]> => {
log('_getRawModelList: fetching raw model list');
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
- const visibleModels = LOBE_DEFAULT_MODEL_LIST.filter(isAiModelVisible);
+ const builtinModels = await loadBuiltinModels();
+ const visibleModels = builtinModels.filter(isAiModelVisible);
const result = visibleModels.map((item) => {
const identifier = (item.id.split('/').at(-1) || item.id).toLowerCase();
const providers = uniq(
@@ -1553,8 +1558,8 @@ export class DiscoverService {
getModelCategories = async (params: CategoryListQuery = {}): Promise<CategoryItem[]> => {
log('getModelCategories: params=%O', params);
const { q } = params;
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
- let list = LOBE_DEFAULT_MODEL_LIST.filter(isAiModelVisible);
+ const builtinModels = await loadBuiltinModels();
+ let list = builtinModels.filter(isAiModelVisible);
if (q) {
const originalCount = list.length;
list = list.filter((item) => {
@@ -1587,8 +1592,8 @@ export class DiscoverService {
identifier: string;
}): Promise<DiscoverModelDetail | undefined> => {
log('getModelDetail: params=%O', params);
- const [{ LOBE_DEFAULT_MODEL_LIST }, { DEFAULT_MODEL_PROVIDER_LIST }] = await Promise.all([
- import('model-bank'),
+ const [builtinModels, { DEFAULT_MODEL_PROVIDER_LIST }] = await Promise.all([
+ loadBuiltinModels(),
import('model-bank/modelProviders'),
]);
const { identifier } = params;
@@ -1621,7 +1626,7 @@ export class DiscoverService {
...model,
providers: providers.map((item) => ({
...item,
- model: LOBE_DEFAULT_MODEL_LIST.find((m) => {
+ model: builtinModels.find((m) => {
if (!isAiModelVisible(m)) return false;
if (m.providerId !== item.id) return false;
return (
diff --git a/src/server/services/toolExecution/serverRuntimes/__tests__/lobeAgent.test.ts b/src/server/services/toolExecution/serverRuntimes/__tests__/lobeAgent.test.ts
index 68d1efdfe8c..7e801e9ef3f 100644
--- a/src/server/services/toolExecution/serverRuntimes/__tests__/lobeAgent.test.ts
+++ b/src/server/services/toolExecution/serverRuntimes/__tests__/lobeAgent.test.ts
@@ -13,6 +13,18 @@ const mockMessageModelQuery = vi.hoisted(() => vi.fn());
const mockChat = vi.hoisted(() => vi.fn());
const mockInitModelRuntimeFromDB = vi.hoisted(() => vi.fn());
const mockConsumeStreamUntilDone = vi.hoisted(() => vi.fn());
+const mockBuiltinModels = vi.hoisted(() => [
+ {
+ abilities: { video: true, vision: true },
+ id: 'vision-model',
+ providerId: 'test-provider',
+ },
+ {
+ abilities: { video: false, vision: true },
+ id: 'image-only-model',
+ providerId: 'test-provider',
+ },
+]);
vi.mock('@/envs/tools', () => ({
toolsEnv: mockToolsEnv,
@@ -39,19 +51,12 @@ vi.mock('@lobechat/model-runtime', () => ({
consumeStreamUntilDone: (...args: any[]) => mockConsumeStreamUntilDone(...args),
}));
+vi.mock('@/business/client/model-bank/loadModels', () => ({
+ loadModels: vi.fn().mockResolvedValue(mockBuiltinModels),
+}));
+
vi.mock('model-bank', () => ({
- LOBE_DEFAULT_MODEL_LIST: [
- {
- abilities: { video: true, vision: true },
- id: 'vision-model',
- providerId: 'test-provider',
- },
- {
- abilities: { video: false, vision: true },
- id: 'image-only-model',
- providerId: 'test-provider',
- },
- ],
+ LOBE_DEFAULT_MODEL_LIST: mockBuiltinModels,
}));
const { lobeAgentRuntime } = await import('../lobeAgent');
diff --git a/src/server/services/toolExecution/serverRuntimes/lobeAgent.ts b/src/server/services/toolExecution/serverRuntimes/lobeAgent.ts
index 5e8f366aba4..d2777ab7340 100644
--- a/src/server/services/toolExecution/serverRuntimes/lobeAgent.ts
+++ b/src/server/services/toolExecution/serverRuntimes/lobeAgent.ts
@@ -16,7 +16,6 @@ import type { ChatStreamPayload } from '@lobechat/model-runtime';
import { consumeStreamUntilDone } from '@lobechat/model-runtime';
import type { BuiltinServerRuntimeOutput } from '@lobechat/types';
import { RequestTrigger } from '@lobechat/types';
-import { LOBE_DEFAULT_MODEL_LIST } from 'model-bank';
import { MessageModel } from '@/database/models/message';
import { toolsEnv } from '@/envs/tools';
@@ -48,10 +47,13 @@ const buildError = (content: string, code: string): BuiltinServerRuntimeOutput =
success: false,
});
-const getModelAbilities = (model: string, provider: string) => {
+const getModelAbilities = async (model: string, provider: string) => {
+ const { loadModels } = await import('@/business/client/model-bank/loadModels');
+ const builtinModels = await loadModels();
+
return (
- LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === model && item.providerId === provider) ??
- LOBE_DEFAULT_MODEL_LIST.find((item) => item.id === model)
+ builtinModels.find((item) => item.id === model && item.providerId === provider) ??
+ builtinModels.find((item) => item.id === model)
)?.abilities;
};
@@ -230,7 +232,7 @@ class LobeAgentExecutionRuntime {
return buildError('No visual files selected.', 'NO_VISUAL_FILES_SELECTED');
}
- const abilities = getModelAbilities(model, provider);
+ const abilities = await getModelAbilities(model, provider);
const hasImages = selectedItems.some((item) => item.type === 'image');
const hasVideos = selectedItems.some((item) => item.type === 'video');
diff --git a/src/server/sitemap.test.ts b/src/server/sitemap.test.ts
index 038eeef3ca0..14c7a79bb9c 100644
--- a/src/server/sitemap.test.ts
+++ b/src/server/sitemap.test.ts
@@ -1,15 +1,25 @@
// @vitest-environment node
-import { describe, expect, it, vi } from 'vitest';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { DiscoverService } from '@/server/services/discover';
import { getCanonicalUrl } from '@/server/utils/url';
import { LAST_MODIFIED, Sitemap, SitemapType } from './sitemap';
const LOCALE_COUNT = 18;
+interface SitemapWithDiscoverService {
+ discoverService: Pick<DiscoverService, 'getModelIdentifiers'>;
+}
+
describe('Sitemap', () => {
const sitemap = new Sitemap();
+ afterEach(() => {
+ vi.useRealTimers();
+ vi.restoreAllMocks();
+ });
+
describe('getIndex', () => {
it('should return a valid sitemap index with pagination', async () => {
// Mock the page count methods to return specific values for testing
@@ -39,6 +49,37 @@ describe('Sitemap', () => {
});
});
+ describe('getModelPageCount', () => {
+ it('should clear the timeout after model identifiers resolve', async () => {
+ vi.useFakeTimers();
+
+ const isolatedSitemap = new Sitemap({ modelPageCountTimeoutMs: 15 * 60 * 1000 });
+ const isolatedSitemapWithService = isolatedSitemap as unknown as SitemapWithDiscoverService;
+ vi.spyOn(isolatedSitemapWithService.discoverService, 'getModelIdentifiers').mockResolvedValue(
+ [{ identifier: 'test-model', lastModified: LAST_MODIFIED }],
+ );
+
+ await expect(isolatedSitemap.getModelPageCount()).resolves.toBe(1);
+ expect(vi.getTimerCount()).toBe(0);
+ });
+
+ it('should not block sitemap generation when model identifiers never resolve', async () => {
+ vi.useFakeTimers();
+ vi.spyOn(console, 'error').mockImplementation(() => {});
+
+ const isolatedSitemap = new Sitemap({ modelPageCountTimeoutMs: 100 });
+ const isolatedSitemapWithService = isolatedSitemap as unknown as SitemapWithDiscoverService;
+ vi.spyOn(isolatedSitemapWithService.discoverService, 'getModelIdentifiers').mockReturnValue(
+ new Promise(() => {}),
+ );
+
+ const pageCountPromise = isolatedSitemap.getModelPageCount();
+ await vi.advanceTimersByTimeAsync(100);
+
+ await expect(pageCountPromise).resolves.toBe(0);
+ });
+ });
+
describe('getPage', () => {
it('should return a valid page sitemap', async () => {
const pageSitemap = await sitemap.getPage();
@@ -272,6 +313,15 @@ describe('Sitemap', () => {
const pageCount = await sitemap.getModelPageCount();
expect(pageCount).toBe(2); // 120 items / 100 per page = ceil(1.2) = 2 pages
});
+
+ it('should skip model sitemap pagination when model identifiers are unavailable', async () => {
+ const isolatedSitemap = new Sitemap();
+ vi.spyOn(isolatedSitemap['discoverService'], 'getModelIdentifiers').mockRejectedValue(
+ new Error('model config unavailable'),
+ );
+
+ await expect(isolatedSitemap.getModelPageCount()).resolves.toBe(0);
+ });
});
describe('getRobots', () => {
diff --git a/src/server/sitemap.ts b/src/server/sitemap.ts
index 54abc4d2c1c..5951645821e 100644
--- a/src/server/sitemap.ts
+++ b/src/server/sitemap.ts
@@ -1,3 +1,5 @@
+import { setTimeout as sleep } from 'node:timers/promises';
+
import { flatten } from 'es-toolkit/compat';
import { type MetadataRoute } from 'next';
import qs from 'query-string';
@@ -35,12 +37,41 @@ export const LAST_MODIFIED = new Date().toISOString();
// Number of items per page
const ITEMS_PER_PAGE = 100;
+const DEFAULT_MODEL_PAGE_COUNT_TIMEOUT_MS = 15 * 60 * 1000;
+
+interface SitemapOptions {
+ modelPageCountTimeoutMs?: number;
+}
export class Sitemap {
+ private modelPageCountTimeoutMs: number;
+
sitemapIndexs = [{ id: SitemapType.Pages }, { id: SitemapType.Providers }];
private discoverService = new DiscoverService();
+ constructor(options: SitemapOptions = {}) {
+ this.modelPageCountTimeoutMs =
+ options.modelPageCountTimeoutMs ?? DEFAULT_MODEL_PAGE_COUNT_TIMEOUT_MS;
+ }
+
+ private _withModelPageCountTimeout = async <T>(promise: Promise<T>) => {
+ const timeoutController = new AbortController();
+
+ try {
+ return await Promise.race([
+ promise,
+ sleep(this.modelPageCountTimeoutMs, undefined, { signal: timeoutController.signal }).then(
+ () => {
+ throw new Error('Timed out while getting model identifiers for sitemap');
+ },
+ ),
+ ]);
+ } finally {
+ timeoutController.abort();
+ }
+ };
+
// Get total number of plugin pages
async getPluginPageCount(): Promise<number> {
const list = await this.discoverService.getPluginIdentifiers();
@@ -55,7 +86,15 @@ export class Sitemap {
// Get total number of model pages
async getModelPageCount(): Promise<number> {
- const list = await this.discoverService.getModelIdentifiers();
+ let list: Awaited<ReturnType<DiscoverService['getModelIdentifiers']>>;
+ try {
+ list = await this._withModelPageCountTimeout(this.discoverService.getModelIdentifiers());
+ } catch (error) {
+ // Keep sitemap generation from blocking deployment when model identifiers are unavailable.
+ console.error('[Sitemap] Failed to get model identifiers for sitemap', error);
+ return 0;
+ }
+
return Math.ceil(list.length / ITEMS_PER_PAGE);
}
diff --git a/src/store/aiInfra/slices/aiProvider/__tests__/action.test.ts b/src/store/aiInfra/slices/aiProvider/__tests__/action.test.ts
index 91d28a27cae..a7994fdb97c 100644
--- a/src/store/aiInfra/slices/aiProvider/__tests__/action.test.ts
+++ b/src/store/aiInfra/slices/aiProvider/__tests__/action.test.ts
@@ -1,6 +1,6 @@
import * as runtimeModule from '@lobechat/model-runtime';
-import { type AIImageModelCard, type EnabledAiModel, type ModelParamsSchema } from 'model-bank';
-import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { AIImageModelCard, EnabledAiModel, ModelParamsSchema, Pricing } from 'model-bank';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import {
getChatModelList,
@@ -34,6 +34,10 @@ const createImageModel = (overrides: Partial<ImageEnabledModel> = {}): ImageEnab
});
describe('aiProvider action helpers', () => {
+ beforeEach(() => {
+ vi.spyOn(runtimeModule, 'getModelPropertyWithFallback').mockResolvedValue(undefined);
+ });
+
afterEach(() => {
vi.restoreAllMocks();
});
@@ -55,6 +59,24 @@ describe('aiProvider action helpers', () => {
id: 'chat-model',
});
});
+
+ it('preserves inline metadata without loading fallback model config', async () => {
+ const fallbackSpy = vi.spyOn(runtimeModule, 'getModelPropertyWithFallback');
+ const pricing: Pricing = {
+ units: [{ name: 'textInput', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' }],
+ };
+ const model = {
+ ...createChatModel({ id: 'online-chat-model', providerId: 'lobehub' }),
+ description: 'Inline description',
+ pricing,
+ };
+
+ const result = await normalizeChatModel(model);
+
+ expect(result.description).toBe('Inline description');
+ expect(result.pricing).toBe(pricing);
+ expect(fallbackSpy).not.toHaveBeenCalled();
+ });
});
describe('normalizeImageModel', () => {
@@ -86,7 +108,7 @@ describe('aiProvider action helpers', () => {
it('fetches fallback description/parameters/pricing when missing', async () => {
const fallbackSpy = vi
- .spyOn(runtimeModule, 'getModelPropertyWithFallback')
+ .mocked(runtimeModule.getModelPropertyWithFallback)
.mockImplementation(async (_id, key) => {
if (key === 'parameters')
return {
diff --git a/src/store/aiInfra/slices/aiProvider/action.ts b/src/store/aiInfra/slices/aiProvider/action.ts
index 7cd88cc41bc..fb5b4600282 100644
--- a/src/store/aiInfra/slices/aiProvider/action.ts
+++ b/src/store/aiInfra/slices/aiProvider/action.ts
@@ -5,8 +5,7 @@ import {
} from '@lobechat/model-runtime';
import { uniqBy } from 'es-toolkit/compat';
import type {
- AIImageModelCard,
- AIVideoModelCard,
+ AiFullModelCard,
EnabledAiModel,
LobeDefaultAiModelListItem,
ModelAbilities,
@@ -52,6 +51,16 @@ export type ProviderModelListItem = {
type ModelNormalizer = (model: EnabledAiModel) => Promise<ProviderModelListItem>;
+const getModelProperty = async <T>(
+ model: EnabledAiModel,
+ propertyName: keyof AiFullModelCard,
+): Promise<T | undefined> => {
+ const inlineValue = (model as Partial<AiFullModelCard>)[propertyName];
+ if (inlineValue !== undefined) return inlineValue as T;
+
+ return getModelPropertyWithFallback<T | undefined>(model.id, propertyName, model.providerId);
+};
+
const dedupeById = (models: ProviderModelListItem[]) => uniqBy(models, 'id');
const createProviderModelCollector = (
@@ -72,8 +81,8 @@ const createProviderModelCollector = (
export const normalizeChatModel = async (model: EnabledAiModel): Promise<ProviderModelListItem> => {
const [description, pricing] = await Promise.all([
- getModelPropertyWithFallback<string | undefined>(model.id, 'description', model.providerId),
- getModelPropertyWithFallback<Pricing | undefined>(model.id, 'pricing', model.providerId),
+ getModelProperty<string>(model, 'description'),
+ getModelProperty<Pricing>(model, 'pricing'),
]);
return {
@@ -98,16 +107,8 @@ export const normalizeImageModel = async (
model.providerId,
);
- const modelWithPricing = model as AIImageModelCard;
- const fallbackPricingPromise = modelWithPricing.pricing
- ? Promise.resolve<Pricing | undefined>(modelWithPricing.pricing)
- : getModelPropertyWithFallback<Pricing | undefined>(model.id, 'pricing', model.providerId);
-
- const fallbackDescriptionPromise = getModelPropertyWithFallback<string | undefined>(
- model.id,
- 'description',
- model.providerId,
- );
+ const fallbackPricingPromise = getModelProperty<Pricing>(model, 'pricing');
+ const fallbackDescriptionPromise = getModelProperty<string>(model, 'description');
const [fallbackParameters, fallbackPricing, fallbackDescription] = await Promise.all([
fallbackParametersPromise,
@@ -145,16 +146,8 @@ export const normalizeVideoModel = async (
model.providerId,
);
- const modelWithPricing = model as AIVideoModelCard;
- const fallbackPricingPromise = modelWithPricing.pricing
- ? Promise.resolve<Pricing | undefined>(modelWithPricing.pricing)
- : getModelPropertyWithFallback<Pricing | undefined>(model.id, 'pricing', model.providerId);
-
- const fallbackDescriptionPromise = getModelPropertyWithFallback<string | undefined>(
- model.id,
- 'description',
- model.providerId,
- );
+ const fallbackPricingPromise = getModelProperty<Pricing>(model, 'pricing');
+ const fallbackDescriptionPromise = getModelProperty<string>(model, 'description');
const [fallbackParameters, fallbackPricing, fallbackDescription] = await Promise.all([
fallbackParametersPromise,
@@ -477,11 +470,15 @@ export class AiProviderActionImpl {
return useClientDataSWR<AiProviderRuntimeStateWithBuiltinModels | undefined>(
shouldFetch ? [AiProviderSwrKey.fetchAiProviderRuntimeState, isLogin] : null,
async ([, isLogin]) => {
- const [{ LOBE_DEFAULT_MODEL_LIST: builtinAiModelList }, { DEFAULT_MODEL_PROVIDER_LIST }] =
- await Promise.all([import('model-bank'), import('model-bank/modelProviders')]);
+ const [{ loadModels }, { DEFAULT_MODEL_PROVIDER_LIST }] = await Promise.all([
+ import('@/business/client/model-bank/loadModels'),
+ import('model-bank/modelProviders'),
+ ]);
+ const builtinAiModelList = await loadModels();
if (isLogin) {
const data = await aiProviderService.getAiProviderRuntimeState();
+
// Build model lists with proper async handling
const [enabledChatModelList, enabledImageModelList, enabledVideoModelList] =
await Promise.all([
diff --git a/src/store/image/slices/generationConfig/initialState.test.ts b/src/store/image/slices/generationConfig/initialState.test.ts
new file mode 100644
index 00000000000..b32e340e274
--- /dev/null
+++ b/src/store/image/slices/generationConfig/initialState.test.ts
@@ -0,0 +1,15 @@
+import { describe, expect, it } from 'vitest';
+
+import { DEFAULT_IMAGE_GENERATION_PARAMETERS, initialGenerationConfigState } from './initialState';
+
+describe('initialGenerationConfigState', () => {
+ it('uses the canonical Nano Banana 2 resolution values', () => {
+ expect(initialGenerationConfigState.parametersSchema.resolution?.enum).toEqual([
+ '512',
+ '1K',
+ '2K',
+ '4K',
+ ]);
+ expect(DEFAULT_IMAGE_GENERATION_PARAMETERS.resolution).toBe('1K');
+ });
+});
diff --git a/src/store/image/slices/generationConfig/initialState.ts b/src/store/image/slices/generationConfig/initialState.ts
index 64c7acba06c..0ff7e3f1ac9 100644
--- a/src/store/image/slices/generationConfig/initialState.ts
+++ b/src/store/image/slices/generationConfig/initialState.ts
@@ -1,6 +1,6 @@
-import { type ModelParamsSchema, type RuntimeImageGenParams } from 'model-bank';
+import type { ModelParamsSchema, RuntimeImageGenParams } from 'model-bank';
import { extractDefaultValues, ModelProvider } from 'model-bank';
-import { nanoBanana2Parameters } from 'model-bank/lobehub';
+import { nanoBanana2Parameters } from 'model-bank/imageParameters';
import { DEFAULT_IMAGE_CONFIG } from '@/const/settings';
diff --git a/src/store/image/slices/generationConfig/selectors.test.ts b/src/store/image/slices/generationConfig/selectors.test.ts
index 22dacc46b7e..30f2bfebb49 100644
--- a/src/store/image/slices/generationConfig/selectors.test.ts
+++ b/src/store/image/slices/generationConfig/selectors.test.ts
@@ -1,8 +1,4 @@
-import {
- type AIImageModelCard,
- type ModelParamsSchema,
- type RuntimeImageGenParams,
-} from 'model-bank';
+import type { AIImageModelCard, ModelParamsSchema, RuntimeImageGenParams } from 'model-bank';
import { gptImage1Schema } from 'model-bank';
import { describe, expect, it, vi } from 'vitest';
diff --git a/src/store/video/slices/generationConfig/initialState.ts b/src/store/video/slices/generationConfig/initialState.ts
index d2f0c5b4de4..34f3fcc6862 100644
--- a/src/store/video/slices/generationConfig/initialState.ts
+++ b/src/store/video/slices/generationConfig/initialState.ts
@@ -2,14 +2,46 @@
import {
extractVideoDefaultValues,
ModelProvider,
+ PRESET_VIDEO_ASPECT_RATIOS,
+ PRESET_VIDEO_RESOLUTIONS,
type RuntimeVideoGenParams,
type VideoModelParamsSchema,
} from 'model-bank';
-import { seedance20Params } from 'model-bank/lobehub';
export const DEFAULT_AI_VIDEO_PROVIDER = ModelProvider.LobeHub;
export const DEFAULT_AI_VIDEO_MODEL = 'dreamina-seedance-2-0-260128';
+const seedance20Params: VideoModelParamsSchema = {
+ aspectRatio: {
+ default: 'adaptive',
+ enum: ['adaptive', ...PRESET_VIDEO_ASPECT_RATIOS],
+ },
+ duration: { default: 5, max: 15, min: 4 },
+ endImageUrl: {
+ aspectRatio: { max: 2.5, min: 0.4 },
+ default: null,
+ height: { max: 6000, min: 300 },
+ maxFileSize: 30 * 1024 * 1024,
+ requiresImageUrl: true,
+ width: { max: 6000, min: 300 },
+ },
+ generateAudio: { default: true },
+ imageUrls: {
+ aspectRatio: { max: 2.5, min: 0.4 },
+ default: [],
+ height: { max: 6000, min: 300 },
+ maxCount: 9,
+ maxFileSize: 30 * 1024 * 1024,
+ width: { max: 6000, min: 300 },
+ },
+ prompt: { default: '' },
+ resolution: {
+ default: '720p',
+ enum: PRESET_VIDEO_RESOLUTIONS,
+ },
+ seed: { default: null },
+};
+
export interface VideoGenerationConfigState {
parameters: RuntimeVideoGenParams;
parametersSchema: VideoModelParamsSchema;
diff --git a/src/utils/server/parseModels.test.ts b/src/utils/server/parseModels.test.ts
index 1207584c304..8cb95e56911 100644
--- a/src/utils/server/parseModels.test.ts
+++ b/src/utils/server/parseModels.test.ts
@@ -1,9 +1,16 @@
import { type AiFullModelCard } from 'model-bank';
import { LOBE_DEFAULT_MODEL_LIST, openaiChatModels } from 'model-bank';
-import { describe, expect, it } from 'vitest';
+import { describe, expect, it, vi } from 'vitest';
import { extractEnabledModels, parseModelString, transformToAiModelList } from './parseModels';
+vi.mock('@lobechat/business-model-bank/model-config', async () => {
+ const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ return {
+ loadModels: vi.fn().mockResolvedValue(LOBE_DEFAULT_MODEL_LIST),
+ };
+});
+
describe('parseModelString', () => {
it('custom deletion, addition, and renaming of models', async () => {
const result = await parseModelString(
diff --git a/src/utils/server/parseModels.ts b/src/utils/server/parseModels.ts
index 0bd926bc8e2..bc56a24b4fa 100644
--- a/src/utils/server/parseModels.ts
+++ b/src/utils/server/parseModels.ts
@@ -143,19 +143,20 @@ export const transformToAiModelList = async ({
}
// Asynchronously load configuration
- const { LOBE_DEFAULT_MODEL_LIST } = await import('model-bank');
+ const { loadModels } = await import('@/business/client/model-bank/loadModels');
+ const builtinModels = await loadModels();
return produce(chatModels, (draft) => {
// Handle add or replace logic
for (const toAddModel of modelConfig.add) {
- // first try to find the model in LOBE_DEFAULT_MODEL_LIST to confirm if it is a known model
- let knownModel = LOBE_DEFAULT_MODEL_LIST.find(
+ // First try to find the model in the provider-specific builtin list.
+ let knownModel = builtinModels.find(
(model) => model.id === toAddModel.id && model.providerId === providerId,
);
if (!knownModel) {
- knownModel = LOBE_DEFAULT_MODEL_LIST.find((model) => model.id === toAddModel.id);
- if (knownModel) knownModel.providerId = providerId;
+ knownModel = builtinModels.find((model) => model.id === toAddModel.id);
+ if (knownModel) knownModel = { ...knownModel, providerId };
}
if (withDeploymentName) {
toAddModel.config = toAddModel.config || {};
@@ -187,7 +188,7 @@ export const transformToAiModelList = async ({
);
}
} else {
- // if the model is not in LOBE_DEFAULT_MODEL_LIST, add it as a new custom model
+ // If the model is not in the builtin list, add it as a new custom model.
draft.push({
...toAddModel,
displayName: toAddModel.displayName || toAddModel.id,