Skip to content

fix: correct gpt-5.6 completion ratio - #6063

Open
worryzyy wants to merge 1 commit into
QuantumNous:mainfrom
worryzyy:codex/fix-gpt-56-completion-ratio
Open

fix: correct gpt-5.6 completion ratio#6063
worryzyy wants to merge 1 commit into
QuantumNous:mainfrom
worryzyy:codex/fix-gpt-56-completion-ratio

Conversation

@worryzyy

@worryzyy worryzyy commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

?? ???? / PR Notice

Important

  • ???????????????????????? AI ???

?? ???? / Description

? gpt-5.6* ????????????????? gpt-5.5*?gpt-5.4* ???? 6 ????????????? gpt-5* ? 8 ????

??????? Token ???????? $5/M ???????? $30/M ????? gpt-5.6-sol?gpt-5.6-terra?gpt-5.6-luna ???? $40/M???????????????????

???? PR ? Codex ?????????????? gpt-5.6* ????????????

?? ???? / Type of change

  • ?? Bug ?? (Bug fix) - ????? Issue???????????????????????? bug
  • ? ??? (New feature) - ????????? Issue ??
  • ? ???? / ?? (Refactor)
  • ?? ???? (Documentation)

?? ???? / Related Issue

  • N/A

? ?????? / Checklist

  • ????: ???????????????????????? AI ???
  • ?????: ??????? Issues ? PRs??????????
  • Bug fix ??: ?? PR ??? Bug fix?????????? Issue????????????????????????? bug?
  • ????: ???????????????????
  • ????: ? PR ??????????????????
  • ????: ?????????????????????????????
  • ????: ???????????????????

?? ???? / Proof of Work

go test ./setting/ratio_setting -run TestGetCompletionRatioGPT56UsesSpecialRatio -count=1

???

ok  github.com/QuantumNous/new-api/setting/ratio_setting  0.037s

Summary by CodeRabbit

  • Bug Fixes
    • Added support for gpt-5.6 models with the correct completion ratio.
    • Ensured supported gpt-5.6 variants consistently use a ratio of 6.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

GPT-5.6 model identifiers now receive a locked completion ratio of 6, with tests covering three GPT-5.6 variants.

Changes

GPT-5.6 ratio handling

Layer / File(s) Summary
GPT-5.6 ratio logic and validation
setting/ratio_setting/model_ratio.go, setting/ratio_setting/model_ratio_test.go
The hardcoded ratio logic returns 6 with locked=true for GPT-5.6 models, and tests verify a 6.0 ratio across three model identifiers.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A bunny found a model six,
With locked-up ratios in the mix.
Three names hopped through the test,
GPT-5.6 passed its quest.
Nibble, verify, success!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: correcting the gpt-5.6 completion ratio.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch codex/fix-gpt-56-completion-ratio

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 2

🤖 Prompt for all review comments with 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.

Inline comments:
In `@setting/ratio_setting/model_ratio_test.go`:
- Around line 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.

In `@setting/ratio_setting/model_ratio.go`:
- Around line 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8cc60e76-e8e9-4970-9df3-66e7f169a2e0

📥 Commits

Reviewing files that changed from the base of the PR and between 4e57038 and f3b07ef.

📒 Files selected for processing (2)
  • setting/ratio_setting/model_ratio.go
  • setting/ratio_setting/model_ratio_test.go

Comment on lines +9 to +13
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"))
}

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.

Comment on lines +507 to +509
if strings.HasPrefix(name, "gpt-5.6") {
return 6, true
}

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant