Skip to content

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode,DeepSeek Harness and more. Only official website: ccswitch.io

feat(pricing): restore expired promo prices and seed GLM-5.4

Jasonf19c65c9f661
diff --git a/src-tauri/src/database/schema.rs b/src-tauri/src/database/schema.rs
index 3e019ef1a..db328ae78 100644
--- a/src-tauri/src/database/schema.rs
+++ b/src-tauri/src/database/schema.rs
@@ -2126,9 +2126,9 @@ impl Database {
("gpt-6-luna", "GPT-6 Luna", "0.10", "0.50", "0.01", "0.125"),
// GPT-5.6 系列(Sol / Terra / Luna,2026-06 发布)
// 5.6 家族起 cache write 收 1.25× 输入价(此前 GPT 模型写缓存免费,勿回填旧系列)
- // 2026-09-06 审计:Sol 改促销价 4/20/0.40/5(OpenAI 价页原文"至少持续到 2026-11-21"),
- // 挂牌价 5/30/0.50/6.25。录促销价、不进豁免表:促销结束 models.dev 更新后审计会自动报出。
- ("gpt-5.6-sol", "GPT-5.6 Sol", "4", "20", "0.40", "5"),
+ // 2026-09-06 审计:Sol 改促销价 4/20/0.40/5(OpenAI 价页原文"至少持续到 2026-11-21")。
+ // 2026-12-02 审计:官方模型页已撤促销,恢复挂牌价 5/30/0.50/6.25(repair 把促销价行改回)。
+ ("gpt-5.6-sol", "GPT-5.6 Sol", "5", "30", "0.50", "6.25"),
// 2026-07-30 OpenAI 降价:luna -80%、terra -20%,sol 不变(Fast mode 2× 价不入表)
("gpt-5.6-terra", "GPT-5.6 Terra", "2", "12", "0.20", "2.50"),
(
@@ -2152,12 +2152,12 @@ impl Database {
),
// 裸名 gpt-5.6 是 sol 的官方别名;effort 后缀对齐 gpt-5.5 系列的记账形态。
// 查价先精确匹配 id 再剥 effort 后缀,这些行必须与 sol 同步改价,否则旧价会压过基础行。
- ("gpt-5.6", "GPT-5.6 Sol", "4", "20", "0.40", "5"),
- ("gpt-5.6-low", "GPT-5.6 Sol", "4", "20", "0.40", "5"),
- ("gpt-5.6-medium", "GPT-5.6 Sol", "4", "20", "0.40", "5"),
- ("gpt-5.6-high", "GPT-5.6 Sol", "4", "20", "0.40", "5"),
- ("gpt-5.6-xhigh", "GPT-5.6 Sol", "4", "20", "0.40", "5"),
- ("gpt-5.6-minimal", "GPT-5.6 Sol", "4", "20", "0.40", "5"),
+ ("gpt-5.6", "GPT-5.6 Sol", "5", "30", "0.50", "6.25"),
+ ("gpt-5.6-low", "GPT-5.6 Sol", "5", "30", "0.50", "6.25"),
+ ("gpt-5.6-medium", "GPT-5.6 Sol", "5", "30", "0.50", "6.25"),
+ ("gpt-5.6-high", "GPT-5.6 Sol", "5", "30", "0.50", "6.25"),
+ ("gpt-5.6-xhigh", "GPT-5.6 Sol", "5", "30", "0.50", "6.25"),
+ ("gpt-5.6-minimal", "GPT-5.6 Sol", "5", "30", "0.50", "6.25"),
// GPT-5.5 系列
("gpt-5.5", "GPT-5.5", "5", "30", "0.50", "0"),
("gpt-5.5-low", "GPT-5.5", "5", "30", "0.50", "0"),
@@ -2368,31 +2368,27 @@ impl Database {
"0",
),
// 来源:https://ai.google.dev/gemini-api/docs/pricing#gemini-4-argon
- // 录的是标准档介绍价(2026-10-15 抓取):输入 2.00 / 输出 10.00 / 上下文缓存读 0.10
- // (缓存仅支持隐式,不支持显式写入,cache_creation 记 0,与其他 Gemini 条目口径一致)。
- // ⚠️ 介绍价 2026-11-30 到期,2026-12-01 起恢复挂牌价 4.00/20.00/0.20。
- // 到期后需走 seed + repair 双写改回;刻意不进 audit-ignore.json,
- // 由 /jason-update-model 审计的 A 段在到期后报出提醒,口径同 3.6/3.7/3.8 Flash。
- // 免费层级不可用;批量档(输入 1.00→2.00 / 输出 5.00→10.00)与 Flex 档不入表,
- // 仓库现有口径仅录标准档。
+ // 原录标准档介绍价 2.00/10.00/0.10(2026-10-15 抓取),2026-11-30 到期。
+ // 2026-12-02 审计:官方价页标准档已恢复挂牌价 4.00/20.00/0.20、无延期,seed + repair 双写改回。
+ // 缓存仅支持隐式,不支持显式写入,cache_creation 记 0,与其他 Gemini 条目口径一致。
+ // 免费层级不可用;批量档与 Flex 档(现为 2.00/10.00/0.10)不入表,仓库现有口径仅录标准档。
(
"gemini-4-argon",
"Gemini 4 Argon",
- "2.00",
- "10.00",
- "0.10",
+ "4.00",
+ "20.00",
+ "0.20",
"0",
),
- // Gemini 4 Carbon(2026-11-11 核对官方价页 + models.dev):与 Argon 同口径录标准档介绍价
- // 2.00/10.00/0.10/0(仅支持隐式缓存);2026-11-30 到期,2026-12-01 起恢复挂牌价
- // 4.00/20.00/0.20,刻意不进 audit-ignore.json。
- // 来源:https://ai.google.dev/gemini-api/docs/pricing#gemini-4-carbon
+ // Gemini 4 Carbon:与 Argon 同口径,介绍价 2.00/10.00/0.10 已于 2026-11-30 到期,
+ // 2026-12-02 核对官方价页标准档为挂牌价 4.00/20.00/0.20(仅支持隐式缓存)。
+ // 来源:https://aistudio.google.com/docs/pricing
(
"gemini-4-carbon",
"Gemini 4 Carbon",
- "2.00",
- "10.00",
- "0.10",
+ "4.00",
+ "20.00",
+ "0.20",
"0",
),
// Hydrogen executes Orchestrator steps; standard API-equivalent estimate, not plan quota.
@@ -2501,12 +2497,15 @@ impl Database {
"0",
),
// Gemini 2.5 系列
+ // gemini-2.5-pro 已于 2026-12-01 停用,端点自动转给 gemini-3.8-flash 并按 3.8 Flash 计费
+ // (官方弃用页)。故跟随 3.8 Flash 现行介绍价 0.75/3.75/0.075;⚠️ 2027-01-01 3.8 Flash
+ // 恢复 1.50/7.50/0.15 时须与 gemini-3.8-flash 一起走 seed + repair 改价。
(
"gemini-2.5-pro",
"Gemini 2.5 Pro",
- "1.25",
- "10",
- "0.125",
+ "0.75",
+ "3.75",
+ "0.075",
"0",
),
(
@@ -2906,6 +2905,8 @@ impl Database {
("glm-5.1", "GLM-5.1", "1.4", "4.4", "0.26", "0"),
("glm-5.2", "GLM-5.2", "1.4", "4.4", "0.26", "0"),
("glm-5.3", "GLM-5.3", "1.4", "4.4", "0.26", "0"),
+ // GLM-5.4(2026-11-23 发布,1M 上下文):2026-12-02 核对 Z.ai 官方价页,与 5.3 同价
+ ("glm-5.4", "GLM-5.4", "1.4", "4.4", "0.26", "0"),
(
"glm-5.3-flash",
"GLM-5.3-Flash",
@@ -3789,90 +3790,132 @@ impl Database {
"0.15",
"0",
),
- // OpenAI GPT-5.6 Sol 促销价 4/20/0.40/5(至少到 2026-11-21);裸名与 effort 后缀行同步
+ // 2026-12-02 审计:OpenAI 官方模型页已撤 GPT-5.6 Sol 促销价 4/20/0.40/5,恢复挂牌价
+ // 5/30/0.50/6.25。原「挂牌→促销」的修复条目已删除,否则每次启动两条互相改来改去;
+ // 裸名与 effort 后缀行同步
(
"gpt-5.6-sol",
"GPT-5.6 Sol",
- "4",
- "20",
- "0.40",
- "5",
"5",
"30",
"0.50",
"6.25",
- ),
- (
- "gpt-5.6",
- "GPT-5.6 Sol",
"4",
"20",
"0.40",
"5",
+ ),
+ (
+ "gpt-5.6",
+ "GPT-5.6 Sol",
"5",
"30",
"0.50",
"6.25",
- ),
- (
- "gpt-5.6-low",
- "GPT-5.6 Sol",
"4",
"20",
"0.40",
"5",
+ ),
+ (
+ "gpt-5.6-low",
+ "GPT-5.6 Sol",
"5",
"30",
"0.50",
"6.25",
- ),
- (
- "gpt-5.6-medium",
- "GPT-5.6 Sol",
"4",
"20",
"0.40",
"5",
+ ),
+ (
+ "gpt-5.6-medium",
+ "GPT-5.6 Sol",
"5",
"30",
"0.50",
"6.25",
- ),
- (
- "gpt-5.6-high",
- "GPT-5.6 Sol",
"4",
"20",
"0.40",
"5",
+ ),
+ (
+ "gpt-5.6-high",
+ "GPT-5.6 Sol",
"5",
"30",
"0.50",
"6.25",
- ),
- (
- "gpt-5.6-xhigh",
- "GPT-5.6 Sol",
"4",
"20",
"0.40",
"5",
+ ),
+ (
+ "gpt-5.6-xhigh",
+ "GPT-5.6 Sol",
"5",
"30",
"0.50",
"6.25",
- ),
- (
- "gpt-5.6-minimal",
- "GPT-5.6 Sol",
"4",
"20",
"0.40",
"5",
+ ),
+ (
+ "gpt-5.6-minimal",
+ "GPT-5.6 Sol",
"5",
"30",
"0.50",
"6.25",
+ "4",
+ "20",
+ "0.40",
+ "5",
+ ),
+ // 2026-12-02 审计:Gemini 4 Argon / Carbon 介绍价 2.00/10.00/0.10 已于 2026-11-30 到期,
+ // 官方价页标准档恢复挂牌价 4.00/20.00/0.20
+ (
+ "gemini-4-argon",
+ "Gemini 4 Argon",
+ "4.00",
+ "20.00",
+ "0.20",
+ "0",
+ "2.00",
+ "10.00",
+ "0.10",
+ "0",
+ ),
+ (
+ "gemini-4-carbon",
+ "Gemini 4 Carbon",
+ "4.00",
+ "20.00",
+ "0.20",
+ "0",
+ "2.00",
+ "10.00",
+ "0.10",
+ "0",
+ ),
+ // 2026-12-02 审计:gemini-2.5-pro 于 2026-12-01 停用,请求转给 gemini-3.8-flash 并按其计费,
+ // 跟随 3.8 Flash 现行价;2027-01-01 须随 3.8 Flash 一起再改
+ (
+ "gemini-2.5-pro",
+ "Gemini 2.5 Pro",
+ "0.75",
+ "3.75",
+ "0.075",
+ "0",
+ "1.25",
+ "10",
+ "0.125",
+ "0",
),
// MiniMax 官方按量价:M2 / M2.1 / M2.5 = 0.3/1.2/0.03/0.375
(
diff --git a/src-tauri/src/database/tests.rs b/src-tauri/src/database/tests.rs
index 98cb9a154..e3cbbc96f 100644
--- a/src-tauri/src/database/tests.rs
+++ b/src-tauri/src/database/tests.rs
@@ -1019,7 +1019,8 @@ fn model_pricing_seed_repairs_known_outdated_builtin_prices() {
assert_eq!(glm, ("9".to_string(), "9".to_string(), "9".to_string()));
// 2026-09-06 条目同样依赖顺序:
- // gpt-5.6-sol 5/30/0.50/0 →(07-12 补 cache_write)→ 5/30/0.50/6.25 →(09-06 促销)→ 4/20/0.40/5
+ // gpt-5.6-sol 5/30/0.50/0 →(07-12 补 cache_write)→ 5/30/0.50/6.25(12-02 促销结束,
+ // 「挂牌→促销」条目已删,停在挂牌价;促销价行的修回见 model_pricing_repair_reverts_expired_promotions)
// minimax-m2.5 0.12/0.95/0.03/0 →(0.12→0.15 条目)→ 0.15/… →(09-06 官方价)→ 0.30/1.20/0.03/0.375
let sol: (String, String, String, String) = conn
.query_row(
@@ -1033,10 +1034,10 @@ fn model_pricing_seed_repairs_known_outdated_builtin_prices() {
assert_eq!(
sol,
(
- "4".to_string(),
- "20".to_string(),
- "0.40".to_string(),
- "5".to_string()
+ "5".to_string(),
+ "30".to_string(),
+ "0.50".to_string(),
+ "6.25".to_string()
)
);
let m25: (String, String, String, String) = conn
@@ -1402,6 +1403,70 @@ fn model_pricing_seed_includes_gemini_4_neon() {
);
}
+#[test]
+fn model_pricing_repair_reverts_expired_promotions() {
+ // 2026-12-02:GPT-5.6 Sol 促销价、Gemini 4 Argon / Carbon 介绍价到期,gemini-2.5-pro 停用后按
+ // 3.8 Flash 计费。老库里停在旧价的行应被改回;用户手改过的行(这里是 gpt-5.6-low)不动。
+ let db = Database::memory().expect("create memory db");
+ let set = |conn: &rusqlite::Connection, id: &str, p: [&str; 4]| {
+ conn.execute(
+ "UPDATE model_pricing
+ SET input_cost_per_million = ?2,
+ output_cost_per_million = ?3,
+ cache_read_cost_per_million = ?4,
+ cache_creation_cost_per_million = ?5
+ WHERE model_id = ?1",
+ rusqlite::params![id, p[0], p[1], p[2], p[3]],
+ )
+ .expect("set old price");
+ };
+ {
+ let conn = db.conn.lock().expect("lock conn");
+ for id in ["gpt-5.6-sol", "gpt-5.6", "gpt-5.6-high"] {
+ set(&conn, id, ["4", "20", "0.40", "5"]);
+ }
+ set(&conn, "gpt-5.6-low", ["3", "18", "0.30", "4"]);
+ for id in ["gemini-4-argon", "gemini-4-carbon"] {
+ set(&conn, id, ["2.00", "10.00", "0.10", "0"]);
+ }
+ set(&conn, "gemini-2.5-pro", ["1.25", "10", "0.125", "0"]);
+ }
+
+ // 跑两次:确认 repair 条目之间不会来回改(旧的「挂牌→促销」条目若还在,就会跟新条目互相覆盖)
+ db.ensure_model_pricing_seeded()
+ .expect("ensure pricing seeded");
+ db.ensure_model_pricing_seeded()
+ .expect("ensure pricing seeded again");
+
+ let conn = db.conn.lock().expect("lock conn");
+ let get = |id: &str| -> (String, String, String, String) {
+ conn.query_row(
+ "SELECT input_cost_per_million, output_cost_per_million,
+ cache_read_cost_per_million, cache_creation_cost_per_million
+ FROM model_pricing WHERE model_id = ?1",
+ [id],
+ |row| Ok((row.get(0)?, row.get(1)?, row.get(2)?, row.get(3)?)),
+ )
+ .expect("query price")
+ };
+ let owned = |p: [&str; 4]| {
+ (
+ p[0].to_string(),
+ p[1].to_string(),
+ p[2].to_string(),
+ p[3].to_string(),
+ )
+ };
+ for id in ["gpt-5.6-sol", "gpt-5.6", "gpt-5.6-high"] {
+ assert_eq!(get(id), owned(["5", "30", "0.50", "6.25"]), "{id}");
+ }
+ assert_eq!(get("gpt-5.6-low"), owned(["3", "18", "0.30", "4"]));
+ for id in ["gemini-4-argon", "gemini-4-carbon"] {
+ assert_eq!(get(id), owned(["4.00", "20.00", "0.20", "0"]), "{id}");
+ }
+ assert_eq!(get("gemini-2.5-pro"), owned(["0.75", "3.75", "0.075", "0"]));
+}
+
#[test]
fn model_pricing_seed_includes_gemini_4_argon() {
let db = Database::memory().expect("create memory db");
@@ -1420,9 +1485,9 @@ fn model_pricing_seed_includes_gemini_4_argon() {
assert_eq!(
price,
(
- "2.00".to_string(),
- "10.00".to_string(),
- "0.10".to_string(),
+ "4.00".to_string(),
+ "20.00".to_string(),
+ "0.20".to_string(),
"0".to_string(),
)
);
@@ -1446,9 +1511,9 @@ fn model_pricing_seed_includes_gemini_4_carbon() {
assert_eq!(
price,
(
- "2.00".to_string(),
- "10.00".to_string(),
- "0.10".to_string(),
+ "4.00".to_string(),
+ "20.00".to_string(),
+ "0.20".to_string(),
"0".to_string(),
)
);
diff --git a/src-tauri/src/services/session_usage_agy/orchestrator_tests.rs b/src-tauri/src/services/session_usage_agy/orchestrator_tests.rs
index 992db9e18..9a88e3af8 100644
--- a/src-tauri/src/services/session_usage_agy/orchestrator_tests.rs
+++ b/src-tauri/src/services/session_usage_agy/orchestrator_tests.rs
@@ -78,7 +78,7 @@ fn hydrogen_orchestrator_native_display_is_priced_without_losing_provenance() {
import_records(&db, "session", &rows, Some(&source)).unwrap(),
(2, 0)
);
- assert_price(&db, 1, "gemini-4-carbon", mode, "3.1");
+ assert_price(&db, 1, "gemini-4-carbon", mode, "6.2");
assert_price(&db, 3, "gemini-4-hydrogen-orchestrator", mode, "2.325");
assert_eq!(
import_records(&db, "session", &rows, Some(&source)).unwrap(),
@@ -122,9 +122,9 @@ fn orchestrator_splits_native_generations_and_preserves_request_mode() {
import_records(&db, "session", &rows, Some(&source)).unwrap(),
(3, 0)
);
- assert_price(&db, 1, expected, mode, "3.1");
+ assert_price(&db, 1, expected, mode, "6.2");
assert_price(&db, 3, "gemini-4-hydrogen", mode, "2.325");
- assert_price(&db, 5, "gemini-4-carbon-high", "gemini-4-carbon-high", "2");
+ assert_price(&db, 5, "gemini-4-carbon-high", "gemini-4-carbon-high", "4");
assert_eq!(
import_records(&db, "session", &rows, Some(&source)).unwrap(),
(0, 3)
@@ -171,7 +171,7 @@ fn orchestrator_requires_native_evidence_and_keeps_recovered_models_on_read_fail
import_records(&db, "session", &rows, Some(&source)).unwrap(),
(2, 0)
);
- assert_price(&db, 1, "gemini-4-carbon", mode, "3.1");
+ assert_price(&db, 1, "gemini-4-carbon", mode, "6.2");
assert_price(&db, 3, "gemini-4-hydrogen", mode, "2.325");
native.execute_batch("DROP TABLE gen_metadata").unwrap();
@@ -182,7 +182,7 @@ fn orchestrator_requires_native_evidence_and_keeps_recovered_models_on_read_fail
import_records(&db, "session", &rows, Some(&source)).unwrap(),
(1, 1)
);
- assert_price(&db, 1, "gemini-4-carbon", mode, "5.1");
+ assert_price(&db, 1, "gemini-4-carbon", mode, "10.2");
assert_price(&db, 3, "gemini-4-hydrogen", mode, "2.325");
db.conn
.lock()
@@ -242,7 +242,7 @@ fn orchestrator_backfills_timed_history_after_parser_upgrade_once() {
}
let result = sync_agy_usage_from_files(&db, files()).unwrap();
assert_eq!((result.imported, result.skipped), (2, 0));
- assert_price(&db, 1, "gemini-4-carbon", mode, "3.1");
+ assert_price(&db, 1, "gemini-4-carbon", mode, "6.2");
assert_price(&db, 3, "gemini-4-hydrogen", mode, "2.325");
let result = sync_agy_usage_from_files(&db, files()).unwrap();
assert_eq!((result.imported, result.skipped), (0, 0));
@@ -340,7 +340,7 @@ fn cli_orchestrator_worker_alias_attributes_to_hydrogen_with_or_without_native_d
import_records(&db, "session", &rows, Some(&source)).unwrap(),
(3, 0)
);
- assert_price(&db, 1, "gemini-4-carbon", "gemini-pro-orchestrator", "3.1");
+ assert_price(&db, 1, "gemini-4-carbon", "gemini-pro-orchestrator", "6.2");
assert_price(
&db,
3,
@@ -441,7 +441,7 @@ fn cli_orchestrator_worker_history_reattributes_after_v2_cursor_upgrade_once() {
let result = sync_agy_usage_from_files(&db, files()).unwrap();
assert_eq!((result.imported, result.skipped), (1, 1));
- assert_price(&db, 1, "gemini-4-carbon", "gemini-pro-orchestrator", "3.1");
+ assert_price(&db, 1, "gemini-4-carbon", "gemini-pro-orchestrator", "6.2");
assert_price(
&db,
3,
@@ -570,7 +570,7 @@ fn cli_worker_does_not_inherit_stale_direct_hydrogen_selection_across_rewind() {
import_records(&db_mixed, "session", &rows(mode), Some(&source)).unwrap(),
(2, 0)
);
- assert_price(&db_mixed, 1, "gemini-4-carbon", mode, "3.1");
+ assert_price(&db_mixed, 1, "gemini-4-carbon", mode, "6.2");
assert_price(
&db_mixed,
3,
@@ -628,13 +628,13 @@ fn orchestrator_neon_and_g1_pro_aliases_attribute_and_reparse_after_v3_cursor()
"Orchestrator (Argon)",
"gemini-pro-orchestrator-g1-pro",
"gemini-4-argon",
- "3.1",
+ "6.2",
),
(
"gemini-pro-orchestrator-g1-pro",
"gemini-pro-orchestrator-g1-pro",
"gemini-4-argon",
- "3.1",
+ "6.2",
),
] {
let dir = tempfile::tempdir().unwrap();
diff --git a/src-tauri/src/services/session_usage_codex/tests.rs b/src-tauri/src/services/session_usage_codex/tests.rs
index 309705172..ad08d85ad 100644
--- a/src-tauri/src/services/session_usage_codex/tests.rs
+++ b/src-tauri/src/services/session_usage_codex/tests.rs
@@ -2326,14 +2326,14 @@ fn test_cache_write_tokens_are_billed_as_cache_creation() -> Result<(), AppError
},
)?;
assert_eq!((fresh, cache_read, cache_creation), (100, 300, 600));
- // gpt-5.6-sol: $4 input, $20 output, $0.40 cache read, $5 cache write per MTok.
+ // gpt-5.6-sol: $5 input, $30 output, $0.50 cache read, $6.25 cache write per MTok.
assert_eq!(
cache_creation_cost.parse::<Decimal>().unwrap(),
- "0.003".parse().unwrap()
+ "0.00375".parse().unwrap()
);
assert_eq!(
total_cost.parse::<Decimal>().unwrap(),
- "0.00452".parse().unwrap()
+ "0.0059".parse().unwrap()
);
Ok(())
}