fix: add OpenAI passthrough check in account selection and refresh

Add IsOpenAIPassthroughEnabled() bypass in two places:
- SelectAccountWithLoadAwareness Layer 2 candidate filtering (line 1285)
- resolveFreshSchedulableOpenAIAccount model check (line 1446)

Without these checks, passthrough accounts are filtered out for models
like gpt-5.4 that aren't in the account's model_mapping, causing 503.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
erio
2026-03-09 22:53:31 +08:00
co-authored by Claude Opus 4.6
parent 091999639e
commit 914a0cd4c8
@@ -1282,7 +1282,7 @@ func (s *OpenAIGatewayService) SelectAccountWithLoadAwareness(ctx context.Contex
if !acc.IsSchedulable() {
continue
}
if requestedModel != "" && !acc.IsModelSupported(requestedModel) {
if requestedModel != "" && !acc.IsOpenAIPassthroughEnabled() && !acc.IsModelSupported(requestedModel) {
continue
}
candidates = append(candidates, acc)
@@ -1443,7 +1443,7 @@ func (s *OpenAIGatewayService) resolveFreshSchedulableOpenAIAccount(ctx context.
if !fresh.IsSchedulable() || !fresh.IsOpenAI() {
return nil
}
if requestedModel != "" && !fresh.IsModelSupported(requestedModel) {
if requestedModel != "" && !fresh.IsOpenAIPassthroughEnabled() && !fresh.IsModelSupported(requestedModel) {
return nil
}
return fresh