Skip to content

Feature request: widget to display extra usage used_credits #414

@mhriemers

Description

@mhriemers

Summary

The usage API's extra_usage.used_credits is already fetched and cached by ccstatusline (extraUsageUsed in CachedUsageDataSchema), but no widget can display it. Please add an extra-usage-used widget — or have extra-usage-remaining fall back to showing the used amount when extraUsageLimit is absent.

Motivation

For accounts with extra usage enabled but no monthly limit configured (monthly_limit: null — pay-as-you-go with no cap), neither existing extra-usage widget can render anything:

Widget Shows Needs
extra-usage-remaining limit − used extraUsageLimit — absent
extra-usage-utilization used / limit % extraUsageUtilization — absent

used_credits is the only meaningful extra-usage number for such accounts, and arguably interesting for capped accounts too (a used/remaining toggle, similar in spirit to #391).

Current workaround

A custom-command widget reading ccstatusline's own cache:

jq -r '(.extraUsageUsed // 0) / 100' "$HOME/.cache/ccstatusline/usage.json" | LC_ALL=C xargs printf 'extra: €%.2f'

Related: #413 (these widgets currently show a permanent [Timeout] for limit-less accounts), #415 (currency formatting).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions