"frontend/git@web.lueluesay.top:chenxi/sub2api.git" did not exist on "f38a3e758506b98e3d09742e04bee3edf3fc6c5f"
Commit 5bd7408b authored by erio's avatar erio
Browse files

fix: add fallback pricing for opus-4.6 and gemini-3.1-pro models

parent c671e8dd
...@@ -133,6 +133,18 @@ func (s *BillingService) initFallbackPricing() { ...@@ -133,6 +133,18 @@ func (s *BillingService) initFallbackPricing() {
CacheReadPricePerToken: 0.03e-6, // $0.03 per MTok CacheReadPricePerToken: 0.03e-6, // $0.03 per MTok
SupportsCacheBreakdown: false, SupportsCacheBreakdown: false,
} }
// Claude 4.6 Opus (与4.5同价)
s.fallbackPrices["claude-opus-4.6"] = s.fallbackPrices["claude-opus-4.5"]
// Gemini 3.1 Pro
s.fallbackPrices["gemini-3.1-pro"] = &ModelPricing{
InputPricePerToken: 2e-6, // $2 per MTok
OutputPricePerToken: 12e-6, // $12 per MTok
CacheCreationPricePerToken: 2e-6, // $2 per MTok
CacheReadPricePerToken: 0.2e-6, // $0.20 per MTok
SupportsCacheBreakdown: false,
}
} }
// getFallbackPricing 根据模型系列获取回退价格 // getFallbackPricing 根据模型系列获取回退价格
...@@ -141,6 +153,9 @@ func (s *BillingService) getFallbackPricing(model string) *ModelPricing { ...@@ -141,6 +153,9 @@ func (s *BillingService) getFallbackPricing(model string) *ModelPricing {
// 按模型系列匹配 // 按模型系列匹配
if strings.Contains(modelLower, "opus") { if strings.Contains(modelLower, "opus") {
if strings.Contains(modelLower, "4.6") || strings.Contains(modelLower, "4-6") {
return s.fallbackPrices["claude-opus-4.6"]
}
if strings.Contains(modelLower, "4.5") || strings.Contains(modelLower, "4-5") { if strings.Contains(modelLower, "4.5") || strings.Contains(modelLower, "4-5") {
return s.fallbackPrices["claude-opus-4.5"] return s.fallbackPrices["claude-opus-4.5"]
} }
...@@ -158,6 +173,9 @@ func (s *BillingService) getFallbackPricing(model string) *ModelPricing { ...@@ -158,6 +173,9 @@ func (s *BillingService) getFallbackPricing(model string) *ModelPricing {
} }
return s.fallbackPrices["claude-3-haiku"] return s.fallbackPrices["claude-3-haiku"]
} }
if strings.Contains(modelLower, "gemini-3.1-pro") || strings.Contains(modelLower, "gemini-3-1-pro") {
return s.fallbackPrices["gemini-3.1-pro"]
}
// 默认使用Sonnet价格 // 默认使用Sonnet价格
return s.fallbackPrices["claude-sonnet-4"] return s.fallbackPrices["claude-sonnet-4"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment