fix(quota): stop showing misleading OpenRouter percentages (#1127)

* fix(quota): stop showing misleading OpenRouter percentages

Fixes #1085

* fix(quota): clean up OpenRouter credit labels

---------
Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
zerone0x
2026-05-07 23:39:53 +03:00
committed by GitHub
co-authored by Bohdan Triapitsyn
parent b65edc3436
commit 3fbcdbc3dc
7 changed files with 32 additions and 19 deletions
@@ -59,14 +59,14 @@ export const fetchQuota = async () => {
const remaining = totalCredits !== null && totalUsage !== null
? Math.max(0, totalCredits - totalUsage)
: null;
const usedPercent = totalCredits && totalUsage !== null
? Math.max(0, Math.min(100, (totalUsage / totalCredits) * 100))
: null;
const valueLabel = remaining !== null ? `$${formatMoney(remaining)} remaining` : null;
let valueLabel = null;
if (remaining !== null && totalUsage !== null) {
valueLabel = `$${formatMoney(remaining)} left · $${formatMoney(totalUsage)} spent`;
}
const windows = {
credits: toUsageWindow({
usedPercent,
usedPercent: null,
windowSeconds: null,
resetAt: null,
valueLabel