Skip to content

feat(kilo): report quota from the Kilo Pass state endpoint - #195

Open
wagner-sousa wants to merge 7 commits into
slkiser:mainfrom
wagner-sousa:feat/kilo-user-api
Open

feat(kilo): report quota from the Kilo Pass state endpoint#195
wagner-sousa wants to merge 7 commits into
slkiser:mainfrom
wagner-sousa:feat/kilo-user-api

Conversation

@wagner-sousa

@wagner-sousa wagner-sousa commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Report Kilo Pass quota from the authenticated subscription-state endpoint (GET https://app.kilo.ai/api/trpc/kiloPass.getState) alone. Derives credit-remaining percentage (base + bonus period credits), USD balance, and usage in a single request, replacing the previous balance-only API call.

Changes

  • src/lib/kilo.ts: drop the /api/profile/balance call; queryKiloPassState now reads currentPeriodBaseCreditsUsd, currentPeriodUsageUsd, and currentPeriodBonusCreditsUsd from the tRPC kiloPass.getState payload, deriving balanceUsd (rounded) and bonusUsd.
  • src/providers/kilo.ts: one fetch builds the Credits: percent entry (percentage computed over base + bonus) plus a value row split into left (U: $usage) and right (B: $balance + $bonus when present) columns; surfaces balance_usd in status details.
  • src/lib/toast-format-grouped.ts: label-less value entries now render full-width; shared label normalization.
  • src/lib/provider-metadata.ts: update Kilo notes; drop the stale kilo-gateway runtime alias (single provider only).
  • src/lib/quota-render-data.ts: include a provider-reported label (e.g. [Kilo Gateway] Credits) in single-window rendering without duplicating window labels.
  • docs/readme/providers.md: document the Kilo Pass state endpoint and fields.
  • tests: cover the state client, provider entries, metadata, and the Antigravity clock-sensitive fixture.
  • .gitignore: ignore stray worktrees.

Report credit-remaining percentage, USD balance, and usage from the
Kilo user account endpoint alone, replacing the separate balance API
call. Include the Credits label in single-window rendering, keep the
grouped toast time column off when no reset time exists, and drop the
stale kilo-gateway runtime alias. Fix a clock-sensitive Antigravity
test fixture and ignore stray worktrees.
Switch from the undocumented user API to the tRPC kiloPass.getState
endpoint, which exposes period base credits, usage, and bonus. Derive
the percent bar from base + bonus credits and split the value row into
left (U:) and right (B: + bonus) columns.

Also let grouped formatters render label-less value entries full-width.
@wagner-sousa wagner-sousa changed the title feat(kilo): centralize quota reporting on the user API feat(kilo): report quota from the Kilo Pass state endpoint Jul 31, 2026
@slkiser

slkiser commented Aug 1, 2026

Copy link
Copy Markdown
Owner

@wagner-sousa Thanks for adding better Kilo Pass support.

Quick question (currentPeriodBonusCreditsUsd): do you feel that displaying the bonus amount separately is useful?

The total quota remaining would still include any bonus credits Kilo provides, so users would see the correct percentage and remaining balance without needing a separate bonus label.

My preference is to keep the bonus in the calculation, diagnostics, and exports, but simplify the everyday UI to something like:

Kilo Gateway 83%, $12.50 left

@wagner-sousa

Copy link
Copy Markdown
Author

@wagner-sousa Thanks for adding better Kilo Pass support.

Quick question (currentPeriodBonusCreditsUsd): do you feel that displaying the bonus amount separately is useful?

The total quota remaining would still include any bonus credits Kilo provides, so users would see the correct percentage and remaining balance without needing a separate bonus label.

My preference is to keep the bonus in the calculation, diagnostics, and exports, but simplify the everyday UI to something like:

Kilo Gateway 83%, $12.50 left

Hi, I don't consider the bonus a standard quota, it's temporary and variable. That is why I have separated it.

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.

2 participants