mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
fix: add missing Codex CLI headers for OAuth account test
The testOpenAIAccountConnection function was sending requests to chatgpt.com/backend-api/codex/responses without the required Codex CLI identification headers, causing 401 Unauthorized for OAuth/PAT accounts. The gateway Forward path and the compact test path both set these headers: - Originator: codex_cli_rs - User-Agent: codex_cli_rs/<version> - OpenAI-Beta: responses=experimental This patch adds the same headers to the normal (non-compact) OAuth test path. API key accounts and other platforms are unaffected since the headers are inside the isOAuth branch.
This commit is contained in:
@@ -600,6 +600,9 @@ func (s *AccountTestService) testOpenAIAccountConnection(c *gin.Context, account
|
||||
if isOAuth {
|
||||
req.Host = "chatgpt.com"
|
||||
req.Header.Set("accept", "text/event-stream")
|
||||
req.Header.Set("OpenAI-Beta", "responses=experimental")
|
||||
req.Header.Set("Originator", "codex_cli_rs")
|
||||
req.Header.Set("User-Agent", codexCLIUserAgent)
|
||||
setOpenAIChatGPTAccountHeaders(req.Header, credentialAccount)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user