Skip to content

Commit 7e3cd66

Browse files
authored
feat: 添加 gpt-5.4 模型定价和测试用例 (#395)
1 parent 4e7df8d commit 7e3cd66

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

internal/pricing/calculator_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,15 @@ func TestCalculator_Calculate(t *testing.T) {
115115
},
116116
wantZero: false,
117117
},
118+
{
119+
name: "gpt-5.4 basic",
120+
model: "gpt-5.4",
121+
metrics: &usage.Metrics{
122+
InputTokens: 50_000,
123+
OutputTokens: 5_000,
124+
},
125+
wantZero: false,
126+
},
118127
{
119128
name: "gemini-2.5-pro basic",
120129
model: "gemini-2.5-pro",
@@ -216,6 +225,7 @@ func TestPriceTable_Get_PrefixMatch(t *testing.T) {
216225
{"gpt-5.1-codex", true},
217226
{"gpt-5.2", true},
218227
{"gpt-5.3", true},
228+
{"gpt-5.4", true},
219229
{"gemini-2.5-pro", true},
220230
{"gemini-2.5-flash", true},
221231
{"gemini-3-pro-preview", true},

internal/pricing/default_prices.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,14 @@ func initDefaultPrices() *PriceTable {
276276
CacheReadPriceMicro: 175_000, // $0.175/M
277277
})
278278

279+
// gpt-5.4: input=$2.50, cache_read=$0.25, output=$15
280+
pt.Set(&ModelPricing{
281+
ModelID: "gpt-5.4",
282+
InputPriceMicro: 2_500_000, // $2.50/M
283+
OutputPriceMicro: 15_000_000, // $15.00/M
284+
CacheReadPriceMicro: 250_000, // $0.25/M
285+
})
286+
279287
// ========== GPT-4o 系列 ==========
280288
// gpt-4o: input=$2.50, output=$10, cache_read=$1.25
281289
pt.Set(&ModelPricing{

0 commit comments

Comments
 (0)