Asks a provider's OAuth usage endpoint what its subscription has left,
with the sign-in's access token (Rho.Auth.credential/1), as omp
does (subscriptions only: an API key has no such endpoint):
- Claude:
GET https://api.anthropic.com/api/oauth/usagewith theoauth-2025-04-20beta and Claude Code's user agent - ChatGPT:
GET https://chatgpt.com/backend-api/wham/usagewith thechatgpt-account-id
refresh/3 stores the result (Rho.Usage.put_endpoint/5). The
token goes only into the request's authorization header; errors never
include it.
Summary
Functions
provider's usage JSON, or why there is none: signed out, an API key
(no subscription), an expired sign-in, or the endpoint's HTTP status and
message (it answers 429 when asked too often).
Fetches and stores provider's windows. opts: :credential (default
Rho.Auth.credential/1), :respond (a test's fake response for
the Req.Request), :now.
Functions
@spec fetch(Rho.Auth.provider(), keyword()) :: {:ok, map()} | {:error, String.t()}
provider's usage JSON, or why there is none: signed out, an API key
(no subscription), an expired sign-in, or the endpoint's HTTP status and
message (it answers 429 when asked too often).
@spec refresh(Path.t(), Rho.Auth.provider(), keyword()) :: :ok | {:error, String.t()}
Fetches and stores provider's windows. opts: :credential (default
Rho.Auth.credential/1), :respond (a test's fake response for
the Req.Request), :now.