Repository navigation
feat(den): add My Usage page for every member - #7414
Merged
Merged
Conversation
Members see their own AI Gateway spend limits, past 30 days of usage by model, and what each model they can use would have cost them, in Den Web (Observability › My Usage) and in the desktop Usage settings. - den-api: GET /v1/gateway/usage/me, scoped to the caller, audited as gateway_usage.read_own; reuses the admin usage report and adds the member's token mix and usable models with listed prices. - @openwork/types/den/gateway-member-usage: shared figures, cost comparison and limit copy for Den Web and the desktop. Closes #7390
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this about?
A My Usage page in Den Web (Observability › My Usage) and two new sections in the desktop app's Settings › Usage, where any member sees their own AI Gateway usage. Closes #7390.
What problem does it solve?
Members couldn't answer "how much have I used, how close am I to my limit, and which model is cheaper for what I do?" without asking an admin.
What was the situation before?
Den Web had no member view of usage; the Observability section was hidden for most members. The desktop Usage settings only showed limit buckets, with no spend history and no prices.
How is this implemented?
GET /v1/gateway/usage/me(ee/apps/den-api/src/routes/org/gateway-usage.ts):orgMemberRoute(), auditedgateway_usage.read_own. ReusesreadGatewayUsagewith the caller's membership forced, plus their token mix and usable models with listed prices. Onlydaysis accepted.@openwork/types/den/gateway-member-usage: response schema, metrics, cost comparison (token mix × price, cache and context tiers) and the limit copy, shared by Den Web and the desktop.dashboard/my-usagewith Spend limits (incl. ask for more), Past 30 days (stat strip, daily chart, per model) and Models you can use.gateway-member-usage-section.tsxunder the limits; hidden when an older Den answers 404.packages/docs/ai-gateway/my-usage.mdx.Not behind a feature flag, by request.
What else changed?
gateway-usage-state.tsnow re-export the shared module.Release note
Every member can now see their own AI Gateway spend limits, past 30 days of usage, and what each model they can use would cost them, under My Usage.
Evidence
evals/proofs/member-usage-page.proof.test.ts: a regular member opens Observability › My Usage and sees their $4.08 of $20.00 limit, 30-day totals matching their seeded requests, the chart switching cost/tokens, priced usable models with estimates, and none of a teammate's usage. Alsotest/api/gateway-usage-me.api.test.tsandmy-usage-data.test.ts.Design: P1, P5, S1, S6, C5, C6