feat (provider/gateway): add spend reporting support#13841
Merged
Conversation
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
4 tasks
dancer
approved these changes
Mar 26, 2026
felixarntz
approved these changes
Mar 26, 2026
mclenhard
approved these changes
Mar 26, 2026
6f6e9bf to
fdaacea
Compare
d574905 to
f01df16
Compare
Contributor
|
|
shaper
added a commit
that referenced
this pull request
Mar 26, 2026
This is an automated backport of #13841 to the release-v6.0 branch. FYI @shaper This backport has conflicts that need to be resolved manually. ### `git cherry-pick` output ``` Auto-merging content/providers/01-ai-sdk-providers/00-ai-gateway.mdx CONFLICT (content): Merge conflict in content/providers/01-ai-sdk-providers/00-ai-gateway.mdx Auto-merging packages/gateway/src/gateway-provider.ts error: could not apply d30466c... feat (provider/gateway): add spend reporting support (#13841) hint: After resolving the conflicts, mark them with hint: "git add/rm <pathspec>", then run hint: "git cherry-pick --continue". hint: You can instead skip this commit with "git cherry-pick --skip". hint: To abort and get back to the state before "git cherry-pick", hint: run "git cherry-pick --abort". hint: Disable this message with "git config set advice.mergeConflict false" ``` --------- Co-authored-by: Walter Korman <shaper@vercel.com>
Contributor
|
🚀 Published in:
|
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.

Background
The AI Gateway provider needed programmatic access to spend reporting data to enable developers to query usage metrics, costs, and token consumption for their AI applications.
Summary
Added spend reporting support to the AI Gateway provider with a new
getSpendReport()method that allows querying cost, token, and request count data aggregated by various dimensions like model, user, tag, provider, or credential type.Key changes:
GatewaySpendReportclass to handle API requests to the/v1/reportendpointgetSpendReport()method on the gateway provider with support for filtering by date range, user, model, tags, and other parametersManual Verification
Tested the spend reporting functionality by:
Checklist
pnpm changesetin the project root)