Repository navigation
feat: add organization AI spend report types and client methods - #29223
Conversation
Docs previewCheck off each page once it's been reviewed. If a page changes in a later push, its checkbox clears automatically so it gets a fresh look. Pages not yet wired into the docs navigation aren't listed here. |
2771be8 to
dc7b500
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
dc7b500 to
07c3acd
Compare
07c3acd to
dcaab5d
Compare
|
This PR was reworked in place on 2026-09-15: the stack now extends the released organization spend export ( @codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dcaab5d0b1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
dcaab5d to
8fbedad
Compare
|
Pushed fixes for the review round (see the resolved threads for details). @codex review
|
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
8fbedad to
4c5c20a
Compare
4c5c20a to
1bba66b
Compare
1bba66b to
1ecb60b
Compare
|
Pushed fixes for the human review round (report totals moved into a @codex review
|
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Add OrganizationAISpendFilter, which carries the period plus the optional
provider_name, model, and client dimensions for the per-user organization
AI spend report, and OrganizationAISpendReport and OrganizationAISpendUser,
its paginated JSON representation. OrganizationAISpendUsers requests it
from GET /organizations/{organization}/ai/spend/users. The CSV export
client method is unchanged.
The server side follows in the next change.
Move the report's total cost and unpriced usage count into a totals object.
Each user in the organization AI spend report lists the models they spent through, sorted, next to providers and clients.
1ecb60b to
c90e9a1
Compare
|
Pushed the @codex review
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c90e9a1ccd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The users endpoint pages by limit and offset, so the SDK method takes an OrganizationAISpendPage instead of Pagination, whose AfterID cursor the endpoint rejects as an unknown parameter.
|
Pushed the offset-only page type (14d0797). @codex review
|
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Second of a four-PR stack that reworks the AI spend page onto the released organization spend export,
GET /api/v2/organizations/{organization}/ai/spend/export, and a sibling per-user endpoint,GET /api/v2/organizations/{organization}/ai/spend/users, instead of the deployment-wide/api/v2/ai-gateway/spend/*endpoints this stack previously proposed. Every PR in the stack was rewritten in place from current main; the head branch name predates the rework. The export's accounting rules are unchanged: token usage bycreated_atin[period_start, period_end), attributed to the organization through the effective budget group, so the page reconciles with the CSV and with daily budget accounting.Adds the SDK types for the per-user report:
OrganizationAISpendFilter(an optional period plus the three dimension filters, so the generated TypeScript type accepts the server default period),OrganizationAISpendUser(cost, unpriced usage count, models, and the providers and clients the user spent through), andOrganizationAISpendReport(the applied period, the retention window start when the deployment purges AI Gateway data, atotalsobject with the cost and unpriced usage count over every matching user, and one page of users). The newOrganizationAISpendUsersmethod requests/ai/spend/userswith pagination and decodes the report.ExportOrganizationAISpendis unchanged.Includes the regenerated
typesGenerated.ts.Codex on c90e9a1: P2, the SDK method took
Pagination, whoseAfterIDcursor the endpoint rejects; fixed in 14d0797 with an offset-onlyOrganizationAISpendPage.