Read Usage
GET /v1/link/usage/requests/<X-Request-Id>.
Tag Requests
Send a header, or settags on a child token:
Budgets
A user can cap the tokens your app may use per 5 hours and per week (for example, “500K tokens / week”). One cap covers the whole connection: all its plans and API keys together. Users set it on the connections page (/v1/link/connections). It can also be set with a key: on a self-hosted gateway, the operator’s gateway key; on hosted Dari, the user’s own personal key.
window_minutes is 300 or 10080; [] removes the cap.
Tokens are counted the way usage above reports them: input + output + cache read + cache write, for every request of the connection, child tokens included. Windows roll: a week means the last 7 days. Each request is checked before it runs, so the one that crosses the cap still finishes. After that you get:
resets_at is when enough of the window’s oldest requests roll off to bring it back under the cap. grant shows used_tokens for each window.
Plan And Key Limits
A user can also limit each plan and API key a connection uses.- A plan takes
max_percent: the share of its quota past which the connection stops using it. While any of the plan’s 5-hour or weekly windows, as its provider last reported, is atmax_percentused, the plan stops serving the connection until that window resets. The provider’s count covers every use of the plan, the user’s own included, so the rest stays the user’s. A plan whose provider has reported no usage yet is never at its limit. - An API key takes
monthly_usd: what the connection may spend on it in a calendar month (UTC), as its provider charged. At the limit it stops serving the connection until the month ends.
monthly_usd limit, counted at API prices, until it is changed.
The rest keep serving. Users set these on the connections page, or with the same key as budgets:
[] removes them. GET /v1/link/grants shows each plan and key’s spend: spent_usd this month, used_percent for a plan’s most-used window, and reached with resets_at while it is at its limit. When every plan and key of a connection is at its limit, requests get 424 grant_budget_exhausted with resets_at when the first comes back.