mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-04 19:45:34 +08:00
Update default models and pricing across presets
Bump default model names project-wide: gpt-5.4 -> gpt-5.5,
gemini-3.x -> gemini-3.5-flash, glm-5 -> glm-5.1, and
grok-code-fast-1 -> grok-build-0.1 across all provider presets
(claude, codex, gemini, hermes, openclaw, opencode, universal),
Gemini config, and stream check defaults.
Pricing:
- Seed gemini-3.5-flash, gemini-3.1-flash-lite, step-3.5-flash-2603,
doubao-seed-2.0-code, mimo-v2.5(/pro), qwen3-coder-480b, grok-build-0.1.
- Correct deepseek-v4-flash/pro, glm-5/5.1, grok pricing.
- Add repair_current_model_pricing: idempotent pass that fixes only
rows still equal to the outdated built-in values, preserving any
user-customized prices (seed uses INSERT OR IGNORE and cannot update
existing rows).
Fixes from review:
- opencode: drop duplicate gemini-3.5-flash variant (unreachable via
.find), keep the entry with the full minimal/low/medium/high set.
- Align stale display names/costs to gemini-3.5-flash (hermes, openclaw,
opencode); openclaw cost -> {1.5, 9, 0.15} to match seed.
- i18n (zh/en/ja/zh-TW): refresh OMO category tooltips for new model
names; fix writing tooltip to Kimi K2.5 to match its recommended.
Update tests accordingly and add a regression test asserting unique
model ids in the Google opencode preset variants.
This commit is contained in:
@@ -662,6 +662,66 @@ fn schema_model_pricing_is_seeded_on_init() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn model_pricing_seed_repairs_known_outdated_builtin_prices() {
|
||||
let db = Database::memory().expect("create memory db");
|
||||
|
||||
{
|
||||
let conn = db.conn.lock().expect("lock conn");
|
||||
conn.execute(
|
||||
"UPDATE model_pricing
|
||||
SET input_cost_per_million = '1.68',
|
||||
output_cost_per_million = '3.36',
|
||||
cache_read_cost_per_million = '0.14',
|
||||
cache_creation_cost_per_million = '0'
|
||||
WHERE model_id = 'deepseek-v4-pro'",
|
||||
[],
|
||||
)
|
||||
.expect("restore old DeepSeek price");
|
||||
conn.execute(
|
||||
"UPDATE model_pricing
|
||||
SET input_cost_per_million = '9',
|
||||
output_cost_per_million = '9',
|
||||
cache_read_cost_per_million = '9',
|
||||
cache_creation_cost_per_million = '0'
|
||||
WHERE model_id = 'glm-5.1'",
|
||||
[],
|
||||
)
|
||||
.expect("set custom GLM price");
|
||||
}
|
||||
|
||||
db.ensure_model_pricing_seeded()
|
||||
.expect("ensure pricing seeded");
|
||||
|
||||
let conn = db.conn.lock().expect("lock conn");
|
||||
let deepseek: (String, String, String) = conn
|
||||
.query_row(
|
||||
"SELECT input_cost_per_million, output_cost_per_million, cache_read_cost_per_million
|
||||
FROM model_pricing WHERE model_id = 'deepseek-v4-pro'",
|
||||
[],
|
||||
|row| Ok((row.get(0)?, row.get(1)?, row.get(2)?)),
|
||||
)
|
||||
.expect("query DeepSeek price");
|
||||
assert_eq!(
|
||||
deepseek,
|
||||
(
|
||||
"0.435".to_string(),
|
||||
"0.87".to_string(),
|
||||
"0.003625".to_string()
|
||||
)
|
||||
);
|
||||
|
||||
let glm: (String, String, String) = conn
|
||||
.query_row(
|
||||
"SELECT input_cost_per_million, output_cost_per_million, cache_read_cost_per_million
|
||||
FROM model_pricing WHERE model_id = 'glm-5.1'",
|
||||
[],
|
||||
|row| Ok((row.get(0)?, row.get(1)?, row.get(2)?)),
|
||||
)
|
||||
.expect("query GLM price");
|
||||
assert_eq!(glm, ("9".to_string(), "9".to_string(), "9".to_string()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ensure_incremental_auto_vacuum_rebuilds_existing_file_db() {
|
||||
let temp = NamedTempFile::new().expect("create temp db file");
|
||||
|
||||
Reference in New Issue
Block a user