Repository navigation
Conversation
…port The V2 usage report and its filter-values endpoint gained cloud account and per-resource-type filters, and moved resource IDs to a paginated endpoint, so the SDK's billing filters had fallen behind: - Add cluster_ids and subfilters (job/MMT/deployment tags, assistant message API keys) to BillingActivityFilters and BillingApi. - Return cluster_ids and subfilter values from get_activity_filter_values, dropping resource_ids/resource_ids_truncated, which the server no longer sends. - Add get_activity_filter_resource_names for paging through resource IDs. - Stop sending limit and the pagination cursor to the CSV downloads, which ignore them, and reject tag subfilters there since the download endpoints don't apply them yet. - Fix resource type examples to the raw values the server uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The session and resource download endpoints now read the job, multi-machine job and deployment tag subfilters (grid #47735), so forward them under the same dotted keys the UI uses instead of rejecting them with a ValueError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BillingActivityFilterValues.resource_types now pairs each resource type ID with its display name, read from the server's named_resource_types. Servers that don't send it yet fall back to the legacy raw IDs, named after themselves. Also adds contract tests that run BillingApi through the real generated client, stubbing only the HTTP request, so drift between BillingApi and the vendored client shows up in tests rather than at runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ownload Expose the Reports page's grouped usage data through BillingApi and Organization: - get_activity_group_totals: cost per resource type, user or teamspace, summed over the queried range (/usage-report-rollup/group-totals). - get_activity_group_daily_totals: the same split per UTC day (/usage-report-rollup/group-daily-totals). - get_activity_breakdown: the breakdown CSV download, one row per UTC day, resource type, user and teamspace, as CSV or JSON (/usage-report/download/breakdown). All three take the same filters as the V2 usage report. Adds the BillingActivityGroupBy enum and the BillingActivityGroup* response dataclasses, exports them, and documents them in the organization docs. get_activity now shares its filter kwargs builder with the grouped endpoints. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bmaydan
requested review from
dhedey,
ethanwharris,
justusschock,
k223kim,
owbone,
rusenask and
tejapulagam
as code owners
October 14, 2026 18:11
…ation method Sphinx can't resolve BillingApi, which isn't in the docs, so the docs build failed on the cross-reference. Also applies ruff's pytest.fixture() style to the contract tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Brings the SDK's billing activity APIs in line with the V2 usage report and exposes the Reports page's grouped usage data.
Filters (V2 usage report parity)
cluster_idsandsubfilters(job / multi-machine job / deployment tags, assistant message API keys) toBillingActivityFiltersandBillingApi.get_activity_filter_valuesreturns cluster IDs and subfilter values, and dropsresource_ids/resource_ids_truncated, which the server no longer sends. Newget_activity_filter_resource_namespages through resource IDs.BillingActivityFilterValues.resource_typesnow pairs each type ID with its display name (fromnamed_resource_types), falling back to the raw IDs for older servers.limit/ cursor (ignored server-side) and now forward tag subfilters under the same dotted keys the UI uses.Grouped endpoints
get_activity_group_totals— cost per resource type, user or teamspace over the range (/usage-report-rollup/group-totals).get_activity_group_daily_totals— the same split per UTC day (/usage-report-rollup/group-daily-totals).get_activity_breakdown— the breakdown CSV download, one row per UTC day × resource type × user × teamspace, as CSV or JSON (/usage-report/download/breakdown).BillingActivityGroupByenum andBillingActivityGroup*dataclasses, exported and documented inorganization.rst, withOrganizationwrappers.Tests
test_billing_api_contract.py) that runBillingApithrough the real generated client with only the HTTP request stubbed, so drift against the vendored client fails in tests rather than at runtime.🤖 Generated with Claude Code
— Claude Opus 5.5, on direct instruction; text not reviewed