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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user