# Quota The daemon polls supported accounts for provider-reported quota readings. These readings are separate from the token usage recorded for [provider requests](provider-requests.md). [`quota.gleam`](../apps/albedo/src/albedo/accounts/quota.gleam) owns discovery, scheduling, storage, and queries. ## Accounts Provider extensions supply the accounts through `QuotaPlugin` sources. The [daemon server](../apps/albedo/src/albedo/lifecycle/server.gleam) passes every installed source to the poller, enabled or not, with the runtime's key environment. The poller hands that value to each source so key profiles find environment keys. `enumerate` collects each source's sign-in accounts first. It then asks the source of the extension each saved profile names for that profile's target. A target includes a provider, a non-secret account label, and credentials for the fetch. Discovery and individual polls run outside the poller actor. See [`enumerate` and `start_due`](../apps/albedo/src/albedo/accounts/quota.gleam), [provider contributions](plugins.md#provider-account-and-profile-contributions), and [authentication](auth.md). These extensions contribute sources today: - Claude, Codex, Google Antigravity, and OpenCode Go poll their sign-in accounts as `anthropic`, `openai-codex`, `google-antigravity`, and `opencode-go`. - An OpenCode Go key profile polls the first key it resolves to. - An OpenAI-compatible profile polls the feed its endpoint host names. The [OpenAI extension](../extensions/openai/src/albedo_ext_openai/extension.gleam) maps the Hyper, DeepSeek, and Alibaba hosts. ## Cadence The `quota` section of `extensions.json` defaults to `enabled: true`, `pollSeconds: 600`, and `busyPollSeconds: 120`. The poller reloads settings each round. It clamps the ordinary interval to 1 through 86,400 seconds and the busy interval to 1 through the ordinary interval. A successful report uses the busy interval if a limit is at least 80 percent used or resets within the next 15 minutes. Failed polls use exponential backoff based on the ordinary interval, with the exponent capped at six and the wait capped at one hour. When discovery removes an account, its in-flight poll can finish and record its reading. Only accounts still listed by discovery are scheduled again. See [`load_settings`, `wait_seconds`, and `is_busy`](../apps/albedo/src/albedo/accounts/quota.gleam). ## Readings `record` stores one row per reported limit, or an error row with an empty limit ID when a report has no limits. Every returned report then runs its source's `heal`. Antigravity's [`quota_source`](../extensions/antigravity/src/albedo_ext_antigravity/accounts.gleam) heal updates account limit marks, including for reports with an error or no limits. Claude's heal marks a sign-in until the latest reset of a window at 100 percent and never clears a mark; see [rotation](auth.md#rotation). Empty reports prune expired marks and remove integer legacy global marks. The [account policy](../extensions/antigravity/src/albedo_ext_antigravity/accounts.gleam) owns reconciliation; the native adapter retains matching, locking, storage layout, and unknown fields. An omitted meter keeps its live mark. The recorded reading is the provider report, not an independently measured balance. See [`run` and `record`](../apps/albedo/src/albedo/accounts/quota.gleam). ## Reading them back [`latest`](../apps/albedo/src/albedo/accounts/quota.gleam) returns the latest row for each account, provider, and limit. It suppresses an empty-limit error row after a newer real limit reading for that account and provider. `history` returns newest-first rows with an ID cursor and can filter a provider, account, and limit trail. The [daemon server](../apps/albedo/src/albedo/lifecycle/server.gleam) exposes these queries through its HTTP API. ## Related pages - [All topics](README.md) - [Change guidance](contributing.md) - [Usage feed](usage-feed.md) - [Provider requests](provider-requests.md)