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
9d70c385
"backend/internal/vscode:/vscode.git/clone" did not exist on "edb09370240af8db30d2335ca3202e3baacd3e9f"
Commit
9d70c385
authored
Mar 05, 2026
by
shaw
Browse files
fix: 修复claude apikey账号请求时未携带beta=true 查询参数的bug
parent
aeb464f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/account_test_service.go
View file @
9d70c385
...
...
@@ -33,7 +33,7 @@ import (
var
sseDataPrefix
=
regexp
.
MustCompile
(
`^data:\s*`
)
const
(
testClaudeAPIURL
=
"https://api.anthropic.com/v1/messages"
testClaudeAPIURL
=
"https://api.anthropic.com/v1/messages
?beta=true
"
chatgptCodexAPIURL
=
"https://chatgpt.com/backend-api/codex/responses"
soraMeAPIURL
=
"https://sora.chatgpt.com/backend/me"
// Sora 用户信息接口,用于测试连接
soraBillingAPIURL
=
"https://sora.chatgpt.com/backend/billing/subscriptions"
...
...
@@ -238,7 +238,7 @@ func (s *AccountTestService) testClaudeAccountConnection(c *gin.Context, account
if
err
!=
nil
{
return
s
.
sendErrorAndEnd
(
c
,
fmt
.
Sprintf
(
"Invalid base URL: %s"
,
err
.
Error
()))
}
apiURL
=
strings
.
TrimSuffix
(
normalizedBaseURL
,
"/"
)
+
"/v1/messages"
apiURL
=
strings
.
TrimSuffix
(
normalizedBaseURL
,
"/"
)
+
"/v1/messages
?beta=true
"
}
else
{
return
s
.
sendErrorAndEnd
(
c
,
fmt
.
Sprintf
(
"Unsupported account type: %s"
,
account
.
Type
))
}
...
...
backend/internal/service/gateway_service.go
View file @
9d70c385
...
...
@@ -4583,7 +4583,7 @@ func (s *GatewayService) buildUpstreamRequestAnthropicAPIKeyPassthrough(
if
err
!=
nil
{
return
nil
,
err
}
targetURL
=
validatedURL
+
"/v1/messages"
targetURL
=
validatedURL
+
"/v1/messages
?beta=true
"
}
req
,
err
:=
http
.
NewRequestWithContext
(
ctx
,
http
.
MethodPost
,
targetURL
,
bytes
.
NewReader
(
body
))
...
...
@@ -4963,7 +4963,7 @@ func (s *GatewayService) buildUpstreamRequest(ctx context.Context, c *gin.Contex
if
err
!=
nil
{
return
nil
,
err
}
targetURL
=
validatedURL
+
"/v1/messages"
targetURL
=
validatedURL
+
"/v1/messages
?beta=true
"
}
}
...
...
@@ -7088,7 +7088,7 @@ func (s *GatewayService) buildCountTokensRequestAnthropicAPIKeyPassthrough(
if
err
!=
nil
{
return
nil
,
err
}
targetURL
=
validatedURL
+
"/v1/messages/count_tokens"
targetURL
=
validatedURL
+
"/v1/messages/count_tokens
?beta=true
"
}
req
,
err
:=
http
.
NewRequestWithContext
(
ctx
,
http
.
MethodPost
,
targetURL
,
bytes
.
NewReader
(
body
))
...
...
@@ -7135,7 +7135,7 @@ func (s *GatewayService) buildCountTokensRequest(ctx context.Context, c *gin.Con
if
err
!=
nil
{
return
nil
,
err
}
targetURL
=
validatedURL
+
"/v1/messages/count_tokens"
targetURL
=
validatedURL
+
"/v1/messages/count_tokens
?beta=true
"
}
}
...
...
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