feat(pricing): add Claude Opus 4.7 with adaptive thinking and Bedrock SKU

- Seed claude-opus-4-7 pricing (same tier as 4.6: $5 / $25 / $0.50 /
  $6.25 per million tokens). Relies on incremental INSERT OR IGNORE
  seeding; no SCHEMA_VERSION bump needed.
- Whitelist opus-4-7 in thinking optimizer so it uses adaptive
  thinking + max effort + 1M context beta, matching 4.6 behavior.
- Bump default OPUS model in PIPELLM and AWS Bedrock (AKSK / API Key)
  presets to 4.7. Bedrock SKU drops the -v1 suffix per the official
  4.7 model card (anthropic.claude-opus-4-7 and
  global.anthropic.claude-opus-4-7).
This commit is contained in:
Jason
2026-04-17 00:18:32 +08:00
parent 50431b7ec9
commit 83c3c3b494
3 changed files with 17 additions and 8 deletions
+9
View File
@@ -1203,6 +1203,15 @@ impl Database {
/// 注意: model_id 使用短横线格式(如 claude-haiku-4-5),与 API 返回的模型名称标准化后一致
fn seed_model_pricing(conn: &Connection) -> Result<(), AppError> {
let pricing_data = [
// Claude 4.7 系列
(
"claude-opus-4-7",
"Claude Opus 4.7",
"5",
"25",
"0.50",
"6.25",
),
// Claude 4.6 系列
(
"claude-opus-4-6-20260206",
+2 -2
View File
@@ -7,7 +7,7 @@ use serde_json::{json, Value};
///
/// 三路径分发:
/// - skip: haiku 模型直接跳过
/// - adaptive: opus-4-6 / sonnet-4-6 使用 adaptive thinking
/// - adaptive: opus-4-7 / opus-4-6 / sonnet-4-6 使用 adaptive thinking
/// - legacy: 其他模型注入 enabled thinking + budget_tokens
pub fn optimize(body: &mut Value, config: &OptimizerConfig) {
if !config.thinking_optimizer {
@@ -24,7 +24,7 @@ pub fn optimize(body: &mut Value, config: &OptimizerConfig) {
return;
}
if model.contains("opus-4-6") || model.contains("sonnet-4-6") {
if model.contains("opus-4-7") || model.contains("opus-4-6") || model.contains("sonnet-4-6") {
log::info!("[OPT] thinking: adaptive({model})");
body["thinking"] = json!({"type": "adaptive"});
body["output_config"] = json!({"effort": "max"});
+6 -6
View File
@@ -870,10 +870,10 @@ export const providerPresets: ProviderPreset[] = [
env: {
ANTHROPIC_BASE_URL: "https://cc-api.pipellm.ai",
ANTHROPIC_AUTH_TOKEN: "",
ANTHROPIC_MODEL: "claude-opus-4-6",
ANTHROPIC_MODEL: "claude-opus-4-7",
ANTHROPIC_DEFAULT_HAIKU_MODEL: "claude-haiku-4-5-20251001",
ANTHROPIC_DEFAULT_SONNET_MODEL: "claude-sonnet-4-6",
ANTHROPIC_DEFAULT_OPUS_MODEL: "claude-opus-4-6",
ANTHROPIC_DEFAULT_OPUS_MODEL: "claude-opus-4-7",
},
includeCoAuthoredBy: false,
},
@@ -908,11 +908,11 @@ export const providerPresets: ProviderPreset[] = [
AWS_ACCESS_KEY_ID: "${AWS_ACCESS_KEY_ID}",
AWS_SECRET_ACCESS_KEY: "${AWS_SECRET_ACCESS_KEY}",
AWS_REGION: "${AWS_REGION}",
ANTHROPIC_MODEL: "global.anthropic.claude-opus-4-6-v1",
ANTHROPIC_MODEL: "global.anthropic.claude-opus-4-7",
ANTHROPIC_DEFAULT_HAIKU_MODEL:
"global.anthropic.claude-haiku-4-5-20251001-v1:0",
ANTHROPIC_DEFAULT_SONNET_MODEL: "global.anthropic.claude-sonnet-4-6",
ANTHROPIC_DEFAULT_OPUS_MODEL: "global.anthropic.claude-opus-4-6-v1",
ANTHROPIC_DEFAULT_OPUS_MODEL: "global.anthropic.claude-opus-4-7",
CLAUDE_CODE_USE_BEDROCK: "1",
},
},
@@ -946,11 +946,11 @@ export const providerPresets: ProviderPreset[] = [
ANTHROPIC_BASE_URL:
"https://bedrock-runtime.${AWS_REGION}.amazonaws.com",
AWS_REGION: "${AWS_REGION}",
ANTHROPIC_MODEL: "global.anthropic.claude-opus-4-6-v1",
ANTHROPIC_MODEL: "global.anthropic.claude-opus-4-7",
ANTHROPIC_DEFAULT_HAIKU_MODEL:
"global.anthropic.claude-haiku-4-5-20251001-v1:0",
ANTHROPIC_DEFAULT_SONNET_MODEL: "global.anthropic.claude-sonnet-4-6",
ANTHROPIC_DEFAULT_OPUS_MODEL: "global.anthropic.claude-opus-4-6-v1",
ANTHROPIC_DEFAULT_OPUS_MODEL: "global.anthropic.claude-opus-4-7",
CLAUDE_CODE_USE_BEDROCK: "1",
},
},