Repository navigation
Balance: say whose money the spent amount is - #322
Merged
Merged
Conversation
The enterprise gateway's usage answer now says at the top level whether it is about the key (the key has limits of its own) or the owner user as a whole (it has none). `Spent` gains `scope` and the enterprise reader fills it from that field; other sources leave it empty. A key holder can then tell "this key spent $3.50" from "the account spent $3.50 across its keys". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 10, 2026
Merged
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.
Spentgainsscope: "key" | "user" | null. The enterprise gateway'sGET /v1/usageanswers at the top level whether it is about the key itself (the key has limits of its own: the key's limits and the key's usage) or about the owner user as a whole (the key has none: the user's effective limits and the total across the user's keys); thethinkwatchreader puts that scope on the spent amount. Other sources leave it empty. Part of protocol 46, unreleased.Checks:
cargo clippy --workspace --all-targets -D warnings,cargo test -p tw-gateway,cargo test -p tw-api --features ts,cargo test -p twcore --test msg_codes.🤖 Generated with Claude Code