Skip to content

feat(site/src): add the AI spend overview page shell - #32337

Draft
ssncferreira wants to merge 1 commit into
mainfrom
ssncf/ai-spend-overview-shell
Draft

ssncferreira wants to merge 1 commit into
mainfrom
ssncf/ai-spend-overview-shell

Conversation

@ssncferreira

Copy link
Copy Markdown
Collaborator

Description

Adds the shell of the redesigned AI spend page, the first PR of the Overview tab stack. The page lives at /ai/settings/spend/experimental and is not linked from the sidebar, so the current Spend page stays as is until the redesign replaces it.

Changes

  • Add API.experimental.getOrganizationAISpendOverview and the organizationAISpendOverview query for GET /api/experimental/organizations/{organization}/ai/spend.
  • Add the AISpendPage route, with the header, the organization picker and the tabs. Detailed report stays disabled with a TODO(AIGOV-731).
  • Add a date picker that only picks days, reusing DateRangePicker. The days are kept in the URL as startDate/endDate (YYYY-MM-DD) and sent as whole UTC days, as the endpoint requires. The default is the last 7 days, including today.
  • Handle the paywall, AI Gateway setup, organization loading and access, and overview error states.
  • Add MockOrganizationAISpendOverview, unit tests for the day conversions and the page's requests, and stories for the view states.

Related to AIGOV-732

Stack plan
  1. Page shell (this PR): data layer for the overview endpoint, route, header, organization picker, tabs, day-only date picker in the URL, page states.
  2. Total spend card: the total from /ai/spend, plus the unpriced models from /ai/model-prices/unpriced, which load separately and only for viewers who can read model prices.
  3. Unpriced models popover: the "N models not set up" list with a link to the docs.
  4. Active users and Median spend cards.
  5. AI spend trends chart: daily spend as a bar chart, labelled as UTC days.
  6. Top spenders: the first page of users, a summary sentence, and a menu that links to the user's AI session logs.

Follow-ups, outside this stack: Cost details (after AIGOV-734), Manage AI spend (after #32203), the Detailed report tab (AIGOV-731), and replacing the current Spend page.

Decisions:

  • Days are UTC days because the spend is aggregated per UTC day. A picked calendar day maps to the same UTC day.
  • The default range is not written to the URL, so a shared link without dates resolves against the viewer's today, as on the current page.
  • The overview endpoint returns its first 10 users by default, which the Top spenders card uses.

Note

Generated by Coder Agents on behalf of @ssncferreira.

@ssncferreira
ssncferreira temporarily deployed to main November 17, 2026 21:30 — with GitHub Actions Inactive
@ssncferreira
ssncferreira temporarily deployed to main November 17, 2026 21:30 — with GitHub Actions Inactive
@linear-code

linear-code Bot commented Nov 17, 2026

Copy link
Copy Markdown

AIGOV-732

This branch was previously deployed

1 inactive deployment
main — 17640ebf Deployed Nov 17, 2026 by ssncferreira via community-label #258954
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant