fix: support xhigh reasoning effort in usage records for Claude Messages API
Closes #1732
This commit is contained in:
@@ -962,7 +962,7 @@ func NormalizeClaudeOutputEffort(raw string) *string {
|
||||
return nil
|
||||
}
|
||||
switch value {
|
||||
case "low", "medium", "high", "max":
|
||||
case "low", "medium", "high", "xhigh", "max":
|
||||
return &value
|
||||
default:
|
||||
return nil
|
||||
|
||||
@@ -1149,6 +1149,11 @@ func TestParseGatewayRequest_OutputEffort(t *testing.T) {
|
||||
body: `{"model":"claude-opus-4-6","output_config":{"effort":"max"},"messages":[]}`,
|
||||
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",
|
||||
body: `{"model":"claude-opus-4-6","output_config":{},"messages":[]}`,
|
||||
@@ -1186,9 +1191,10 @@ func TestNormalizeClaudeOutputEffort(t *testing.T) {
|
||||
{"LOW", strPtr("low")},
|
||||
{"Max", strPtr("max")},
|
||||
{" medium ", strPtr("medium")},
|
||||
{"xhigh", strPtr("xhigh")},
|
||||
{"XHIGH", strPtr("xhigh")},
|
||||
{"", nil},
|
||||
{"unknown", nil},
|
||||
{"xhigh", nil},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.input, func(t *testing.T) {
|
||||
|
||||
@@ -193,7 +193,9 @@ export function formatReasoningEffort(effort: string | null | undefined): string
|
||||
return 'High'
|
||||
case 'xhigh':
|
||||
case 'extrahigh':
|
||||
return 'Xhigh'
|
||||
return 'XHigh'
|
||||
case 'max':
|
||||
return 'Max'
|
||||
case 'none':
|
||||
case 'minimal':
|
||||
return '-'
|
||||
|
||||
Reference in New Issue
Block a user