Skip to content

feat(quotas): provider-grouped widget + credential gating + extra_provider_ids#216

Merged
typelicious merged 1 commit intomainfrom
fix/quota-widget-provider-groups
Apr 18, 2026
Merged

feat(quotas): provider-grouped widget + credential gating + extra_provider_ids#216
typelicious merged 1 commit intomainfrom
fix/quota-widget-provider-groups

Conversation

@typelicious
Copy link
Copy Markdown
Collaborator

Summary

Addresses the feedback that the quotas widget shows nonsense for providers without credentials and fails to group shared quotas (e.g. Gemini Flash + Flash-Lite).

What changes

  • QuotaStatus gains a provider_group field — dashboard groups packages under one provider card (CodexBar-style), subdivided by package inside. Fallback derivation when the catalog omits the field.
  • extra_provider_ids support — rolling_window + daily status computations sum local counts across every listed router provider ID, so shared subscriptions/free tiers read accurately.
  • Credential gating on /api/quotas — packages tagged with _requires_credential are hidden when the env var is missing / carries a your-key placeholder, or when the OAuth subject isn't in the local token store. Skipped packages are reported under skipped_packages so the UI can show what's dormant and why.
  • Widget rewrite — one card per provider_group, packages stacked inside, plus a compact "hidden" callout at the bottom listing credential-gated entries.

Companion catalog change

The accompanying fusionaize-metadata catalog update (local, not committed — carries real credit balances) introduces these tags. Gate tolerates catalogs that omit them: packages without _requires_credential pass through unchanged, and provider_group falls back to a family-prefix heuristic.

Verified

  • Ruff clean on touched modules.
  • Full pytest suite: 384 passed, 4 skipped, 0 failed (~23 min).
  • Live filter smoke: with the real /opt/homebrew/etc/faigate/faigate.env, 13/15 catalog entries active; the 2 OpenRouter entries were correctly hidden while the key was still placeholder and re-activated once the real key was in place.

Test plan

  • Ruff
  • Full pytest (384 passed)
  • Smoke: _filter_packages_by_credentials against real env + tokens.json
  • Restart the installed service and eyeball /dashboard/quotas — cards should group by provider, weekly Claude Pro + 5h session should show together, Gemini should be a single card covering both flash variants, OpenRouter flips between "hidden" and active based on env.

🤖 Generated with Claude Code

Reworks the /api/quotas surface so the dashboard widget matches how
CodexBar presents provider state:

- QuotaStatus gains a provider_group field; the widget groups packages
  under one provider card and subdivides by package inside it
- daily / rolling_window statuses accept extra_provider_ids so a shared
  quota (e.g. Google AI Studio free tier covers both gemini-flash and
  gemini-flash-lite) is counted across all router IDs that draw from it
- /api/quotas applies a credential gate: packages tagged with
  _requires_credential are hidden when the env var is missing /
  placeholder, or when the OAuth subject is not in the local token
  store. Skipped entries are reported back under skipped_packages so
  operators can see what's dormant and why.
- dashboard widget renders one card per provider_group with all its
  packages stacked (CodexBar-style), plus a small "hidden" callout
  listing credential-gated packages that aren't active yet
@typelicious typelicious enabled auto-merge (squash) April 18, 2026 18:03
@typelicious typelicious merged commit 8f1212f into main Apr 18, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant