From 1ca01bcd10c8d96d9b4b9c0cd71eddfa7d8a0159 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 10 Jun 2026 09:27:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(usage):=20refresh=20model=20pricing=20seed?= =?UTF-8?q?=20=E2=80=94=20add=20Fable=205=20+=208=20models,=20fix=2028=20p?= =?UTF-8?q?rices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Full audit of seed_model_pricing against current official vendor pricing. New models: claude-fable-5 (10/50), grok-4.3, step-3.7-flash, mistral-medium-3.5, mistral-small-4, devstral-small-2-2512, magistral-small, qwen3.7-max, qwen3.7-plus. Price fixes (Chinese vendors standardized on official list price, CNY/~7.14): - GLM 4.6/4.7 -> Z.ai official 0.6/2.2/0.11 (were reseller/OpenRouter rates) - Grok 4.20 reasoning/non-reasoning -> 1.25/2.50 (xAI price cut) - MiMo v2.5 / v2.5-pro / v2-pro -> post-2026-05-27 rates + cache - Doubao Seed 2.0 lite corrected + cache-hit prices across the family - Kimi k2.5 output 3.00, MiniMax m2.5 input 0.15, Mistral devstral-2 output 2 - Qwen 3.5/3.6-plus + coder-plus/flash cache_read (official 20%-of-input rule) Each fix updates the seed value (fresh installs) and adds an old->new guard to repair_current_model_pricing (existing DBs; won't clobber user-edited rows). --- src-tauri/src/database/schema.rs | 331 ++++++++++++++++++++++++++++--- 1 file changed, 308 insertions(+), 23 deletions(-) diff --git a/src-tauri/src/database/schema.rs b/src-tauri/src/database/schema.rs index ce0f87087..57263be25 100644 --- a/src-tauri/src/database/schema.rs +++ b/src-tauri/src/database/schema.rs @@ -1205,6 +1205,15 @@ impl Database { /// 注意: model_id 使用短横线格式(如 claude-haiku-4-5),与 API 返回的模型名称标准化后一致 fn seed_model_pricing(conn: &Connection) -> Result<(), AppError> { let pricing_data = [ + // Claude Fable 5(Opus 之上的新档) + ( + "claude-fable-5", + "Claude Fable 5", + "10", + "50", + "1.00", + "12.50", + ), // Claude 4.8 系列 ( "claude-opus-4-8", @@ -1571,6 +1580,14 @@ impl Database { "0", ), // StepFun 系列 + ( + "step-3.7-flash", + "Step 3.7 Flash", + "0.19", + "1.13", + "0.04", + "0", + ), ( "step-3.5-flash", "Step 3.5 Flash", @@ -1602,7 +1619,7 @@ impl Database { "Doubao Seed 2.0 Pro", "0.47", "2.37", - "0", + "0.09", "0", ), ( @@ -1610,7 +1627,7 @@ impl Database { "Doubao Seed 2.0 Code", "0.47", "2.37", - "0", + "0.09", "0", ), ( @@ -1618,15 +1635,15 @@ impl Database { "Doubao Seed 2.0 Code Preview", "0.47", "2.37", - "0", + "0.09", "0", ), ( "doubao-seed-2-0-lite", "Doubao Seed 2.0 Lite", - "0.25", - "2", - "0", + "0.08", + "0.50", + "0.017", "0", ), ( @@ -1634,7 +1651,7 @@ impl Database { "Doubao Seed 2.0 Mini", "0.03", "0.31", - "0", + "0.0056", "0", ), // DeepSeek 系列 @@ -1706,7 +1723,7 @@ impl Database { "0.14", "0", ), - ("kimi-k2.5", "Kimi K2.5", "0.60", "2.50", "0.10", "0"), + ("kimi-k2.5", "Kimi K2.5", "0.60", "3.00", "0.10", "0"), ("kimi-k2.6", "Kimi K2.6", "0.95", "4.00", "0.16", "0"), // MiniMax 系列 ("minimax-m2.1", "MiniMax M2.1", "0.27", "0.95", "0.03", "0"), @@ -1719,7 +1736,7 @@ impl Database { "0", ), ("minimax-m2", "MiniMax M2", "0.27", "0.95", "0.03", "0"), - ("minimax-m2.5", "MiniMax M2.5", "0.12", "0.95", "0.03", "0"), + ("minimax-m2.5", "MiniMax M2.5", "0.15", "0.95", "0.03", "0"), ( "minimax-m2.5-lightning", "MiniMax M2.5 Lightning", @@ -1746,8 +1763,8 @@ impl Database { ), ("minimax-m3", "MiniMax M3", "0.60", "2.40", "0.12", "0"), // GLM (智谱) - ("glm-4.7", "GLM-4.7", "0.39", "1.75", "0.04", "0"), - ("glm-4.6", "GLM-4.6", "0.28", "1.11", "0.03", "0"), + ("glm-4.7", "GLM-4.7", "0.6", "2.2", "0.11", "0"), + ("glm-4.6", "GLM-4.6", "0.6", "2.2", "0.11", "0"), ("glm-5", "GLM-5", "1", "3.2", "0.2", "0"), ("glm-5.1", "GLM-5.1", "1.4", "4.4", "0.26", "0"), // MiMo (小米) @@ -1759,12 +1776,28 @@ impl Database { "0.009", "0", ), - ("mimo-v2-pro", "MiMo V2 Pro", "1", "3", "0", "0"), - ("mimo-v2.5", "MiMo V2.5", "0.09", "0.29", "0.009", "0"), - ("mimo-v2.5-pro", "MiMo V2.5 Pro", "1", "3", "0", "0"), + ("mimo-v2-pro", "MiMo V2 Pro", "0.435", "0.87", "0.0036", "0"), + ("mimo-v2.5", "MiMo V2.5", "0.14", "0.29", "0.0028", "0"), + ( + "mimo-v2.5-pro", + "MiMo V2.5 Pro", + "0.435", + "0.87", + "0.0036", + "0", + ), // Qwen 系列 (阿里巴巴) - ("qwen3.6-plus", "Qwen3.6 Plus", "0.325", "1.95", "0", "0"), - ("qwen3.5-plus", "Qwen3.5 Plus", "0.26", "1.56", "0", "0"), + ("qwen3.7-max", "Qwen3.7 Max", "2.50", "7.50", "0.25", "0"), + ("qwen3.7-plus", "Qwen3.7 Plus", "0.40", "1.60", "0.08", "0"), + ( + "qwen3.6-plus", + "Qwen3.6 Plus", + "0.325", + "1.95", + "0.065", + "0", + ), + ("qwen3.5-plus", "Qwen3.5 Plus", "0.26", "1.56", "0.052", "0"), ("qwen3-max", "Qwen3 Max", "0.78", "3.90", "0", "0"), ( "qwen3-235b-a22b", @@ -1779,7 +1812,7 @@ impl Database { "Qwen3 Coder Plus", "0.65", "3.25", - "0", + "0.13", "0", ), ( @@ -1803,7 +1836,7 @@ impl Database { "Qwen3 Coder Flash", "0.195", "0.975", - "0", + "0.039", "0", ), ( @@ -1818,19 +1851,20 @@ impl Database { ("qwq-32b", "QwQ 32B", "0.20", "0.60", "0", "0"), ("qwen3-32b", "Qwen3 32B", "0.16", "0.64", "0", "0"), // Grok 系列 (xAI) + ("grok-4.3", "Grok 4.3", "1.25", "2.50", "0.20", "0"), ( "grok-4.20-0309-reasoning", "Grok 4.20 Reasoning", - "2", - "6", + "1.25", + "2.50", "0.20", "0", ), ( "grok-4.20-0309-non-reasoning", "Grok 4.20", - "2", - "6", + "1.25", + "2.50", "0.20", "0", ), @@ -1863,6 +1897,38 @@ impl Database { ("grok-3", "Grok 3", "3", "15", "0.75", "0"), ("grok-3-mini", "Grok 3 Mini", "0.25", "0.50", "0.075", "0"), // Mistral 系列 + ( + "mistral-medium-3.5", + "Mistral Medium 3.5", + "1.50", + "7.50", + "0", + "0", + ), + ( + "mistral-small-4", + "Mistral Small 4", + "0.10", + "0.30", + "0.01", + "0", + ), + ( + "devstral-small-2-2512", + "Devstral Small 2", + "0.10", + "0.30", + "0.01", + "0", + ), + ( + "magistral-small", + "Magistral Small", + "0.50", + "1.50", + "0", + "0", + ), ("codestral-2508", "Codestral", "0.30", "0.90", "0.03", "0"), ( "devstral-small-1.1", @@ -1872,7 +1938,7 @@ impl Database { "0.01", "0", ), - ("devstral-2-2512", "Devstral 2", "0.40", "0.90", "0.04", "0"), + ("devstral-2-2512", "Devstral 2", "0.40", "2", "0.04", "0"), ( "devstral-medium", "Devstral Medium", @@ -1953,6 +2019,225 @@ impl Database { fn repair_current_model_pricing(conn: &Connection) -> Result<(), AppError> { let pricing_fixes = [ + // 2026-06-10 全量核价(厂商官方 list 价;CNY 按 ~7.14 折算) + // GLM 4.6/4.7:旧值是中转/OpenRouter 折扣价,统一到 Z.ai 官方(与 glm-5/5.1 一致) + ( + "glm-4.7", "GLM-4.7", "0.6", "2.2", "0.11", "0", "0.39", "1.75", "0.04", "0", + ), + ( + "glm-4.6", "GLM-4.6", "0.6", "2.2", "0.11", "0", "0.28", "1.11", "0.03", "0", + ), + // Grok 4.20:xAI 已降价 2/6 → 1.25/2.50 + ( + "grok-4.20-0309-reasoning", + "Grok 4.20 Reasoning", + "1.25", + "2.50", + "0.20", + "0", + "2", + "6", + "0.20", + "0", + ), + ( + "grok-4.20-0309-non-reasoning", + "Grok 4.20", + "1.25", + "2.50", + "0.20", + "0", + "2", + "6", + "0.20", + "0", + ), + // Kimi K2.5 官方 output 3.00 + ( + "kimi-k2.5", + "Kimi K2.5", + "0.60", + "3.00", + "0.10", + "0", + "0.60", + "2.50", + "0.10", + "0", + ), + // MiniMax M2.5 input 0.15 + ( + "minimax-m2.5", + "MiniMax M2.5", + "0.15", + "0.95", + "0.03", + "0", + "0.12", + "0.95", + "0.03", + "0", + ), + // Mistral Devstral 2 output 0.90 → 2(与同表 devstral-medium 一致) + ( + "devstral-2-2512", + "Devstral 2", + "0.40", + "2", + "0.04", + "0", + "0.40", + "0.90", + "0.04", + "0", + ), + // Doubao Seed 2.0:lite 旧价贵 3-4 倍 + 全系补 cache 命中价 + ( + "doubao-seed-2-0-lite", + "Doubao Seed 2.0 Lite", + "0.08", + "0.50", + "0.017", + "0", + "0.25", + "2", + "0", + "0", + ), + ( + "doubao-seed-2-0-pro", + "Doubao Seed 2.0 Pro", + "0.47", + "2.37", + "0.09", + "0", + "0.47", + "2.37", + "0", + "0", + ), + ( + "doubao-seed-2-0-code", + "Doubao Seed 2.0 Code", + "0.47", + "2.37", + "0.09", + "0", + "0.47", + "2.37", + "0", + "0", + ), + ( + "doubao-seed-2-0-code-preview-latest", + "Doubao Seed 2.0 Code Preview", + "0.47", + "2.37", + "0.09", + "0", + "0.47", + "2.37", + "0", + "0", + ), + ( + "doubao-seed-2-0-mini", + "Doubao Seed 2.0 Mini", + "0.03", + "0.31", + "0.0056", + "0", + "0.03", + "0.31", + "0", + "0", + ), + // MiMo:5/27 永久降价,旧值是旧价 + ( + "mimo-v2-pro", + "MiMo V2 Pro", + "0.435", + "0.87", + "0.0036", + "0", + "1", + "3", + "0", + "0", + ), + ( + "mimo-v2.5", + "MiMo V2.5", + "0.14", + "0.29", + "0.0028", + "0", + "0.09", + "0.29", + "0.009", + "0", + ), + ( + "mimo-v2.5-pro", + "MiMo V2.5 Pro", + "0.435", + "0.87", + "0.0036", + "0", + "1", + "3", + "0", + "0", + ), + // Qwen:官方"隐式缓存 = 输入 20%"补 cache 命中价 + ( + "qwen3.6-plus", + "Qwen3.6 Plus", + "0.325", + "1.95", + "0.065", + "0", + "0.325", + "1.95", + "0", + "0", + ), + ( + "qwen3.5-plus", + "Qwen3.5 Plus", + "0.26", + "1.56", + "0.052", + "0", + "0.26", + "1.56", + "0", + "0", + ), + ( + "qwen3-coder-plus", + "Qwen3 Coder Plus", + "0.65", + "3.25", + "0.13", + "0", + "0.65", + "3.25", + "0", + "0", + ), + ( + "qwen3-coder-flash", + "Qwen3 Coder Flash", + "0.195", + "0.975", + "0.039", + "0", + "0.195", + "0.975", + "0", + "0", + ), ( "deepseek-v4-flash", "DeepSeek V4 Flash",