Skip to content

Commit bbd0f64

Browse files
committed
fix(chutes): use force=False to prevent API lag from wiping local usage
The subscription_usage API updates slowly (often sub-cent precision that truncates to 0). With force=True the background refresh was overwriting locally-tracked usage with stale zeros. Now uses force=False so UsageManager keeps max(local, api).
1 parent 46d0096 commit bbd0f64

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/rotator_library/providers/chutes_provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ async def refresh_single(api_key: str, client: httpx.AsyncClient) -> None:
295295
quota_max_requests=four_hour_cap_cents,
296296
quota_reset_ts=None,
297297
quota_used=four_hour_used_cents,
298-
force=True, # API values are authoritative
298+
force=False, # Keep max(local, api) — API lags behind
299299
)
300300

301301
# Push monthly window data (overall budget)
@@ -313,7 +313,7 @@ async def refresh_single(api_key: str, client: httpx.AsyncClient) -> None:
313313
quota_reset_ts=None,
314314
quota_used=monthly_used_cents,
315315
quota_group="monthly($)",
316-
force=True,
316+
force=False, # Keep max(local, api) — API lags behind
317317
)
318318

319319
monthly = balance_data.get("monthly", {})

0 commit comments

Comments
 (0)