Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions setting/ratio_setting/model_ratio.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ func getHardcodedCompletionModelRatio(name string) (float64, bool) {
}
// gpt-5 匹配
if strings.HasPrefix(name, "gpt-5") {
if strings.HasPrefix(name, "gpt-5.6") {
return 6, true
}
Comment on lines +507 to +509

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Handle the $40/M GPT-5.6 variants separately.

This prefix matches gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna, but the stated pricing contract is $5/M input and $40/M output for those models, requiring a completion ratio of 8, not 6. Keep 6 for the $30/M-output GPT-5.6 models and add a more-specific branch for the $40/M variants; this value flows into relay pricing and quota calculations.

Proposed fix
 			if strings.HasPrefix(name, "gpt-5.6") {
+				if strings.HasPrefix(name, "gpt-5.6-sol") ||
+					strings.HasPrefix(name, "gpt-5.6-terra") ||
+					strings.HasPrefix(name, "gpt-5.6-luna") {
+					return 8, true
+				}
 				return 6, true
 			}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if strings.HasPrefix(name, "gpt-5.6") {
return 6, true
}
if strings.HasPrefix(name, "gpt-5.6") {
if strings.HasPrefix(name, "gpt-5.6-sol") ||
strings.HasPrefix(name, "gpt-5.6-terra") ||
strings.HasPrefix(name, "gpt-5.6-luna") {
return 8, true
}
return 6, true
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@setting/ratio_setting/model_ratio.go` around lines 507 - 509, Update the
model-ratio logic around the gpt-5.6 prefix check: add a more-specific branch
for gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna that returns ratio 8, while
retaining ratio 6 for other gpt-5.6 models. Ensure the specific variants are
evaluated before the general HasPrefix("gpt-5.6") branch.

if strings.HasPrefix(name, "gpt-5.5") {
return 6, true
}
Expand Down
13 changes: 13 additions & 0 deletions setting/ratio_setting/model_ratio_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ratio_setting

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestGetCompletionRatioGPT56UsesSpecialRatio(t *testing.T) {
assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-sol"))
assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-terra"))
assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-luna"))
}
Comment on lines +9 to +13

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Correct the expected ratios for the $40/M variants.

Given the stated $5/M input and $40/M output pricing, gpt-5.6-sol, gpt-5.6-terra, and gpt-5.6-luna should expect 8.0. Add a base gpt-5.6 assertion expecting 6.0 so the test distinguishes both pricing tiers.

Proposed test correction
 func TestGetCompletionRatioGPT56UsesSpecialRatio(t *testing.T) {
-	assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-sol"))
-	assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-terra"))
-	assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-luna"))
+	assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6"))
+	assert.Equal(t, 8.0, GetCompletionRatio("gpt-5.6-sol"))
+	assert.Equal(t, 8.0, GetCompletionRatio("gpt-5.6-terra"))
+	assert.Equal(t, 8.0, GetCompletionRatio("gpt-5.6-luna"))
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
func TestGetCompletionRatioGPT56UsesSpecialRatio(t *testing.T) {
assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-sol"))
assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-terra"))
assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6-luna"))
}
func TestGetCompletionRatioGPT56UsesSpecialRatio(t *testing.T) {
assert.Equal(t, 6.0, GetCompletionRatio("gpt-5.6"))
assert.Equal(t, 8.0, GetCompletionRatio("gpt-5.6-sol"))
assert.Equal(t, 8.0, GetCompletionRatio("gpt-5.6-terra"))
assert.Equal(t, 8.0, GetCompletionRatio("gpt-5.6-luna"))
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@setting/ratio_setting/model_ratio_test.go` around lines 9 - 13, Update
TestGetCompletionRatioGPT56UsesSpecialRatio so gpt-5.6-sol, gpt-5.6-terra, and
gpt-5.6-luna expect 8.0, and add a gpt-5.6 assertion expecting 6.0 to cover both
pricing tiers.