icebear0828 Claude Opus 4.6 commited on
Commit
be3d093
·
1 Parent(s): 01ac0fc

fix: strict plan filtering in model-aware account routing

Browse files

When mixing free and team/plus accounts, requesting a plan-restricted
model (e.g. gpt-5.4) could fall back to incompatible free accounts,
causing HTTP 400 "model not supported". Now acquire() returns null
instead of degrading to incompatible accounts when the model's plan
requirements are known but no matching account is available.

Also reduces model-fetcher initial delay from 5s to 1s to populate
the plan map faster at startup.

Fixes #54

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

src/auth/account-pool.ts CHANGED
@@ -105,8 +105,10 @@ export class AccountPool {
105
  const matched = available.filter((a) => a.planType && planSet.has(a.planType));
106
  if (matched.length > 0) {
107
  candidates = matched;
 
 
 
108
  }
109
- // else: fallback to all available (graceful degradation)
110
  }
111
  }
112
 
 
105
  const matched = available.filter((a) => a.planType && planSet.has(a.planType));
106
  if (matched.length > 0) {
107
  candidates = matched;
108
+ } else {
109
+ // No account matches the model's plan requirements — don't fallback to incompatible accounts
110
+ return null;
111
  }
 
112
  }
113
  }
114
 
src/models/model-fetcher.ts CHANGED
@@ -14,7 +14,7 @@ import type { ProxyPool } from "../proxy/proxy-pool.js";
14
  import { jitter } from "../utils/jitter.js";
15
 
16
  const REFRESH_INTERVAL_HOURS = 1;
17
- const INITIAL_DELAY_MS = 5_000; // 5s after startup
18
 
19
  let _refreshTimer: ReturnType<typeof setTimeout> | null = null;
20
  let _accountPool: AccountPool | null = null;
 
14
  import { jitter } from "../utils/jitter.js";
15
 
16
  const REFRESH_INTERVAL_HOURS = 1;
17
+ const INITIAL_DELAY_MS = 1_000; // 1s after startup (fast plan-map population for mixed-plan routing)
18
 
19
  let _refreshTimer: ReturnType<typeof setTimeout> | null = null;
20
  let _accountPool: AccountPool | null = null;