Skip to content

Usage API now reports per-model weekly limits in a limits array — widget misses the binding cap (e.g. Fable weekly) #56

Description

@dmriding

The /api/oauth/usage endpoint now includes a limits array, and per-model weekly caps only appear there — the legacy seven_day_opus / seven_day_sonnet fields are always null now. Since the monitor parses only five_hour and seven_day, users on plans with a model-scoped weekly cap can hit rate limiting while the widget shows a comfortable all-models weekly.

Real example from my account today: all-models weekly at 26%, but Fable weekly at 43% with is_active: true — the binding limit was invisible in the widget.

Trimmed real response:

{
  "five_hour":  { "utilization": 29.0, "resets_at": "..." },
  "seven_day":  { "utilization": 26.0, "resets_at": "..." },
  "seven_day_opus": null,
  "seven_day_sonnet": null,
  "limits": [
    { "kind": "session",       "percent": 29, "resets_at": "...", "scope": null, "is_active": false },
    { "kind": "weekly_all",    "percent": 26, "resets_at": "...", "scope": null, "is_active": false },
    { "kind": "weekly_scoped", "percent": 43, "resets_at": "...",
      "scope": { "model": { "id": null, "display_name": "Fable" } }, "is_active": true }
  ]
}

Suggested handling: parse limits[] entries with kind: "weekly_scoped", take the label from scope.model.display_name, and treat is_active as "this is the currently binding limit".

I've implemented this in my own (heavily diverged, private) fork and it works well — happy to send a PR adapted to your codebase if you'd like one. Thanks for building this!

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