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.

🐛 fix(newapi): supplement models from NewAPI pricing endpoint & fix proxy gzip handling (#10628)

sxjeruc8b23c68196e
diff --git a/package.json b/package.json
index 383adc7761a..a259c2af74f 100644
--- a/package.json
+++ b/package.json
@@ -35,8 +35,8 @@
"build": "bun run build:spa && bun run build:spa:copy && bun run build:next",
"build:analyze": "cross-env NODE_OPTIONS=--max-old-space-size=81920 next experimental-analyze",
"build:docker": "pnpm run build:spa && pnpm run build:spa:mobile && pnpm run build:spa:copy && cross-env NODE_OPTIONS=--max-old-space-size=8192 DOCKER=true next build && pnpm run build-sitemap",
- "build:next": "cross-env NODE_OPTIONS=--max-old-space-size=8192 next build",
- "build:spa": "rm -rf public/spa && cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build",
+ "build:next": "cross-env NODE_OPTIONS=--max-old-space-size=6144 next build",
+ "build:spa": "rm -rf public/spa && cross-env NODE_OPTIONS=--max-old-space-size=6144 vite build",
"build:spa:copy": "mkdir -p public/spa && cp -r dist/desktop/assets public/spa/ && ([ -d dist/mobile/assets ] && cp -r dist/mobile/assets public/spa/ || true) && tsx scripts/generateSpaTemplates.mts",
"build:spa:mobile": "cross-env NODE_OPTIONS=--max-old-space-size=8192 MOBILE=true vite build",
"build-migrate-db": "bun run db:migrate",
diff --git a/packages/model-bank/src/aiModels/cerebras.ts b/packages/model-bank/src/aiModels/cerebras.ts
index 31cd3d484f2..aaeaf59bb92 100644
--- a/packages/model-bank/src/aiModels/cerebras.ts
+++ b/packages/model-bank/src/aiModels/cerebras.ts
@@ -1,6 +1,27 @@
import { type AIChatModelCard } from '../types/aiModel';
const cerebrasModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ structuredOutput: true,
+ },
+ contextWindowTokens: 131_072,
+ description:
+ 'This model delivers strong coding performance with advanced reasoning capabilities, superior tool use, and enhanced real-world performance in agentic coding applications.',
+ displayName: 'GLM 4.7',
+ enabled: true,
+ id: 'zai-glm-4.7',
+ maxOutput: 40_000,
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 2.25, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2.75, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/cohere.ts b/packages/model-bank/src/aiModels/cohere.ts
index 717433ae1f9..ac8da9f3c8e 100644
--- a/packages/model-bank/src/aiModels/cohere.ts
+++ b/packages/model-bank/src/aiModels/cohere.ts
@@ -93,24 +93,6 @@ const cohereChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- },
- contextWindowTokens: 128_000,
- description:
- 'Command R is an instruction-following chat model with higher quality, greater reliability, and a longer context window than earlier models. It supports complex workflows such as code generation, RAG, tool use, and agents.',
- displayName: 'Command R 2403',
- id: 'command-r-03-2024',
- maxOutput: 4000,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/giteeai.ts b/packages/model-bank/src/aiModels/giteeai.ts
index 54941b5cfeb..7b47873a74d 100644
--- a/packages/model-bank/src/aiModels/giteeai.ts
+++ b/packages/model-bank/src/aiModels/giteeai.ts
@@ -384,7 +384,7 @@ const giteeaiImageModels: AIImageModelCard[] = [
'HiDream-E1-Full is an open-source multimodal image editing model from HiDream.ai, based on an advanced Diffusion Transformer architecture and strong language understanding (built-in LLaMA 3.1-8B-Instruct). It supports natural-language-driven image generation, style transfer, local edits, and repainting, with excellent image-text understanding and execution.',
displayName: 'HiDream-E1-Full',
enabled: true,
- id: 'HiDream-I1-Full',
+ id: 'HiDream-E1-Full',
parameters: {
imageUrl: { default: null },
prompt: {
diff --git a/packages/model-bank/src/aiModels/google.ts b/packages/model-bank/src/aiModels/google.ts
index 4e9f600dfd7..ed163dd9214 100644
--- a/packages/model-bank/src/aiModels/google.ts
+++ b/packages/model-bank/src/aiModels/google.ts
@@ -683,43 +683,6 @@ const googleChatModels: AIChatModelCard[] = [
releasedAt: '2025-02-05',
type: 'chat',
},
- {
- abilities: {
- vision: true,
- },
- contextWindowTokens: 1_048_576 + 32_768,
- description:
- 'LearnLM is an experimental, task-specific model trained on learning science principles to follow system instructions in teaching/learning scenarios, acting as an expert tutor.',
- displayName: 'LearnLM 2.0 Flash Experimental',
- id: 'learnlm-2.0-flash-experimental',
- maxOutput: 32_768,
- pricing: {
- units: [
- { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
- {
- abilities: {
- vision: true,
- },
- contextWindowTokens: 40_959,
- description:
- 'LearnLM is an experimental, task-specific model trained on learning science principles to follow system instructions in teaching/learning scenarios, acting as an expert tutor.',
- displayName: 'LearnLM 1.5 Pro Experimental',
- id: 'learnlm-1.5-pro-experimental',
- maxOutput: 8192,
- pricing: {
- units: [
- { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2024-11-19',
- type: 'chat',
- },
{
abilities: {
functionCall: true,
@@ -938,7 +901,6 @@ const googleImageModels: AIImageModelCard[] = [
{
displayName: 'Nano Banana',
id: 'gemini-2.5-flash-image:image',
- enabled: true,
type: 'image',
description:
'Nano Banana is Google’s newest, fastest, and most efficient native multimodal model, enabling conversational image generation and editing.',
diff --git a/packages/model-bank/src/aiModels/groq.ts b/packages/model-bank/src/aiModels/groq.ts
index 5a808a579eb..0cee605b639 100644
--- a/packages/model-bank/src/aiModels/groq.ts
+++ b/packages/model-bank/src/aiModels/groq.ts
@@ -9,7 +9,6 @@ const groqChatModels: AIChatModelCard[] = [
description:
'Compound is a composite AI system powered by multiple publicly available models supported on GroqCloud, intelligently and selectively using tools to answer user queries.',
displayName: 'Compound',
- enabled: true,
id: 'groq/compound',
maxOutput: 8192,
type: 'chat',
@@ -97,23 +96,6 @@ const groqChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- },
- contextWindowTokens: 131_072,
- displayName: 'Llama 4 Maverick (17Bx128E)',
- enabled: true,
- id: 'meta-llama/llama-4-maverick-17b-128e-instruct',
- maxOutput: 8192,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.6, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
{
abilities: {
reasoning: true,
@@ -166,19 +148,6 @@ const groqChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- contextWindowTokens: 32_768,
- displayName: 'Mistral Saba 24B',
- id: 'mistral-saba-24b',
- maxOutput: 32_768,
- pricing: {
- units: [
- { name: 'textInput', rate: 0.79, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.79, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
{
contextWindowTokens: 131_072,
displayName: 'Llama Guard 4 12B',
diff --git a/packages/model-bank/src/aiModels/higress.ts b/packages/model-bank/src/aiModels/higress.ts
index 7ff5c80e1ce..4b1dfa9714e 100644
--- a/packages/model-bank/src/aiModels/higress.ts
+++ b/packages/model-bank/src/aiModels/higress.ts
@@ -1867,19 +1867,6 @@ const higressChatModels: AIChatModelCard[] = [
id: 'gpt-35-turbo-16k',
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description:
- 'GPT-4 Turbo is a multimodal model with excellent language understanding and generation plus image input.',
- displayName: 'GPT 4 Turbo',
- enabled: true,
- id: 'gpt-4',
- type: 'chat',
- },
{
abilities: {
vision: true,
@@ -1890,85 +1877,6 @@ const higressChatModels: AIChatModelCard[] = [
id: 'gpt-4-vision-preview',
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description: 'GPT-4o Mini is a small, efficient model with performance comparable to GPT-4o.',
- displayName: 'GPT 4o Mini',
- enabled: true,
- id: 'gpt-4o-mini',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description: 'GPT-4o is the latest multimodal model with advanced text and image processing.',
- displayName: 'GPT 4o',
- enabled: true,
- id: 'gpt-4o',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: false,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description:
- 'Smaller and faster than o1-preview, 80% lower cost, strong at code generation and short-context tasks.',
- displayName: 'OpenAI o1-mini',
- enabled: true,
- id: 'o1-mini',
- maxOutput: 65_536,
- type: 'chat',
- },
- {
- abilities: {
- functionCall: false,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description:
- 'Focused on advanced reasoning and complex problem solving, including math and science. Ideal for applications needing deep context understanding and autonomous workflows.',
- displayName: 'OpenAI o1-preview',
- enabled: true,
- id: 'o1-preview',
- maxOutput: 32_768,
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description: 'A cost-effective AI solution for a wide range of text and image tasks.',
- displayName: 'OpenAI GPT-4o mini',
- enabled: true,
- id: 'gpt-4o-mini',
- maxOutput: 4096,
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- vision: true,
- },
- contextWindowTokens: 128_000,
- description:
- 'The most advanced multimodal model in the GPT-4 family, handling text and image inputs.',
- displayName: 'OpenAI GPT-4o',
- enabled: true,
- id: 'gpt-4o',
- maxOutput: 4096,
- type: 'chat',
- },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/hunyuan.ts b/packages/model-bank/src/aiModels/hunyuan.ts
index 0b37f95b55e..28b82f858c1 100644
--- a/packages/model-bank/src/aiModels/hunyuan.ts
+++ b/packages/model-bank/src/aiModels/hunyuan.ts
@@ -18,8 +18,30 @@ const hunyuanChatModels: AIChatModelCard[] = [
pricing: {
currency: 'CNY',
units: [
- { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
+ {
+ lookup: {
+ prices: {
+ '[0, 0.032]': 3.975,
+ '[0.032, infinity]': 5.3,
+ },
+ pricingParams: ['textInput'],
+ },
+ name: 'textInput',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
+ {
+ lookup: {
+ prices: {
+ '[0, 0.032]': 15.9,
+ '[0.032, infinity]': 21.2,
+ },
+ pricingParams: ['textInput'],
+ },
+ name: 'textOutput',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
],
},
releasedAt: '2025-11-09',
@@ -39,12 +61,34 @@ const hunyuanChatModels: AIChatModelCard[] = [
displayName: 'Tencent HY 2.0 Instruct',
enabled: true,
id: 'hunyuan-2.0-instruct-20251111',
- maxOutput: 64_000,
+ maxOutput: 16_000,
pricing: {
currency: 'CNY',
units: [
- { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
+ {
+ lookup: {
+ prices: {
+ '[0, 0.032]': 3.18,
+ '[0.032, infinity]': 4.505,
+ },
+ pricingParams: ['textInput'],
+ },
+ name: 'textInput',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
+ {
+ lookup: {
+ prices: {
+ '[0, 0.032]': 7.95,
+ '[0.032, infinity]': 11.13,
+ },
+ pricingParams: ['textInput'],
+ },
+ name: 'textOutput',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
],
},
releasedAt: '2025-11-11',
@@ -65,6 +109,13 @@ const hunyuanChatModels: AIChatModelCard[] = [
enabled: true,
id: 'hunyuan-a13b',
maxOutput: 32_000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
releasedAt: '2025-06-25',
settings: {
extendParams: ['enableReasoning'],
@@ -98,24 +149,95 @@ const hunyuanChatModels: AIChatModelCard[] = [
},
{
abilities: {
- functionCall: true,
+ reasoning: true,
search: true,
},
- contextWindowTokens: 44_000,
+ contextWindowTokens: 92_000,
description:
- 'The latest Hunyuan TurboS flagship model with stronger reasoning and a better overall experience.',
- displayName: 'Hunyuan TurboS',
- enabled: true,
- id: 'hunyuan-turbos-latest',
- maxOutput: 16_000,
+ 'Greatly improves hard math, logic, and coding, boosts output stability, and enhances long-text capability.',
+ displayName: 'Hunyuan T1 20250711',
+ id: 'hunyuan-t1-20250711',
+ maxOutput: 64_000,
pricing: {
currency: 'CNY',
units: [
- { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
],
},
- releasedAt: '2025-07-16',
+ releasedAt: '2025-07-11',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ search: true,
+ },
+ contextWindowTokens: 92_000,
+ description:
+ 'Improves creative writing and composition, strengthens frontend coding, math, and logic reasoning, and enhances instruction following.',
+ displayName: 'Hunyuan T1 20250529',
+ id: 'hunyuan-t1-20250529',
+ maxOutput: 64_000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-05-29',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ search: true,
+ },
+ contextWindowTokens: 92_000,
+ description:
+ 'Improves project-level code generation and writing quality, strengthens multi-turn topic understanding and ToB instruction following, improves word-level understanding, and reduces mixed simplified/traditional and Chinese/English output issues.',
+ displayName: 'Hunyuan T1 20250403',
+ id: 'hunyuan-t1-20250403',
+ maxOutput: 64_000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-04-03',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ reasoning: true,
+ search: true,
+ },
+ contextWindowTokens: 92_000,
+ description:
+ 'Builds balanced arts and STEM capabilities with strong long-text information capture. Supports reasoning answers for math, logic, science, and code problems across difficulty levels.',
+ displayName: 'Hunyuan T1 20250321',
+ id: 'hunyuan-t1-20250321',
+ maxOutput: 64_000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-03-21',
settings: {
searchImpl: 'params',
},
@@ -139,6 +261,194 @@ const hunyuanChatModels: AIChatModelCard[] = [
releasedAt: '2024-10-30',
type: 'chat',
},
+ {
+ abilities: {
+ search: true,
+ },
+ contextWindowTokens: 32_000,
+ description:
+ 'Uses improved routing to mitigate load balancing and expert collapse. Achieves 99.9% needle-in-a-haystack on long context. MOE-32K offers strong value while handling long inputs.',
+ displayName: 'Hunyuan Standard',
+ id: 'hunyuan-standard',
+ maxOutput: 2000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-02-10',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ search: true,
+ },
+ contextWindowTokens: 256_000,
+ description:
+ 'Uses improved routing to mitigate load balancing and expert collapse. Achieves 99.9% needle-in-a-haystack on long context. MOE-256K further expands context length and quality.',
+ displayName: 'Hunyuan Standard 256K',
+ id: 'hunyuan-standard-256K',
+ maxOutput: 6000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 0.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-02-10',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ search: true,
+ },
+ contextWindowTokens: 32_000,
+ description:
+ 'Hunyuan-large has ~389B total parameters and ~52B activated, the largest and strongest open MoE model in a Transformer architecture.',
+ displayName: 'Hunyuan Large',
+ id: 'hunyuan-large',
+ maxOutput: 4000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 4, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 12, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-02-10',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ search: true,
+ },
+ contextWindowTokens: 134_000,
+ description:
+ 'Excels at long-document tasks like summarization and QA while also handling general generation. Strong at long-text analysis and generation for complex, detailed content.',
+ displayName: 'Hunyuan Large Longcontext',
+ id: 'hunyuan-large-longcontext',
+ maxOutput: 6000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 18, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2024-12-18',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ search: true,
+ },
+ contextWindowTokens: 32_000,
+ description:
+ 'General experience improvements across NLP understanding, writing, chat, QA, translation, and domains; more human-like responses, better clarification on ambiguous intent, improved word parsing, higher creative quality and interactivity, and stronger multi-turn conversations.',
+ displayName: 'Hunyuan Turbo',
+ id: 'hunyuan-turbo-latest',
+ maxOutput: 4000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 2.4, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 9.6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-01-10',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ search: true,
+ },
+ contextWindowTokens: 32_000,
+ description:
+ 'This version boosts instruction scaling for better generalization, significantly improves math/code/logic reasoning, enhances word-level understanding, and improves writing quality.',
+ displayName: 'Hunyuan Turbo 20241223',
+ id: 'hunyuan-turbo-20241223',
+ maxOutput: 4000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 2.4, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 9.6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-01-10',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ search: true,
+ },
+ contextWindowTokens: 134_000,
+ description:
+ 'Excels at long-document tasks like summarization and QA while also handling general generation. Strong at long-text analysis and generation for complex, detailed content.',
+ displayName: 'Hunyuan TurboS LongText 128K',
+ id: 'hunyuan-turbos-longtext-128k-20250325',
+ maxOutput: 6000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 1.5, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-03-25',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ search: true,
+ },
+ contextWindowTokens: 44_000,
+ description:
+ 'The latest Hunyuan TurboS flagship model with stronger reasoning and a better overall experience.',
+ displayName: 'Hunyuan TurboS',
+ id: 'hunyuan-turbos-latest',
+ maxOutput: 16_000,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-07-16',
+ settings: {
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
{
abilities: {
vision: true,
diff --git a/packages/model-bank/src/aiModels/infiniai.ts b/packages/model-bank/src/aiModels/infiniai.ts
index 6157b3eef14..b4ab4fc6358 100644
--- a/packages/model-bank/src/aiModels/infiniai.ts
+++ b/packages/model-bank/src/aiModels/infiniai.ts
@@ -1,8 +1,31 @@
-import { type AIChatModelCard } from '../types/aiModel';
+import { type AIChatModelCard } from '../types/aiModel';
// https://cloud.infini-ai.com/genstudio/model
const infiniaiChatModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ functionCall: true,
+ vision: true,
+ },
+ contextWindowTokens: 131_072,
+ description:
+ 'GLM-4.6V (106B) is a foundational model designed for cloud and high-performance cluster scenarios. GLM-4.6V extends the context window to 128k tokens and achieves SOTA visual understanding performance among models of the same parameter scale. The key is that GLM-4.6V integrates native Function Calling capabilities for the first time, effectively bridging the gap between visual perception and executable actions, providing a unified technical foundation for multimodal Agents in real business scenarios.',
+ displayName: 'GLM-4.6V',
+ id: 'glm-4.6v',
+ maxOutput: 4096,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 6, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['enableReasoning'],
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/mistral.ts b/packages/model-bank/src/aiModels/mistral.ts
index e3012e437bf..82ea97687dc 100644
--- a/packages/model-bank/src/aiModels/mistral.ts
+++ b/packages/model-bank/src/aiModels/mistral.ts
@@ -8,9 +8,44 @@ const mistralChatModels: AIChatModelCard[] = [
abilities: {
functionCall: true,
},
- contextWindowTokens: 128_000,
+ contextWindowTokens: 262_144,
description:
- 'Mistral Medium 3 delivers state-of-the-art performance at 8× lower cost and simplifies enterprise deployment.',
+ 'Devstral 2 is an enterprise-level text model that excels at using tools to explore codebases, edit multiple files, and power software engineering agents.',
+ displayName: 'Devstral 2',
+ id: 'devstral-2512',
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.4, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-12-09',
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ },
+ contextWindowTokens: 262_144,
+ description: 'Devstral Small 2 excels at using tools to explore code bases, edit multiple files, and power software engineering agents.',
+ displayName: 'Devstral Small 2',
+ id: 'labs-devstral-small-2512',
+ pricing: {
+ units: [
+ { name: 'textInput', rate: 0.1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0.3, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-12-09',
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ },
+ contextWindowTokens: 131_072,
+ description:
+ 'Mistral Medium 3.1 delivers state-of-the-art performance at 8× lower cost and simplifies enterprise deployment.',
displayName: 'Mistral Medium 3.1',
enabled: true,
id: 'mistral-medium-latest',
@@ -27,7 +62,7 @@ const mistralChatModels: AIChatModelCard[] = [
reasoning: true,
vision: true,
},
- contextWindowTokens: 128_000,
+ contextWindowTokens: 131_072,
description:
'Magistral Medium 1.2 is a frontier reasoning model from Mistral AI (Sep 2025) with vision support.',
displayName: 'Magistral Medium 1.2',
@@ -46,7 +81,7 @@ const mistralChatModels: AIChatModelCard[] = [
reasoning: true,
vision: true,
},
- contextWindowTokens: 128_000,
+ contextWindowTokens: 131_072,
description:
'Magistral Small 1.2 is an open-source small reasoning model from Mistral AI (Sep 2025) with vision support.',
displayName: 'Magistral Small 1.2',
@@ -64,7 +99,7 @@ const mistralChatModels: AIChatModelCard[] = [
functionCall: true,
vision: true,
},
- contextWindowTokens: 128_000,
+ contextWindowTokens: 131_072,
description:
'Mistral Nemo is a 12B model co-developed with Nvidia, offering strong reasoning and coding performance with easy integration.',
displayName: 'Mistral Nemo',
@@ -81,7 +116,7 @@ const mistralChatModels: AIChatModelCard[] = [
abilities: {
functionCall: true,
},
- contextWindowTokens: 128_000,
+ contextWindowTokens: 131_072,
description:
'Mistral Small is a cost-effective, fast, and reliable option for translation, summarization, and sentiment analysis.',
displayName: 'Mistral Small 3.2',
diff --git a/packages/model-bank/src/aiModels/modelscope.ts b/packages/model-bank/src/aiModels/modelscope.ts
index 92368282eb1..21c1e6c27c4 100644
--- a/packages/model-bank/src/aiModels/modelscope.ts
+++ b/packages/model-bank/src/aiModels/modelscope.ts
@@ -27,22 +27,10 @@ const modelscopeChatModels: AIChatModelCard[] = [
},
contextWindowTokens: 131_072,
description:
- 'DeepSeek V3.2 Exp uses a hybrid reasoning architecture and supports both thinking and non-thinking modes.',
- displayName: 'DeepSeek V3.2 Exp',
+ 'DeepSeek V3.2 uses a hybrid reasoning architecture and supports both thinking and non-thinking modes.',
+ displayName: 'DeepSeek V3.2',
enabled: true,
- id: 'deepseek-ai/DeepSeek-V3.2-Exp',
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 131_072,
- description:
- 'DeepSeek V3.1 uses a hybrid reasoning architecture and supports both thinking and non-thinking modes.',
- displayName: 'DeepSeek V3.1',
- id: 'deepseek-ai/DeepSeek-V3.1',
+ id: 'deepseek-ai/DeepSeek-V3.2',
type: 'chat',
},
{
diff --git a/packages/model-bank/src/aiModels/nvidia.ts b/packages/model-bank/src/aiModels/nvidia.ts
index d91a95d780d..b077585a386 100644
--- a/packages/model-bank/src/aiModels/nvidia.ts
+++ b/packages/model-bank/src/aiModels/nvidia.ts
@@ -1,18 +1,6 @@
import { type AIChatModelCard } from '../types/aiModel';
const nvidiaChatModels: AIChatModelCard[] = [
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 200_000,
- description:
- 'A strong reasoning and agentic model from Z.ai with 744B total parameters (40B active), built for complex systems engineering and long-horizon tasks.',
- displayName: 'GLM-5',
- id: 'z-ai/glm5',
- type: 'chat',
- },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/openrouter.ts b/packages/model-bank/src/aiModels/openrouter.ts
index 28bdbf2f92c..abc1d251b32 100644
--- a/packages/model-bank/src/aiModels/openrouter.ts
+++ b/packages/model-bank/src/aiModels/openrouter.ts
@@ -51,25 +51,6 @@ const openrouterChatModels: AIChatModelCard[] = [
releasedAt: '2025-08-26',
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 163_840,
- description:
- 'DeepSeek-V3.1 is a large hybrid reasoning model with 128K context and efficient mode switching, delivering excellent performance and speed for tool use, code generation, and complex reasoning.',
- displayName: 'DeepSeek V3.1',
- id: 'deepseek/deepseek-chat-v3.1',
- pricing: {
- units: [
- { name: 'textInput', rate: 0.2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0.8, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-08-21',
- type: 'chat',
- },
{
abilities: {
reasoning: true,
diff --git a/packages/model-bank/src/aiModels/qwen.ts b/packages/model-bank/src/aiModels/qwen.ts
index 448f0aba8fe..4c53ea667f9 100644
--- a/packages/model-bank/src/aiModels/qwen.ts
+++ b/packages/model-bank/src/aiModels/qwen.ts
@@ -1632,7 +1632,7 @@ const qwenChatModels: AIChatModelCard[] = [
vision: true,
},
config: {
- deploymentName: 'qwen3-omni-flash-2025-09-15',
+ deploymentName: 'qwen3-omni-flash-2025-12-01',
},
contextWindowTokens: 65_536,
description:
diff --git a/packages/model-bank/src/aiModels/siliconcloud.ts b/packages/model-bank/src/aiModels/siliconcloud.ts
index 0e7192c8545..94cb393decd 100644
--- a/packages/model-bank/src/aiModels/siliconcloud.ts
+++ b/packages/model-bank/src/aiModels/siliconcloud.ts
@@ -5,6 +5,7 @@ const siliconcloudChatModels: AIChatModelCard[] = [
{
abilities: {
functionCall: true,
+ reasoning: true,
},
contextWindowTokens: 192_000,
description:
@@ -82,6 +83,73 @@ const siliconcloudChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
+ {
+ abilities: {
+ functionCall: true,
+ vision: true,
+ },
+ contextWindowTokens: 131_072,
+ description:
+ 'GLM-4.6V 在视觉理解精度上达到同参数规模 SOTA,并首次在模型架构中将 Function Call(工具调用)能力原生融入视觉模型,打通从「视觉感知」到「可执行行动(Action)」的链路,为真实业务场景中的多模态 Agent 提供统一的技术底座。',
+ displayName: 'GLM-4.6V',
+ id: 'zai-org/GLM-4.6V',
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 1, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-12-08',
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 163_840,
+ description:
+ "DeepSeek-V3.2 is a model that combines high computational efficiency with excellent reasoning and Agent performance. Its approach is based on three major technological breakthroughs: DeepSeek Sparse Attention (DSA), an efficient attention mechanism that significantly reduces computational complexity while maintaining model performance, and is specifically optimized for long-context scenarios; a scalable reinforcement learning framework, through which the model's performance can rival GPT-5, and its high-compute version can rival Gemini-3.0-Pro in reasoning capabilities; and a large-scale Agent task synthesis pipeline, designed to integrate reasoning capabilities into tool-using scenarios, thereby improving instruction-following and generalization abilities in complex interactive environments. The model achieved gold medal results in the 2025 International Mathematical Olympiad (IMO) and International Informatics Olympiad (IOI).",
+ displayName: 'DeepSeek V3.2',
+ enabled: true,
+ id: 'deepseek-ai/DeepSeek-V3.2',
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-12-01',
+ settings: {
+ extendParams: ['enableReasoning', 'reasoningBudgetToken'],
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ },
+ contextWindowTokens: 163_840,
+ description:
+ 'DeepSeek-V3.2 is a model that combines high computational efficiency with excellent reasoning and Agent performance. Its approach is built on three key technological breakthroughs: DeepSeek Sparse Attention (DSA), an efficient attention mechanism that significantly reduces computational complexity while maintaining model performance, and is specifically optimized for long-context scenarios; a scalable reinforcement learning framework through which model performance can rival GPT-5, with its high-compute version matching Gemini-3.0-Pro in reasoning capabilities; and a large-scale Agent task synthesis pipeline aimed at integrating reasoning capabilities into tool use scenarios, thereby improving instruction following and generalization in complex interactive environments. The model achieved gold medal performance in the 2025 International Mathematical Olympiad (IMO) and International Olympiad in Informatics (IOI).',
+ displayName: 'DeepSeek V3.2 (Pro)',
+ id: 'Pro/deepseek-ai/DeepSeek-V3.2',
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ releasedAt: '2025-12-01',
+ settings: {
+ extendParams: ['enableReasoning', 'reasoningBudgetToken'],
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
@@ -214,7 +282,7 @@ const siliconcloudChatModels: AIChatModelCard[] = [
},
contextWindowTokens: 262_144,
description:
- "Kimi K2 Thinking is the latest and most powerful open-source thinking model. It greatly extends multi-step reasoning depth and sustains stable tool use across 200–300 consecutive calls, setting new records on Humanity's Last Exam (HLE), BrowseComp, and other benchmarks. It excels in coding, math, logic, and agent scenarios. Built on an MoE architecture with ~1T total parameters, it supports a 256K context window and tool calling.",
+ "Kimi K2 Thinking is the latest and most powerful open-source thinking model. It greatly extends multi-step reasoning depth and sustains stable tool use across 200–300 consecutive calls, setting new records on Humanity's Last Exam (HLE), BrowseComp, and other benchmarks. 'It excels in coding, math, logic, and agent scenarios. Built on an MoE architecture with ~1T total parameters, it supports a 256K context window and tool calling.",
displayName: 'Kimi K2 Thinking',
id: 'moonshotai/Kimi-K2-Thinking',
pricing: {
@@ -258,7 +326,7 @@ const siliconcloudChatModels: AIChatModelCard[] = [
functionCall: true,
reasoning: true,
},
- contextWindowTokens: 128_000,
+ contextWindowTokens: 131_072,
description:
'MiniMax-M2 redefines agent efficiency. It is a compact, fast, cost-effective MoE model with 230B total and 10B active parameters, built for top-tier coding and agent tasks while retaining strong general intelligence. With only 10B active parameters, it rivals much larger models, making it ideal for high-efficiency applications.',
displayName: 'MiniMax-M2',
@@ -575,52 +643,6 @@ const siliconcloudChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 163_840,
- description:
- 'DeepSeek-V3.2-Exp is an experimental V3.2 release bridging to the next architecture. It adds DeepSeek Sparse Attention (DSA) on top of V3.1-Terminus to improve long-context training and inference efficiency, with optimizations for tool use, long-document understanding, and multi-step reasoning. It is ideal for exploring higher reasoning efficiency with large context budgets.',
- displayName: 'DeepSeek V3.2 Exp',
- id: 'deepseek-ai/DeepSeek-V3.2-Exp',
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-09-29',
- settings: {
- extendParams: ['enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 163_840,
- description:
- 'DeepSeek-V3.2-Exp is an experimental V3.2 release bridging to the next architecture. It adds DeepSeek Sparse Attention (DSA) on top of V3.1-Terminus to improve long-context training and inference efficiency, with optimizations for tool use, long-document understanding, and multi-step reasoning. It is ideal for exploring higher reasoning efficiency with large context budgets.',
- displayName: 'DeepSeek V3.2 Exp (Pro)',
- id: 'Pro/deepseek-ai/DeepSeek-V3.2-Exp',
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 2, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-09-29',
- settings: {
- extendParams: ['enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
@@ -630,7 +652,6 @@ const siliconcloudChatModels: AIChatModelCard[] = [
description:
'DeepSeek-V3.1-Terminus is an updated V3.1 model positioned as a hybrid agent LLM. It fixes user-reported issues and improves stability, language consistency, and reduces mixed Chinese/English and abnormal characters. It integrates Thinking and Non-thinking modes with chat templates for flexible switching. It also improves Code Agent and Search Agent performance for more reliable tool use and multi-step tasks.',
displayName: 'DeepSeek V3.1 Terminus',
- enabled: true,
id: 'deepseek-ai/DeepSeek-V3.1-Terminus',
pricing: {
currency: 'CNY',
@@ -879,29 +900,6 @@ const siliconcloudChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 131_072,
- description:
- 'GLM-4.5 is a base model built for agent applications using a Mixture-of-Experts architecture. It is deeply optimized for tool use, web browsing, software engineering, and frontend coding, and integrates with code agents like Claude Code and Roo Code. It uses hybrid reasoning to handle both complex reasoning and everyday scenarios.',
- displayName: 'GLM-4.5',
- id: 'zai-org/GLM-4.5',
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 3.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 14, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-07-28',
- settings: {
- extendParams: ['enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
@@ -1174,30 +1172,6 @@ const siliconcloudChatModels: AIChatModelCard[] = [
releasedAt: '2025-07-29',
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- },
- contextWindowTokens: 131_072,
- description:
- 'Qwen3 is a next-gen Tongyi Qwen model with major gains in reasoning, general ability, agent capability, and multilingual performance, and supports switching thinking modes.',
- displayName: 'Qwen3 235B A22B',
- id: 'Qwen/Qwen3-235B-A22B',
- organization: 'Qwen',
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 2.5, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- releasedAt: '2025-04-28',
- settings: {
- extendParams: ['enableReasoning', 'reasoningBudgetToken'],
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/vertexai.ts b/packages/model-bank/src/aiModels/vertexai.ts
index 879cd942c76..fc5f7879bf6 100644
--- a/packages/model-bank/src/aiModels/vertexai.ts
+++ b/packages/model-bank/src/aiModels/vertexai.ts
@@ -168,7 +168,7 @@ const vertexaiChatModels: AIChatModelCard[] = [
},
contextWindowTokens: 131_072 + 32_768,
description:
- 'Gemini 3 Pro Image(Nano Banana Pro)是 Google 的图像生成模型,同时支持多模态对话。',
+ "Gemini 3 Pro Image (Nano Banana Pro) is Google's image generation model that also supports multimodal dialogue.",
displayName: 'Nano Banana Pro',
enabled: true,
id: 'gemini-3-pro-image-preview',
diff --git a/packages/model-bank/src/aiModels/wenxin.ts b/packages/model-bank/src/aiModels/wenxin.ts
index 1a090e952c3..fc69b051939 100644
--- a/packages/model-bank/src/aiModels/wenxin.ts
+++ b/packages/model-bank/src/aiModels/wenxin.ts
@@ -192,82 +192,6 @@ const wenxinChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- vision: true,
- },
- contextWindowTokens: 32_768,
- description:
- 'The all-new version of the Wenxin Yiyan large model, with significantly enhanced capabilities in image understanding, creation, translation, and coding. It supports a 32K context length for the first time, with greatly reduced initial token latency.',
- displayName: 'ERNIE 4.5 Turbo VL 32K',
- id: 'ernie-4.5-turbo-vl-32k',
- maxOutput: 12_288,
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
- {
- abilities: {
- vision: true,
- },
- contextWindowTokens: 32_768,
- description:
- 'The all-new version of the Wenxin Yiyan large model, with significantly enhanced capabilities in image understanding, creation, translation, and coding. It supports a 32K context length for the first time, with greatly reduced initial token latency.',
- displayName: 'ERNIE 4.5 Turbo VL 32K Preview',
- id: 'ernie-4.5-turbo-vl-32k-preview',
- maxOutput: 16_384,
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
- {
- abilities: {
- vision: true,
- },
- contextWindowTokens: 131_072,
- description:
- 'The all-new version of the Wenxin Yiyan large model, with significantly enhanced capabilities in image understanding, creation, translation, and coding. It supports a 32K context length for the first time, with greatly reduced initial token latency.',
- displayName: 'ERNIE 4.5 Turbo VL',
- id: 'ernie-4.5-turbo-vl-latest',
- maxOutput: 12_288,
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
- {
- abilities: {
- vision: true,
- },
- contextWindowTokens: 131_072,
- description:
- 'The all-new version of the Wenxin Yiyan large model, with significantly enhanced capabilities in image understanding, creation, translation, and coding. It supports a 32K context length for the first time, with greatly reduced initial token latency.',
- displayName: 'ERNIE 4.5 Turbo VL Preview',
- id: 'ernie-4.5-turbo-vl-preview',
- maxOutput: 12_288,
- pricing: {
- currency: 'CNY',
- units: [
- { name: 'textInput', rate: 3, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 9, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
{
contextWindowTokens: 131_072,
description:
diff --git a/packages/model-bank/src/aiModels/zenmux.ts b/packages/model-bank/src/aiModels/zenmux.ts
index 037a8384d84..5f20852348c 100644
--- a/packages/model-bank/src/aiModels/zenmux.ts
+++ b/packages/model-bank/src/aiModels/zenmux.ts
@@ -107,27 +107,6 @@ const zenmuxChatModels: AIChatModelCard[] = [
releasedAt: '2025-11-20',
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- imageOutput: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 65_536,
- description: 'Gemini 3 Pro Image free tier with limited-quota multimodal generation.',
- displayName: 'Gemini 3 Pro Image (Nano Banana) Free',
- enabled: true,
- id: 'google/gemini-3-pro-image-preview-free',
- maxOutput: 32_768,
- pricing: {
- units: [
- { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
@@ -154,33 +133,6 @@ const zenmuxChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 1_050_000,
- description:
- 'Gemini 3 Pro Preview Free offers the same multimodal understanding and reasoning as the standard version, but with quota and rate limits, making it better for trials and low-frequency use.',
- displayName: 'Gemini 3 Pro Preview Free',
- enabled: true,
- id: 'google/gemini-3-pro-preview-free',
- maxOutput: 65_530,
- pricing: {
- units: [
- { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- settings: {
- extendParams: ['thinkingLevel2', 'urlContext'],
- searchImpl: 'params',
- searchProvider: 'google',
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
@@ -651,7 +603,7 @@ const zenmuxChatModels: AIChatModelCard[] = [
},
{
abilities: {
- reasoning: true,
+ functionCall: true,
},
contextWindowTokens: 128_000,
description:
@@ -739,33 +691,7 @@ const zenmuxChatModels: AIChatModelCard[] = [
},
contextWindowTokens: 1_050_000,
description:
- 'Gemini 2.5 Pro free tier offers limited-quota multimodal long-context, suitable for trials and light workflows.',
- displayName: 'Gemini 2.5 Pro Free',
- id: 'google/gemini-2.5-pro-free',
- maxOutput: 65_530,
- pricing: {
- units: [
- { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- settings: {
- extendParams: ['thinkingBudget', 'urlContext'],
- searchImpl: 'params',
- searchProvider: 'google',
- },
- type: 'chat',
- },
- {
- abilities: {
- functionCall: true,
- reasoning: true,
- search: true,
- vision: true,
- },
- contextWindowTokens: 1_050_000,
- description:
- 'Gemini 2.5 Flash (Lite/Pro/Flash) is Google’s family spanning low latency to high-performance reasoning.',
+ 'Gemini 2.5 Flash is Google’s family spanning low latency to high-performance reasoning.',
displayName: 'Gemini 2.5 Flash',
id: 'google/gemini-2.5-flash',
maxOutput: 65_530,
@@ -1195,26 +1121,6 @@ const zenmuxChatModels: AIChatModelCard[] = [
},
type: 'chat',
},
- {
- abilities: {
- functionCall: true,
- imageOutput: true,
- reasoning: true,
- vision: true,
- },
- contextWindowTokens: 32_768,
- description: 'Gemini 2.5 Flash Image free tier with limited-quota multimodal generation.',
- displayName: 'Gemini 2.5 Flash Image (Nano Banana) Free',
- id: 'google/gemini-2.5-flash-image-free',
- maxOutput: 8192,
- pricing: {
- units: [
- { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
- ],
- },
- type: 'chat',
- },
{
abilities: {
functionCall: true,
diff --git a/packages/model-bank/src/aiModels/zhipu.ts b/packages/model-bank/src/aiModels/zhipu.ts
index 3fb03674514..b4a5bfa883d 100644
--- a/packages/model-bank/src/aiModels/zhipu.ts
+++ b/packages/model-bank/src/aiModels/zhipu.ts
@@ -4,6 +4,96 @@ import { type AIChatModelCard, type AIImageModelCard } from '../types/aiModel';
// ref: https://docs.bigmodel.cn/cn/guide/start/model-overview
const zhipuChatModels: AIChatModelCard[] = [
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 131_072,
+ description:
+ 'GLM-4.6V is an important iteration of the GLM series in the multimodal direction. It increases the training context window to 128k tokens, achieves SOTA in visual understanding accuracy among models of similar parameter scale, and for the first time natively integrates Function Call (tool calling) capability into a vision model within the model architecture, bridging the path from "visual perception" to "executable actions". It provides a unified technical foundation for multimodal Agents in real business scenarios.',
+ displayName: 'GLM-4.6V',
+ enabled: true,
+ id: 'glm-4.6v',
+ maxOutput: 32_768,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ {
+ lookup: {
+ prices: {
+ '[0, 0.032]': 0.2,
+ '[0.032, infinity]': 0.4,
+ },
+ pricingParams: ['textInput'],
+ },
+ name: 'textInput_cacheRead',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
+ {
+ lookup: {
+ prices: {
+ '[0, 0.032]': 1,
+ '[0.032, infinity]': 2,
+ },
+ pricingParams: ['textInput'],
+ },
+ name: 'textInput',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
+ {
+ lookup: {
+ prices: {
+ '[0, 0.032]': 3,
+ '[0.032, infinity]': 6,
+ },
+ pricingParams: ['textInput'],
+ },
+ name: 'textOutput',
+ strategy: 'lookup',
+ unit: 'millionTokens',
+ },
+ { name: 'textInput_cacheWrite', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['enableReasoning'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
+ {
+ abilities: {
+ functionCall: true,
+ reasoning: true,
+ search: true,
+ vision: true,
+ },
+ contextWindowTokens: 131_072,
+ description:
+ 'GLM-4.6V-Flash is the free version of GLM-4.6V, an important iteration of the GLM series in the multimodal direction, supporting the toggle of thinking mode on or off.',
+ displayName: 'GLM-4.6V-Flash',
+ enabled: true,
+ id: 'glm-4.6v-flash',
+ maxOutput: 32_768,
+ pricing: {
+ currency: 'CNY',
+ units: [
+ { name: 'textInput_cacheRead', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textInput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 0, strategy: 'fixed', unit: 'millionTokens' },
+ ],
+ },
+ settings: {
+ extendParams: ['enableReasoning'],
+ searchImpl: 'params',
+ },
+ type: 'chat',
+ },
{
abilities: {
functionCall: true,
@@ -1019,7 +1109,7 @@ const zhipuChatModels: AIChatModelCard[] = [
'GLM-4V-Flash focuses on efficient single-image understanding for fast analysis scenarios such as real-time or batch image processing.',
displayName: 'GLM-4V-Flash',
id: 'glm-4v-flash',
- maxOutput: 8192,
+ maxOutput: 1024,
pricing: {
currency: 'CNY',
units: [
@@ -1039,6 +1129,7 @@ const zhipuChatModels: AIChatModelCard[] = [
'GLM-4V-Plus understands video and multiple images, suitable for multimodal tasks.',
displayName: 'GLM-4V-Plus-0111',
id: 'glm-4v-plus-0111',
+ maxOutput: 8192,
pricing: {
currency: 'CNY',
units: [
diff --git a/packages/model-runtime/src/providers/newapi/index.test.ts b/packages/model-runtime/src/providers/newapi/index.test.ts
index b5c21e28d37..89e8284540a 100644
--- a/packages/model-runtime/src/providers/newapi/index.test.ts
+++ b/packages/model-runtime/src/providers/newapi/index.test.ts
@@ -81,8 +81,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
testResponsesAPIModels = new Set(['o1-pro']);
const payload: ChatStreamPayload = {
+ messages: [{ content: 'test', role: 'user' }],
model: 'o1-pro',
- messages: [{ role: 'user', content: 'test' }],
temperature: 0.5,
};
@@ -95,8 +95,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
testResponsesAPIModels = new Set(); // Empty set to test gpt- logic
const payload: ChatStreamPayload = {
+ messages: [{ content: 'test', role: 'user' }],
model: 'gpt-4o',
- messages: [{ role: 'user', content: 'test' }],
temperature: 0.5,
};
@@ -109,8 +109,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
testResponsesAPIModels = new Set(); // Empty set to test o-series logic
const payload: ChatStreamPayload = {
+ messages: [{ content: 'test', role: 'user' }],
model: 'o1-mini',
- messages: [{ role: 'user', content: 'test' }],
temperature: 0.5,
};
@@ -123,8 +123,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
testResponsesAPIModels = new Set(); // Empty set to test o3 logic
const payload: ChatStreamPayload = {
+ messages: [{ content: 'test', role: 'user' }],
model: 'o3-turbo',
- messages: [{ role: 'user', content: 'test' }],
temperature: 0.5,
};
@@ -137,8 +137,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
testResponsesAPIModels = new Set(); // Empty set to test fallback logic
const payload: ChatStreamPayload = {
+ messages: [{ content: 'test', role: 'user' }],
model: 'claude-3-sonnet',
- messages: [{ role: 'user', content: 'test' }],
temperature: 0.5,
};
@@ -224,7 +224,7 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
});
it('should handle valid data from models.list (Branch 3.1: data exists)', () => {
- const data = [{ id: 'test-model', object: 'model', created: 123, owned_by: 'openai' }];
+ const data = [{ created: 123, id: 'test-model', object: 'model', owned_by: 'openai' }];
const modelList = data || [];
expect(modelList).toEqual(data);
});
@@ -255,7 +255,7 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
describe('Pricing Data Validation Branches', () => {
it('should handle pricingData.success = false (Branch 3.3)', () => {
- const pricingData = { success: false, data: [] };
+ const pricingData = { data: [], success: false };
const shouldProcess = pricingData.success && pricingData.data;
expect(shouldProcess).toBeFalsy();
});
@@ -267,7 +267,7 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
});
it('should process valid pricing data (Branch 3.5: success && data = true)', () => {
- const pricingData = { success: true, data: [{ model_name: 'test' }] };
+ const pricingData = { data: [{ model_name: 'test' }], success: true };
const shouldProcess = pricingData.success && pricingData.data;
expect(shouldProcess).toBeTruthy();
});
@@ -281,13 +281,13 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
});
it('should skip quota_type = 1 (Branch 3.7: quota_type !== 0)', () => {
- const pricing = { quota_type: 1, model_price: 10 };
+ const pricing = { model_price: 10, quota_type: 1 };
const shouldProcess = pricing.quota_type === 0;
expect(shouldProcess).toBe(false);
});
it('should process quota_type = 0 (Branch 3.7: quota_type === 0)', () => {
- const pricing = { quota_type: 0, model_price: 10 };
+ const pricing = { model_price: 10, quota_type: 0 };
const shouldProcess = pricing.quota_type === 0;
expect(shouldProcess).toBe(true);
});
@@ -404,8 +404,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should fallback to owned_by when supported_endpoint_types is empty (Branch 3.11: length > 0 = false, Branch 3.15: owned_by = true)', () => {
const model: Partial<NewAPIModelCard> = {
- supported_endpoint_types: [],
owned_by: 'anthropic',
+ supported_endpoint_types: [],
};
let detectedProvider = 'openai';
@@ -451,9 +451,9 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should cleanup _detectedProvider field (Branch 3.16: _detectedProvider exists = true)', () => {
const model: any = {
- id: 'test-model',
- displayName: 'Test Model',
_detectedProvider: 'openai',
+ displayName: 'Test Model',
+ id: 'test-model',
};
if (model._detectedProvider) {
@@ -465,8 +465,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should skip cleanup when no _detectedProvider field (Branch 3.16: _detectedProvider exists = false)', () => {
const model: any = {
- id: 'test-model',
displayName: 'Test Model',
+ id: 'test-model',
};
const hadDetectedProvider = '_detectedProvider' in model;
@@ -482,13 +482,13 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
describe('URL Processing Branch Coverage', () => {
it('should remove trailing API version paths from baseURL', () => {
const testURLs = [
- { input: 'https://api.newapi.com/v1', expected: 'https://api.newapi.com' },
- { input: 'https://api.newapi.com/v1/', expected: 'https://api.newapi.com' },
- { input: 'https://api.newapi.com/v1beta', expected: 'https://api.newapi.com' },
- { input: 'https://api.newapi.com/v1beta/', expected: 'https://api.newapi.com' },
- { input: 'https://api.newapi.com/v2', expected: 'https://api.newapi.com' },
- { input: 'https://api.newapi.com/v1alpha', expected: 'https://api.newapi.com' },
- { input: 'https://api.newapi.com', expected: 'https://api.newapi.com' },
+ { expected: 'https://api.newapi.com', input: 'https://api.newapi.com/v1' },
+ { expected: 'https://api.newapi.com', input: 'https://api.newapi.com/v1/' },
+ { expected: 'https://api.newapi.com', input: 'https://api.newapi.com/v1beta' },
+ { expected: 'https://api.newapi.com', input: 'https://api.newapi.com/v1beta/' },
+ { expected: 'https://api.newapi.com', input: 'https://api.newapi.com/v2' },
+ { expected: 'https://api.newapi.com', input: 'https://api.newapi.com/v1alpha' },
+ { expected: 'https://api.newapi.com', input: 'https://api.newapi.com' },
];
testURLs.forEach(({ input, expected }) => {
@@ -507,20 +507,20 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should validate NewAPI type definitions', () => {
const mockModel: NewAPIModelCard = {
+ created: 1_234_567_890,
id: 'test-model',
object: 'model',
- created: 1234567890,
owned_by: 'openai',
supported_endpoint_types: ['openai'],
};
const mockPricing: NewAPIPricing = {
+ completion_ratio: 1.5,
+ enable_groups: ['default'],
model_name: 'test-model',
- quota_type: 0,
model_price: 10,
model_ratio: 5,
- completion_ratio: 1.5,
- enable_groups: ['default'],
+ quota_type: 0,
supported_endpoint_types: ['openai'],
};
@@ -548,9 +548,9 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
];
const pricingData = [
- { model_name: 'anthropic-claude', quota_type: 0, model_price: 20, completion_ratio: 3 },
- { model_name: 'google-gemini', quota_type: 0, model_ratio: 5 },
- { model_name: 'openai-gpt4', quota_type: 1, model_price: 30 }, // Should be skipped
+ { completion_ratio: 3, model_name: 'anthropic-claude', model_price: 20, quota_type: 0 },
+ { model_name: 'google-gemini', model_ratio: 5, quota_type: 0 },
+ { model_name: 'openai-gpt4', model_price: 30, quota_type: 1 }, // Should be skipped
];
const pricingMap = new Map(pricingData.map((p) => [p.model_name, p]));
@@ -575,15 +575,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
units: [
{
name: 'textInput',
- unit: 'millionTokens',
- strategy: 'fixed',
rate: inputPrice,
+ strategy: 'fixed',
+ unit: 'millionTokens',
},
{
name: 'textOutput',
- unit: 'millionTokens',
- strategy: 'fixed',
rate: outputPrice,
+ strategy: 'fixed',
+ unit: 'millionTokens',
},
],
};
@@ -607,14 +607,14 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
// Verify pricing results
expect(enrichedModels[0].pricing).toEqual({
units: [
- { name: 'textInput', unit: 'millionTokens', strategy: 'fixed', rate: 40 },
- { name: 'textOutput', unit: 'millionTokens', strategy: 'fixed', rate: 120 },
+ { name: 'textInput', rate: 40, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 120, strategy: 'fixed', unit: 'millionTokens' },
],
}); // model_price * 2, input * completion_ratio
expect(enrichedModels[1].pricing).toEqual({
units: [
- { name: 'textInput', unit: 'millionTokens', strategy: 'fixed', rate: 10 },
- { name: 'textOutput', unit: 'millionTokens', strategy: 'fixed', rate: 10 },
+ { name: 'textInput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
+ { name: 'textOutput', rate: 10, strategy: 'fixed', unit: 'millionTokens' },
],
}); // model_ratio * 2, input * 1 (default)
expect(enrichedModels[2].pricing).toBeUndefined(); // quota_type = 1, skipped
@@ -822,15 +822,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should fetch models and process with processMultiProviderModelList', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [
{
+ created: 123,
id: 'test-model',
object: 'model',
- created: 123,
owned_by: 'openai',
},
],
@@ -844,8 +844,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
mockProcessMultiProviderModelList.mockReturnValue([
{
- id: 'test-model',
displayName: 'Test Model',
+ id: 'test-model',
},
]);
@@ -865,15 +865,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should handle successful pricing fetch and enrich models', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [
{
+ created: 123,
id: 'test-model',
object: 'model',
- created: 123,
owned_by: 'openai',
},
],
@@ -882,19 +882,19 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
};
mockFetch.mockResolvedValue({
- ok: true,
json: async () => ({
- success: true,
data: [
{
- model_name: 'test-model',
- quota_type: 0,
- model_price: 10,
completion_ratio: 1.5,
enable_groups: ['default'],
+ model_name: 'test-model',
+ model_price: 10,
+ quota_type: 0,
},
],
+ success: true,
}),
+ ok: true,
});
mockProcessMultiProviderModelList.mockImplementation((models) => models);
@@ -903,6 +903,7 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
expect(mockFetch).toHaveBeenCalledWith('https://api.newapi.com/api/pricing', {
headers: {
+ Accept: 'application/json; charset=utf-8',
Authorization: 'Bearer test-key',
},
});
@@ -927,15 +928,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should handle pricing fetch with model_ratio instead of model_price', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [
{
+ created: 123,
id: 'test-model',
object: 'model',
- created: 123,
owned_by: 'openai',
},
],
@@ -944,18 +945,18 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
};
mockFetch.mockResolvedValue({
- ok: true,
json: async () => ({
- success: true,
data: [
{
+ enable_groups: ['default'],
model_name: 'test-model',
- quota_type: 0,
model_ratio: 5,
- enable_groups: ['default'],
+ quota_type: 0,
},
],
+ success: true,
}),
+ ok: true,
});
mockProcessMultiProviderModelList.mockImplementation((models) => models);
@@ -982,15 +983,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should skip pricing for quota_type = 1 (pay-per-call)', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [
{
+ created: 123,
id: 'test-model',
object: 'model',
- created: 123,
owned_by: 'openai',
},
],
@@ -999,18 +1000,20 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
};
mockFetch.mockResolvedValue({
- ok: true,
json: async () => ({
- success: true,
data: [
{
+ enable_groups: ['default'],
+
model_name: 'test-model',
- quota_type: 1, // Pay-per-call, not supported
+ // Pay-per-call, not supported
model_price: 10,
- enable_groups: ['default'],
+ quota_type: 1,
},
],
+ success: true,
}),
+ ok: true,
});
mockProcessMultiProviderModelList.mockImplementation((models) => models);
@@ -1022,15 +1025,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should handle pricing fetch failure gracefully', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [
{
+ created: 123,
id: 'test-model',
object: 'model',
- created: 123,
owned_by: 'openai',
},
],
@@ -1051,15 +1054,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should handle pricing fetch network error gracefully', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [
{
+ created: 123,
id: 'test-model',
object: 'model',
- created: 123,
owned_by: 'openai',
},
],
@@ -1082,15 +1085,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should handle pricing data with success=false', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [
{
+ created: 123,
id: 'test-model',
object: 'model',
- created: 123,
owned_by: 'openai',
},
],
@@ -1099,11 +1102,11 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
};
mockFetch.mockResolvedValue({
- ok: true,
json: async () => ({
- success: false,
data: [],
+ success: false,
}),
+ ok: true,
});
mockProcessMultiProviderModelList.mockImplementation((models) => models);
@@ -1115,15 +1118,15 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should handle pricing data with missing data field', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [
{
+ created: 123,
id: 'test-model',
object: 'model',
- created: 123,
owned_by: 'openai',
},
],
@@ -1132,11 +1135,11 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
};
mockFetch.mockResolvedValue({
- ok: true,
json: async () => ({
success: true,
// Missing data field
}),
+ ok: true,
});
mockProcessMultiProviderModelList.mockImplementation((models) => models);
@@ -1148,8 +1151,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should handle empty model list', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: [],
@@ -1170,8 +1173,8 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should handle undefined model data', async () => {
const mockClient = {
- baseURL: 'https://api.newapi.com/v1',
apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
models: {
list: vi.fn().mockResolvedValue({
data: undefined,
@@ -1193,17 +1196,17 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
it('should strip version paths from baseURL correctly', async () => {
const testCases = [
- { input: 'https://api.com/v1', expected: 'https://api.com' },
- { input: 'https://api.com/v1/', expected: 'https://api.com' },
- { input: 'https://api.com/v1beta', expected: 'https://api.com' },
- { input: 'https://api.com/v2alpha/', expected: 'https://api.com' },
- { input: 'https://api.com', expected: 'https://api.com' },
+ { expected: 'https://api.com', input: 'https://api.com/v1' },
+ { expected: 'https://api.com', input: 'https://api.com/v1/' },
+ { expected: 'https://api.com', input: 'https://api.com/v1beta' },
+ { expected: 'https://api.com', input: 'https://api.com/v2alpha/' },
+ { expected: 'https://api.com', input: 'https://api.com' },
];
for (const testCase of testCases) {
const mockClient = {
- baseURL: testCase.input,
apiKey: 'test-key',
+ baseURL: testCase.input,
models: {
list: vi.fn().mockResolvedValue({ data: [] }),
},
@@ -1222,6 +1225,188 @@ describe('NewAPI Runtime - 100% Branch Coverage', () => {
}
}
});
+
+ it('should add models from pricing list that are not in models list', async () => {
+ const mockClient = {
+ apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
+ models: {
+ list: vi.fn().mockResolvedValue({
+ data: [
+ {
+ created: 123,
+ id: 'model-a',
+ object: 'model',
+ owned_by: 'openai',
+ },
+ ],
+ }),
+ },
+ };
+
+ mockFetch.mockResolvedValue({
+ json: async () => ({
+ data: [
+ {
+ enable_groups: ['default'],
+ model_name: 'model-a',
+ model_price: 10,
+ quota_type: 0,
+ },
+ {
+ completion_ratio: 2,
+ enable_groups: ['default'],
+
+ model_name: 'model-b',
+
+ model_price: 20,
+ // Only in pricing, not in models
+ quota_type: 0,
+ },
+ ],
+ success: true,
+ }),
+ ok: true,
+ });
+
+ mockProcessMultiProviderModelList.mockImplementation((models) => models);
+
+ const result = await params.models({ client: mockClient as any });
+
+ // Should have 2 models: model-a from /v1/models and model-b from pricing
+ expect(result).toHaveLength(2);
+ expect(result.find((m: any) => m.id === 'model-a')).toBeDefined();
+ expect(result.find((m: any) => m.id === 'model-b')).toBeDefined();
+
+ // model-b should have pricing info
+ const modelB = result.find((m: any) => m.id === 'model-b') as any;
+ expect(modelB).toBeDefined();
+ expect(modelB.pricing).toEqual({
+ units: [
+ {
+ name: 'textInput',
+ rate: 40, // model_price * 2
+ strategy: 'fixed',
+ unit: 'millionTokens',
+ },
+ {
+ name: 'textOutput',
+ rate: 80, // 40 * 2
+ strategy: 'fixed',
+ unit: 'millionTokens',
+ },
+ ],
+ });
+ });
+
+ it('should not duplicate models that exist in both lists', async () => {
+ const mockClient = {
+ apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
+ models: {
+ list: vi.fn().mockResolvedValue({
+ data: [
+ {
+ created: 123,
+ id: 'model-a',
+ object: 'model',
+ owned_by: 'openai',
+ },
+ ],
+ }),
+ },
+ };
+
+ mockFetch.mockResolvedValue({
+ json: async () => ({
+ data: [
+ {
+ enable_groups: ['default'],
+ model_name: 'model-a',
+
+ model_price: 10,
+ // Same as in models list
+ quota_type: 0,
+ },
+ ],
+ success: true,
+ }),
+ ok: true,
+ });
+
+ mockProcessMultiProviderModelList.mockImplementation((models) => models);
+
+ const result = await params.models({ client: mockClient as any });
+
+ // Should have only 1 model, not duplicated
+ expect(result).toHaveLength(1);
+ expect(result[0].id).toBe('model-a');
+ });
+
+ it('should verify that additionalModels get processed with displayName and type through processMultiProviderModelList', async () => {
+ const mockClient = {
+ apiKey: 'test-key',
+ baseURL: 'https://api.newapi.com/v1',
+ models: {
+ list: vi.fn().mockResolvedValue({
+ data: [],
+ }),
+ },
+ };
+
+ mockFetch.mockResolvedValue({
+ json: async () => ({
+ data: [
+ {
+ enable_groups: ['default'],
+ model_name: 'new-model-from-pricing',
+ model_price: 15,
+ quota_type: 0,
+ },
+ ],
+ success: true,
+ }),
+ ok: true,
+ });
+
+ // Mock processMultiProviderModelList to simulate the real behavior of adding displayName and type
+ mockProcessMultiProviderModelList.mockImplementation((models) =>
+ models.map((m: any) => ({
+ ...m,
+ displayName: m.displayName || m.id, // processModelCard adds displayName
+ enabled: m.enabled || false,
+ type: m.type || 'chat', // processModelCard adds type
+ })),
+ );
+
+ const result = await params.models({ client: mockClient as any });
+
+ // Verify the model was added from pricing
+ expect(result).toHaveLength(1);
+ expect(result[0].id).toBe('new-model-from-pricing');
+
+ // Verify that processMultiProviderModelList was called with the additionalModels
+ expect(mockProcessMultiProviderModelList).toHaveBeenCalledWith(
+ expect.arrayContaining([
+ expect.objectContaining({
+ id: 'new-model-from-pricing',
+ pricing: expect.objectContaining({
+ units: expect.arrayContaining([
+ expect.objectContaining({ name: 'textInput' }),
+ expect.objectContaining({ name: 'textOutput' }),
+ ]),
+ }),
+ }),
+ ]),
+ 'newapi',
+ );
+
+ // Verify that after processing, the model has the required fields
+ expect(result[0]).toHaveProperty('displayName');
+ expect(result[0]).toHaveProperty('type');
+ expect(result[0].displayName).toBe('new-model-from-pricing'); // Falls back to id
+ expect(result[0].type).toBe('chat'); // Default type
+ });
});
describe('Runtime Instance Creation', () => {
diff --git a/packages/model-runtime/src/providers/newapi/index.ts b/packages/model-runtime/src/providers/newapi/index.ts
index 412566eeaef..40fa7e27e2a 100644
--- a/packages/model-runtime/src/providers/newapi/index.ts
+++ b/packages/model-runtime/src/providers/newapi/index.ts
@@ -16,6 +16,7 @@ export interface NewAPIModelCard {
export interface NewAPIPricing {
completion_ratio?: number;
+ description?: string;
enable_groups: string[];
model_name: string;
model_price?: number;
@@ -66,9 +67,10 @@ const fetchPricing = async (
return await parsePricingResponse(proxyResponse);
} else {
- // In server environment, fetch directly
+ // In server environment, fetch directly with proper encoding headers
const pricingResponse = await fetch(pricingUrl, {
headers: {
+ Accept: 'application/json; charset=utf-8',
Authorization: `Bearer ${apiKey}`,
},
});
@@ -96,16 +98,63 @@ export const params = {
const modelsPage = (await openAIClient.models.list()) as any;
const modelList: NewAPIModelCard[] = modelsPage.data || [];
+ // Create a set of existing model IDs for quick lookup
+ const existingModelIds = new Set(modelList.map((m) => m.id));
+
// Try to get pricing information to enrich model details
const pricingMap: Map<string, NewAPIPricing> = new Map();
const pricingList = await fetchPricing(`${baseURL}/api/pricing`, openAIClient.apiKey || '');
- if (pricingList) {
+ if (Array.isArray(pricingList)) {
pricingList.forEach((pricing) => {
pricingMap.set(pricing.model_name, pricing);
});
}
+ const calculatePricing = (pricing: NewAPIPricing) => {
+ let inputPrice: number | undefined;
+ let outputPrice: number | undefined;
+
+ if (pricing.quota_type === 0) {
+ // Pay-per-token
+ if (pricing.model_price && pricing.model_price > 0) {
+ // model_price is a direct price value; need to confirm its unit.
+ // Assumption: model_price is the price per 1,000 tokens (i.e., $/1K tokens).
+ // To convert to price per 1,000,000 tokens ($/1M tokens), multiply by 1,000,000 / 1,000 = 1,000.
+ // Since the base price is $0.002/1K tokens, multiplying by 2 gives $2/1M tokens.
+ // Therefore, inputPrice = model_price * 2 converts the price to $/1M tokens for LobeChat.
+ inputPrice = pricing.model_price * 2;
+ } else if (pricing.model_ratio) {
+ // model_ratio × $0.002/1K = model_ratio × $2/1M
+ inputPrice = pricing.model_ratio * 2; // Convert to $/1M tokens
+ }
+
+ if (inputPrice !== undefined) {
+ // Calculate output price
+ outputPrice = inputPrice * (pricing.completion_ratio || 1);
+
+ return {
+ units: [
+ {
+ name: 'textInput',
+ rate: inputPrice,
+ strategy: 'fixed',
+ unit: 'millionTokens',
+ },
+ {
+ name: 'textOutput',
+ rate: outputPrice,
+ strategy: 'fixed',
+ unit: 'millionTokens',
+ },
+ ],
+ };
+ }
+ }
+ // quota_type === 1 pay-per-call is not currently supported
+ return undefined;
+ };
+
// Process the model list: determine the provider for each model based on priority rules
const enrichedModelList = modelList.map((model) => {
const enhancedModel: any = { ...model };
@@ -121,52 +170,29 @@ export const params = {
//
// LobeChat required format: USD per million tokens
- let inputPrice: number | undefined;
- let outputPrice: number | undefined;
-
- if (pricing.quota_type === 0) {
- // Pay-per-token
- if (pricing.model_price && pricing.model_price > 0) {
- // model_price is a direct price value; need to confirm its unit.
- // Assumption: model_price is the price per 1,000 tokens (i.e., $/1K tokens).
- // To convert to price per 1,000,000 tokens ($/1M tokens), multiply by 1,000,000 / 1,000 = 1,000.
- // Since the base price is $0.002/1K tokens, multiplying by 2 gives $2/1M tokens.
- // Therefore, inputPrice = model_price * 2 converts the price to $/1M tokens for LobeChat.
- inputPrice = pricing.model_price * 2;
- } else if (pricing.model_ratio) {
- // model_ratio × $0.002/1K = model_ratio × $2/1M
- inputPrice = pricing.model_ratio * 2; // Convert to $/1M tokens
- }
-
- if (inputPrice !== undefined) {
- // Calculate output price
- outputPrice = inputPrice * (pricing.completion_ratio || 1);
-
- enhancedModel.pricing = {
- units: [
- {
- name: 'textInput',
- rate: inputPrice,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- {
- name: 'textOutput',
- rate: outputPrice,
- strategy: 'fixed',
- unit: 'millionTokens',
- },
- ],
- };
- }
+ const pricingData = calculatePricing(pricing);
+ if (pricingData) {
+ enhancedModel.pricing = pricingData;
}
- // quota_type === 1 pay-per-call is not currently supported
}
return enhancedModel;
});
- return processMultiProviderModelList(enrichedModelList, 'newapi');
+ // Add models from pricing list that are not in the models list
+ const additionalModels: any[] = [];
+ pricingMap.forEach((pricing, modelName) => {
+ if (!existingModelIds.has(modelName)) {
+ const pricingData = calculatePricing(pricing);
+ additionalModels.push({
+ ...(pricing.description && { description: pricing.description }),
+ id: modelName,
+ ...(pricingData && { pricing: pricingData }),
+ });
+ }
+ });
+
+ return processMultiProviderModelList([...enrichedModelList, ...additionalModels], 'newapi');
},
routers: (options) => {
const userBaseURL = options.baseURL?.replace(/\/v\d+[a-z]*\/?$/, '') || '';
diff --git a/src/app/(backend)/webapi/proxy/route.ts b/src/app/(backend)/webapi/proxy/route.ts
index df17f17fece..4888d32f94f 100644
--- a/src/app/(backend)/webapi/proxy/route.ts
+++ b/src/app/(backend)/webapi/proxy/route.ts
@@ -9,7 +9,14 @@ export const POST = async (req: Request) => {
try {
const res = await ssrfSafeFetch(url);
- return new Response(await res.arrayBuffer(), { headers: { ...res.headers } });
+
+ // Clone headers and remove Content-Encoding because fetch() automatically
+ // decompresses the response body, so we should not forward this header
+ const headers = new Headers(res.headers);
+ headers.delete('Content-Encoding');
+ headers.delete('Content-Length'); // Length changes after decompression
+
+ return new Response(await res.arrayBuffer(), { headers });
} catch (err) {
console.error(err); // DNS lookup 127.0.0.1(family:4, host:127.0.0.1.nip.io) is not allowed. Because, It is private IP address.
return NextResponse.json({ error: 'Not support internal host proxy' }, { status: 400 });