mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-29 01:25:33 +08:00
Upgrade default Claude Opus model to 4.8
Bump the default Opus route/model from claude-opus-4-7 to claude-opus-4-8 across provider presets (claude, claudeDesktop, hermes, openclaw, opencode, universal), i18n locales (zh/en/ja/zh-TW), pricing seed data, and the user-manual docs. - Add claude-opus-4-8 pricing row ($5/$25/$0.50/$6.25); keep the 4-7 row for historical usage stats (seeded via INSERT OR IGNORE). - Claude Desktop proxy: accept bidirectional opus 4-7 <-> 4-8 route alias during rollout so previously saved routes keep resolving. - thinking_optimizer: route opus-4-8 through adaptive thinking and normalize dotted model ids (also fixes dotted 4-6/4-7 falling back to legacy). - usage_stats: normalize Bedrock/Vertex/aggregator opus-4-8 ids to base pricing. Also merge role:"system" messages into the Gemini systemInstruction in the Anthropic->Gemini transform.
This commit is contained in:
@@ -41,7 +41,7 @@ const CLAUDE_MODEL_OVERRIDE_ENV_KEYS: [&str; 9] = [
|
||||
|
||||
const CLAUDE_TAKEOVER_HAIKU_MODEL: &str = "claude-haiku-4-5";
|
||||
const CLAUDE_TAKEOVER_SONNET_MODEL: &str = "claude-sonnet-4-6";
|
||||
const CLAUDE_TAKEOVER_OPUS_MODEL: &str = "claude-opus-4-7";
|
||||
const CLAUDE_TAKEOVER_OPUS_MODEL: &str = "claude-opus-4-8";
|
||||
// 写给 Claude Code 时沿用文档示例的大写形式;解析侧大小写不敏感。
|
||||
const CLAUDE_ONE_M_MARKER_FOR_CLIENT: &str = "[1M]";
|
||||
|
||||
@@ -2451,7 +2451,7 @@ mod tests {
|
||||
"ANTHROPIC_DEFAULT_SONNET_MODEL_NAME",
|
||||
Some("claude-sonnet-4.6"),
|
||||
);
|
||||
assert_env_str(env, "ANTHROPIC_DEFAULT_OPUS_MODEL", Some("claude-opus-4-7"));
|
||||
assert_env_str(env, "ANTHROPIC_DEFAULT_OPUS_MODEL", Some("claude-opus-4-8"));
|
||||
assert_env_str(
|
||||
env,
|
||||
"ANTHROPIC_DEFAULT_OPUS_MODEL_NAME",
|
||||
@@ -2522,7 +2522,7 @@ mod tests {
|
||||
Some("claude-sonnet-4-6"),
|
||||
);
|
||||
assert_env_str(env, "ANTHROPIC_DEFAULT_SONNET_MODEL_NAME", Some("gpt-5.4"));
|
||||
assert_env_str(env, "ANTHROPIC_DEFAULT_OPUS_MODEL", Some("claude-opus-4-7"));
|
||||
assert_env_str(env, "ANTHROPIC_DEFAULT_OPUS_MODEL", Some("claude-opus-4-8"));
|
||||
assert_env_str(env, "ANTHROPIC_DEFAULT_OPUS_MODEL_NAME", Some("gpt-5.4"));
|
||||
assert_env_str(env, "ANTHROPIC_API_KEY", Some(PROXY_TOKEN_PLACEHOLDER));
|
||||
assert_env_str(env, "ANTHROPIC_AUTH_TOKEN", None);
|
||||
@@ -3170,7 +3170,7 @@ model = "gpt-5.1-codex"
|
||||
live_env
|
||||
.get("ANTHROPIC_DEFAULT_OPUS_MODEL")
|
||||
.and_then(|v| v.as_str()),
|
||||
Some("claude-opus-4-7[1M]"),
|
||||
Some("claude-opus-4-8[1M]"),
|
||||
"Opus role should preserve the current provider 1M capability marker"
|
||||
);
|
||||
assert_eq!(
|
||||
|
||||
@@ -3214,6 +3214,11 @@ mod tests {
|
||||
result.is_some(),
|
||||
"Claude Desktop 短路由 claude-haiku-4-5 应能匹配到 claude-haiku-4-5-20251001"
|
||||
);
|
||||
let result = find_model_pricing_row(&conn, "anthropic/claude-opus-4.8")?;
|
||||
assert!(
|
||||
result.is_some(),
|
||||
"聚合商点号格式 anthropic/claude-opus-4.8 应能匹配到 claude-opus-4-8"
|
||||
);
|
||||
|
||||
// Claude Desktop 旧版/异常包装的非 Anthropic route:claude-gpt-5.5 → gpt-5.5
|
||||
let result = find_model_pricing_row(&conn, "claude-gpt-5.5")?;
|
||||
@@ -3229,6 +3234,16 @@ mod tests {
|
||||
result.is_some(),
|
||||
"Bedrock/Vertex 风格 Claude 模型 ID 应能归一化到基础 Claude 模型定价"
|
||||
);
|
||||
let result = find_model_pricing_row(&conn, "global.anthropic.claude-opus-4-8-v1:0")?;
|
||||
assert!(
|
||||
result.is_some(),
|
||||
"Bedrock 风格 Claude Opus 4.8 模型 ID 应能归一化到基础 Claude 模型定价"
|
||||
);
|
||||
let result = find_model_pricing_row(&conn, "claude-opus-4-8@20260527")?;
|
||||
assert!(
|
||||
result.is_some(),
|
||||
"Vertex 风格 Claude Opus 4.8 模型 ID 应能归一化到基础 Claude 模型定价"
|
||||
);
|
||||
|
||||
// Reasoning effort 后缀:没有专门价格时回退到基础模型
|
||||
let result = find_model_pricing_row(&conn, "gpt-5.4@low")?;
|
||||
|
||||
Reference in New Issue
Block a user