mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-21 05:21:20 +00:00
An OpenAI account with auto-passthrough enabled (extra.openai_passthrough=true, "replace auth only, allow all models") was still filtered out during account selection when it had a non-empty credentials.model_mapping that did not list the requested model. isOpenAICompatibleAccountEligibleForRequest calls Account.IsModelSupported directly, and IsModelSupported only bypassed the mapping whitelist for passthrough accounts when the mapping was empty. A leftover mapping (common after switching an account from whitelist mode to passthrough) therefore excluded the account -> zero candidates -> ErrNoAvailableAccounts, and the client saw 404 "Model ... is not supported by any configured account in this group" even though a direct account test with the same model succeeded (that path already honored passthrough via isModelSupportedByAccount). Fix: short-circuit passthrough at the top of Account.IsModelSupported, before the model_mapping check, so it is consistent with isModelSupportedByAccount. Add a regression test covering passthrough + non-empty leftover mapping.