Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
6530776a
Commit
6530776a
authored
Apr 19, 2026
by
erio
Browse files
fix: support xhigh reasoning effort in usage records for Claude Messages API
Closes #1732
parent
51af8df3
Changes
3
Show whitespace changes
Inline
Side-by-side
backend/internal/service/gateway_request.go
View file @
6530776a
...
@@ -962,7 +962,7 @@ func NormalizeClaudeOutputEffort(raw string) *string {
...
@@ -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
...
...
backend/internal/service/gateway_request_test.go
View file @
6530776a
...
@@ -1149,6 +1149,11 @@ func TestParseGatewayRequest_OutputEffort(t *testing.T) {
...
@@ -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) {
...
@@ -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
)
{
...
...
frontend/src/utils/format.ts
View file @
6530776a
...
@@ -193,7 +193,9 @@ export function formatReasoningEffort(effort: string | null | undefined): string
...
@@ -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
'
-
'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment