perf(cost): short-circuit above-threshold key discovery with cheap substring pre-filter

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
milan 2026-07-23 20:11:35 +00:00
parent 6a2a7a3930
commit 26a2704010

View file

@ -248,10 +248,11 @@ def _get_token_base_cost(
threshold_keys = [
k
for k in model_info
if k.startswith(_ABOVE_THRESHOLD_KEY_PREFIXES)
if "_above_" in k
and k.endswith("_tokens")
and "_above_1hr" not in k
and not k.endswith(_SERVICE_TIER_SUFFIXES)
and k.startswith(_ABOVE_THRESHOLD_KEY_PREFIXES)
]
if not threshold_keys:
return (