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:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
b65edc3436
commit
3fbcdbc3dc
@@ -1420,10 +1420,10 @@ export const fetchOpenRouterQuota = async (): Promise<ProviderResult> => {
|
||||
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: string | null = null;
|
||||
if (remaining !== null && totalUsage !== null) {
|
||||
valueLabel = `$${formatMoney(remaining)} left · $${formatMoney(totalUsage)} spent`;
|
||||
}
|
||||
|
||||
return buildResult({
|
||||
providerId: 'openrouter',
|
||||
@@ -1433,7 +1433,7 @@ export const fetchOpenRouterQuota = async (): Promise<ProviderResult> => {
|
||||
usage: {
|
||||
windows: {
|
||||
credits: toUsageWindow({
|
||||
usedPercent,
|
||||
usedPercent: null,
|
||||
windowSeconds: null,
|
||||
resetAt: null,
|
||||
valueLabel,
|
||||
|
||||
Reference in New Issue
Block a user