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
66e06527
Commit
66e06527
authored
Apr 07, 2026
by
Alex
Committed by
陈曦
Apr 08, 2026
Browse files
fix(openai): do not normalize /completion API token based accounts
parent
e7439c32
Changes
3
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/openai_gateway_chat_completions.go
View file @
66e06527
...
@@ -46,7 +46,7 @@ func (s *OpenAIGatewayService) ForwardAsChatCompletions(
...
@@ -46,7 +46,7 @@ func (s *OpenAIGatewayService) ForwardAsChatCompletions(
// 2. Resolve model mapping early so compat prompt_cache_key injection can
// 2. Resolve model mapping early so compat prompt_cache_key injection can
// derive a stable seed from the final upstream model family.
// derive a stable seed from the final upstream model family.
billingModel
:=
resolveOpenAIForwardModel
(
account
,
originalModel
,
defaultMappedModel
)
billingModel
:=
resolveOpenAIForwardModel
(
account
,
originalModel
,
defaultMappedModel
)
upstreamModel
:=
normalize
CodexModel
(
billingModel
)
upstreamModel
:=
normalize
OpenAIModelForUpstream
(
account
,
billingModel
)
promptCacheKey
=
strings
.
TrimSpace
(
promptCacheKey
)
promptCacheKey
=
strings
.
TrimSpace
(
promptCacheKey
)
compatPromptCacheInjected
:=
false
compatPromptCacheInjected
:=
false
...
...
backend/internal/service/openai_gateway_messages.go
View file @
66e06527
...
@@ -62,7 +62,7 @@ func (s *OpenAIGatewayService) ForwardAsAnthropic(
...
@@ -62,7 +62,7 @@ func (s *OpenAIGatewayService) ForwardAsAnthropic(
// 3. Model mapping
// 3. Model mapping
billingModel
:=
resolveOpenAIForwardModel
(
account
,
normalizedModel
,
defaultMappedModel
)
billingModel
:=
resolveOpenAIForwardModel
(
account
,
normalizedModel
,
defaultMappedModel
)
upstreamModel
:=
normalize
CodexModel
(
billingModel
)
upstreamModel
:=
normalize
OpenAIModelForUpstream
(
account
,
billingModel
)
responsesReq
.
Model
=
upstreamModel
responsesReq
.
Model
=
upstreamModel
logger
.
L
()
.
Debug
(
"openai messages: model mapping applied"
,
logger
.
L
()
.
Debug
(
"openai messages: model mapping applied"
,
...
...
backend/internal/service/openai_ws_forwarder.go
View file @
66e06527
...
@@ -2515,7 +2515,7 @@ func (s *OpenAIGatewayService) ProxyResponsesWebSocketFromClient(
...
@@ -2515,7 +2515,7 @@ func (s *OpenAIGatewayService) ProxyResponsesWebSocketFromClient(
}
}
normalized
=
next
normalized
=
next
}
}
upstreamModel
:=
normalize
CodexModel
(
account
.
GetMappedModel
(
originalModel
))
upstreamModel
:=
normalize
OpenAIModelForUpstream
(
account
,
account
.
GetMappedModel
(
originalModel
))
if
upstreamModel
!=
originalModel
{
if
upstreamModel
!=
originalModel
{
next
,
setErr
:=
applyPayloadMutation
(
normalized
,
"model"
,
upstreamModel
)
next
,
setErr
:=
applyPayloadMutation
(
normalized
,
"model"
,
upstreamModel
)
if
setErr
!=
nil
{
if
setErr
!=
nil
{
...
@@ -2773,7 +2773,7 @@ func (s *OpenAIGatewayService) ProxyResponsesWebSocketFromClient(
...
@@ -2773,7 +2773,7 @@ func (s *OpenAIGatewayService) ProxyResponsesWebSocketFromClient(
mappedModel
:=
""
mappedModel
:=
""
var
mappedModelBytes
[]
byte
var
mappedModelBytes
[]
byte
if
originalModel
!=
""
{
if
originalModel
!=
""
{
mappedModel
=
normalize
CodexModel
(
account
.
GetMappedModel
(
originalModel
))
mappedModel
=
normalize
OpenAIModelForUpstream
(
account
,
account
.
GetMappedModel
(
originalModel
))
needModelReplace
=
mappedModel
!=
""
&&
mappedModel
!=
originalModel
needModelReplace
=
mappedModel
!=
""
&&
mappedModel
!=
originalModel
if
needModelReplace
{
if
needModelReplace
{
mappedModelBytes
=
[]
byte
(
mappedModel
)
mappedModelBytes
=
[]
byte
(
mappedModel
)
...
...
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