Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
5bd7408b
Commit
5bd7408b
authored
Feb 25, 2026
by
erio
Browse files
fix: add fallback pricing for opus-4.6 and gemini-3.1-pro models
parent
c671e8dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/billing_service.go
View file @
5bd7408b
...
...
@@ -133,6 +133,18 @@ func (s *BillingService) initFallbackPricing() {
CacheReadPricePerToken
:
0.03e-6
,
// $0.03 per MTok
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 根据模型系列获取回退价格
...
...
@@ -141,6 +153,9 @@ func (s *BillingService) getFallbackPricing(model string) *ModelPricing {
// 按模型系列匹配
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"
)
{
return
s
.
fallbackPrices
[
"claude-opus-4.5"
]
}
...
...
@@ -158,6 +173,9 @@ func (s *BillingService) getFallbackPricing(model string) *ModelPricing {
}
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价格
return
s
.
fallbackPrices
[
"claude-sonnet-4"
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment