diff --git a/src/resources/extensions/sf/provider-quota-cache.js b/src/resources/extensions/sf/provider-quota-cache.js index 39a0d6af9..d8ac756da 100644 --- a/src/resources/extensions/sf/provider-quota-cache.js +++ b/src/resources/extensions/sf/provider-quota-cache.js @@ -142,7 +142,18 @@ async function fetchKimiCodingQuota(apiKey) { /** * OpenRouter — GET https://openrouter.ai/api/v1/credits with Bearer auth. * Returns { data: { total_credits, total_usage } } where both are USD floats. - * Used relative to the user's purchased credits, not a rolling window. + * + * Important: SF's built-in policy (preferences-models.js:123-131 + * isModelAllowedByBuiltInProviderPolicy) restricts OpenRouter routes to + * `:free` + zero-cost models for ALL SF users, no opt-in needed. Routing + * through SF therefore never consumes credits — the credits balance is + * historical noise, not a signal for the quota-aware router. + * + * The window IS reported (so `sf headless usage` can display credits state + * for user awareness) but `usedFraction` is deliberately left undefined so + * benchmark-selector's quotaHeadroomMultiplier treats OpenRouter as "no + * quota signal" (neutral 1.0) rather than incorrectly demoting at the + * credits high-water mark. */ async function fetchOpenrouterQuota(apiKey) { const res = await fetch("https://openrouter.ai/api/v1/credits", { @@ -157,14 +168,12 @@ async function fetchOpenrouterQuota(apiKey) { return { windows: [ { - label: "credits (USD)", + label: "credits (USD, info only — SF routes :free)", used: totalUsage, limit: totalCredits || totalUsage, // avoid divide-by-zero - usedFraction: - totalCredits > 0 - ? clampFraction(totalUsage, totalCredits) - : undefined, - resetHint: remaining >= 0 ? `${remaining.toFixed(2)} USD remaining` : undefined, + // usedFraction intentionally omitted; see comment above. + resetHint: + remaining >= 0 ? `${remaining.toFixed(2)} USD remaining` : undefined, }, ], raw: payload,