Merge pull request #1749 from touwaeriol/fix/xhigh-reasoning-effort

fix: support xhigh reasoning effort in usage records
This commit is contained in:
Wesley Liddick
2026-04-19 21:13:45 +08:00
committed by GitHub
3 changed files with 11 additions and 3 deletions

View File

@@ -962,7 +962,7 @@ func NormalizeClaudeOutputEffort(raw string) *string {
return nil return nil
} }
switch value { switch value {
case "low", "medium", "high", "max": case "low", "medium", "high", "xhigh", "max":
return &value return &value
default: default:
return nil return nil

View File

@@ -1149,6 +1149,11 @@ func TestParseGatewayRequest_OutputEffort(t *testing.T) {
body: `{"model":"claude-opus-4-6","output_config":{"effort":"max"},"messages":[]}`, body: `{"model":"claude-opus-4-6","output_config":{"effort":"max"},"messages":[]}`,
wantEffort: "max", wantEffort: "max",
}, },
{
name: "output_config.effort xhigh",
body: `{"model":"claude-opus-4-7","output_config":{"effort":"xhigh"},"messages":[]}`,
wantEffort: "xhigh",
},
{ {
name: "output_config without effort", name: "output_config without effort",
body: `{"model":"claude-opus-4-6","output_config":{},"messages":[]}`, body: `{"model":"claude-opus-4-6","output_config":{},"messages":[]}`,
@@ -1186,9 +1191,10 @@ func TestNormalizeClaudeOutputEffort(t *testing.T) {
{"LOW", strPtr("low")}, {"LOW", strPtr("low")},
{"Max", strPtr("max")}, {"Max", strPtr("max")},
{" medium ", strPtr("medium")}, {" medium ", strPtr("medium")},
{"xhigh", strPtr("xhigh")},
{"XHIGH", strPtr("xhigh")},
{"", nil}, {"", nil},
{"unknown", nil}, {"unknown", nil},
{"xhigh", nil},
} }
for _, tt := range tests { for _, tt := range tests {
t.Run(tt.input, func(t *testing.T) { t.Run(tt.input, func(t *testing.T) {

View File

@@ -193,7 +193,9 @@ export function formatReasoningEffort(effort: string | null | undefined): string
return 'High' return 'High'
case 'xhigh': case 'xhigh':
case 'extrahigh': case 'extrahigh':
return 'Xhigh' return 'XHigh'
case 'max':
return 'Max'
case 'none': case 'none':
case 'minimal': case 'minimal':
return '-' return '-'