wv_ key you use for the rest of the Weave API. Send it in the X-API-Key header. The organization always comes from the key.
{user} is either the engineer’s router user ID or their email address. Emails match case-insensitively. If one email belongs to more than one router user in your organization, the API answers 409 and you use the router user ID instead.
A key that only manages spend can hold read and budgets without write. Create keys under Settings → API keys.
Export usage
GET /router/usage returns one row per UTC day for each combination of the dimensions you group by: user, api_key, served_model and requested_model. A dimension you did not group by is null. The range is at most 92 days, end inclusive.
next_cursor back as cursor until it is null, keeping the other filters and groupings unchanged. Pages are not a snapshot; late-arriving usage may cause rows to repeat or be missed while paging. For reconciliation, re-fetch settled date ranges and replace each day’s aggregates rather than appending them.
With reporting anonymization on, user and api_key groupings and the emails and api_key_ids filters are not available. If you omit group_by, usage is grouped by served and requested model only.
Two cost columns come back, and they answer different questions:
cost_usd_microsis the billed cost: what the router charged,0for turns an engineer’s own subscription covered. This is the number that reconciles against your Weave invoice and, for bring-your-own-key traffic, your provider invoices.api_rate_cost_usd_microsprices every turn at catalog API rates, subscription-covered turns included. It measures consumption, not spend.
GET /metrics?metric=router_cost&group_by=router_cost_type, which returns an actual and a comparison row for each period. See how savings are calculated.
Raise an engineer’s limit from Slack
A grant adds headroom on top of an engineer’s monthly limit for the current UTC month only. It expires at the month boundary, leaves the engineer’s base limit alone, and never lifts the organization-wide cap. A grant has no effect while the engineer is uncapped. A typical approval flow:- Subscribe a webhook to
router_spend_alert. It firesrouter_spend_limit.approachingandrouter_spend_limit.reachedwith the engineer’suser_emailand a stable alertid. - Your Slack bot asks the engineer’s manager to approve more headroom.
- On approval, the bot checks that the alert’s
monthis still the current UTC month. After rollover, request a new approval instead of submitting the old grant. Use the alertidas theIdempotency-Keyso a retried request cannot grant twice:
201. Repeating a key returns the original grant with 200 and adds nothing. The response’s user.remaining_usd_micros is the engineer’s headroom for the rest of the month.
Audit limit changes
GET /router/spend-limits/history lists every change, newest first: org limit changes, engineer limits set or cleared, and grants. Each entry has the old and new values, the reason and approver when given, and the actor’s stable ID: actor_api_key_id for API writes or actor_account_id for changes made in the app. The current key name, when available, is a display label in actor_api_key_name. The key ID remains in history after revocation. Filter by user, since and until, and resend those same filters when paging with cursor.
The
ra_ analytics keys and the router’s /v1/analytics/* routes are deprecated. Existing keys keep working for now, but new ones can no longer be issued. Use GET /router/usage for usage, or see the analytics export if you still read raw routing decisions.