# Usage feed The usage feed drives the `usage-core` executable to obtain provider account and limit reports. [`usage_feed.gleam`](../src/albedo/harness/usage_feed.gleam) owns the round loop and report types. [`albedo_usage_core.erl`](../src/albedo/harness/albedo_usage_core.erl) owns process and request I/O. The daemon quota component consumes the report in [`quota.gleam`](../src/albedo/daemon/quota.gleam). ## Rounds and errors `fetch(provider, credential, now_ms)` sends a JSON envelope to a fresh `usage advance -` process on each round. The envelope contains the credential and prior responses on stdin, not in arguments. The driver parses the last nonempty output line as a report, an error, or requests to answer. It stops after six rounds. See `fetch`, `loop`, and `step` in [`usage_feed.gleam`](../src/albedo/harness/usage_feed.gleam). A core error step becomes `Ok(Report(error: Some(...)))`. Driver failures, including missing executable, invalid output, timeout, or exceeding the round limit, return `Error`. A transport error becomes an HTTP answer with status 0 and a reason body. ## Request execution The Erlang driver sends HTTP requests through `albedo_http`. Command requests receive an environment limited to PATH, HOME, locale, timezone, and proxy variables. Their timeout defaults to 15 seconds and is capped at 60 seconds. Stdout is capped at 64 KiB. An unavailable command or timeout returns status 126. The timeout cleanup uses a `kill` executable on PATH. See `http_request`, `run_command`, `command_env`, and `kill` in [`albedo_usage_core.erl`](../src/albedo/harness/albedo_usage_core.erl). The executable resolves through `ALBEDO_USAGE_CORE` when set, otherwise `priv/bin/usage` and then PATH. An invalid override does not fall back to the bundled binary. Envelope and response data can contain credentials and must not be logged. The implementation's resolution and I/O boundaries are in [`albedo_usage_core.erl`](../src/albedo/harness/albedo_usage_core.erl). ## Report and packaging `Report` contains optional account ID, email, plan, and error, plus a list of `Limit` values. Limits include an ID, label, status, and optional usage, window, reset, and scope fields. Their decoding is in [`usage_feed.gleam`](../src/albedo/harness/usage_feed.gleam). The external core is pinned in [`flake.nix`](../flake.nix) and built by [`usage-core.nix`](../nix/packages/usage-core.nix). Provider-specific semantics belong to that pinned dependency, not this page. ## Related pages - [All topics](README.md) - [Change guidance](contributing.md) - [Quota](quota.md) - [Model authentication](auth.md)