refactor(credits): fold review findings for stealth free-tier fix

- credits_tracker: trim inline comment block (duplicated docstring) and
  correct its safety claim - a paid model under stealth/ would fail
  closed (suppressed banner), not open; state the trade-off honestly.
- run_agent: update stale call-site comment to mention stealth/ prefix.
- auxiliary_client: widen sibling free-SKU detector _is_free_model to
  recognize stealth/ prefix (same bug class as #91843: free_only=true
  wrongly skipped the OpenRouter fallback and the paid-lane warning
  fired spuriously for stealth models).
- tests: bind the new sibling behavior (stealth/ox-alpha free,
  my-stealth/model not).
This commit is contained in:
kshitijk4poor
2026-08-22 04:12:02 +05:30
committed by kshitij
parent ad96d2e2d9
commit 8a949659c3
4 changed files with 13 additions and 10 deletions
+3 -7
View File
@@ -244,13 +244,9 @@ def is_free_tier_model(model: str, base_url: str = "") -> bool:
return False
if model.endswith(":free"):
return True
# Stealth-preview SKUs (e.g. stealth/ox-alpha) are free-tier but carry no
# ``:free`` suffix. Spend is forced to zero server-side, so a ``paid_access:
# false`` header on these models is a false positive for the depleted banner.
# The ``stealth/`` prefix is the Nous naming convention for these SKUs and
# is checked here as a zero-network signal, same design as the ``:free``
# suffix above. Fail-open to False (the banner still shows) if the prefix
# ever changes — recoverable noise, never a masked depletion on a paid model.
# Stealth-preview SKUs are free-tier but carry no ``:free`` suffix (see
# docstring point 2). Naming-convention trust: if a PAID model ever shipped
# under ``stealth/`` this would wrongly suppress the banner on it.
if model.startswith("stealth/"):
return True
if not base_url: