Skip to main content

Module codex_usage

Module codex_usage 

Source
Expand description

Codex usage, asked of the account itself.

codex_limits reads what Codex happened to write into a home’s transcripts. This asks the account, with that account’s own token, and gets back an answer that names itself: email, plan_type, the windows, the per-model limits, the credit balance, and why a refusal happened.

That difference matters for one reason above the others. A transcript can only be attributed by the home it sits in, and a home with no transcripts yields nothing at all - a saved account that has not been used through this machine is a permanent blank. The endpoint answers per CREDENTIAL, so it reports that account too, and says whose the numbers are rather than leaving it to be inferred.

Same discipline as quota, for the same reasons: read-only, run only when the user asks, curl with its config on stdin so the token never reaches ps, an honest User-Agent, and no HTTP client in the dependency graph.

Structs§

Account
What one account says about itself.
Credits
Pre-purchased credits, the way past a full window - and the reason a window at 100% is not the end of an account.

Enums§

Fetch
What one read produced.
LiveOutcome
What a live read means for the row it was taken for.

Constants§

USAGE_URL

Functions§

classify
fetch
from_headers
The same reading, taken off a response the proxy was already carrying.
note_reading
Write down whatever the endpoint said about this account.
note_token_outcome
Ask one account, using its own login.
outcome_of
Which of those a Fetch is. (classify in this file is the HTTP-status side of the same journey; this is what the row does with the result.)
parse
Read one account’s answer.
plain_balance
A balance as a person reads it: the endpoint’s decimal string without the trailing zeros of its fixed scale. Trimmed as text, so nothing is rounded.
refusal_words
Plain words for a refusal, and - where the reason distinguishes them - who can clear it.
remember
Record what a Codex response said about the account that served it.