anthropic 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +1 -1
- data/lib/anthropic/client.rb +8 -0
- data/lib/anthropic/helpers/bedrock/client.rb +5 -0
- data/lib/anthropic/helpers/bedrock/mantle_client.rb +5 -0
- data/lib/anthropic/helpers/stainless_helper_header.rb +1 -0
- data/lib/anthropic/helpers/threads/beta_message_thread.rb +635 -0
- data/lib/anthropic/helpers/tools/runner.rb +79 -11
- data/lib/anthropic/helpers/vertex/client.rb +5 -0
- data/lib/anthropic/internal/report_page_cursor.rb +2 -2
- data/lib/anthropic/internal/tracing.rb +2 -0
- data/lib/anthropic/models/anthropic_beta.rb +6 -0
- data/lib/anthropic/models/beta/beta_message_thread_param.rb +61 -0
- data/lib/anthropic/models/beta/beta_thread_continue_params.rb +29 -0
- data/lib/anthropic/models/beta/beta_thread_create_params.rb +21 -0
- data/lib/anthropic/models/beta/message_create_params.rb +13 -1
- data/lib/anthropic/models/beta/messages/batch_create_params.rb +13 -1
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_group.rb +271 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_group_by.rb +40 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_item.rb +57 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_metrics.rb +57 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_cost_order_by.rb +22 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_group.rb +247 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_group_by.rb +38 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_item.rb +57 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_metrics.rb +79 -0
- data/lib/anthropic/models/beta/organization/analytics/beta_analytics_usage_order_by.rb +24 -0
- data/lib/anthropic/models/beta/organization/analytics/cost_list_params.rb +360 -0
- data/lib/anthropic/models/beta/organization/analytics/usage_list_params.rb +353 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_actor.rb +81 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_actor_type.rb +22 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_api_actor.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor.rb +42 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_aws_provider.rb +35 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_azure_provider.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_gcp_provider.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_oidc_provider.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_federated_actor_provider.rb +72 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_grouped_cost_type.rb +21 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_report_user_actor.rb +65 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_service_account_actor.rb +27 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_service_tier.rb +23 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_speed.rb +19 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_time_bucket_width.rb +20 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_usage_cost_inference_geo.rb +19 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_usage_cost_product_filter.rb +34 -0
- data/lib/anthropic/models/beta/organization/beta_analytics_usage_cost_sort_order.rb +19 -0
- data/lib/anthropic/models/beta/organization/beta_organization_rate_limit.rb +2 -1
- data/lib/anthropic/models/beta/organization/beta_plugin.rb +12 -6
- data/lib/anthropic/models/beta/organization/beta_plugin_content_scan.rb +11 -5
- data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit.rb +2 -1
- data/lib/anthropic/models/organization/organization_rate_limit.rb +2 -1
- data/lib/anthropic/models/organization/workspaces/workspace_rate_limit.rb +2 -1
- data/lib/anthropic/resources/beta/messages.rb +78 -4
- data/lib/anthropic/resources/beta/organization/analytics/cost.rb +175 -0
- data/lib/anthropic/resources/beta/organization/analytics/cost_report.rb +13 -6
- data/lib/anthropic/resources/beta/organization/analytics/usage.rb +176 -0
- data/lib/anthropic/resources/beta/organization/analytics/usage_report.rb +9 -2
- data/lib/anthropic/resources/beta/organization/analytics/user_cost_report.rb +12 -5
- data/lib/anthropic/resources/beta/organization/analytics/user_usage_report.rb +15 -8
- data/lib/anthropic/resources/beta/organization/analytics.rb +8 -0
- data/lib/anthropic/resources/beta/organization/plugin_marketplaces.rb +6 -6
- data/lib/anthropic/resources/beta/organization/plugins.rb +12 -9
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +36 -0
- data/rbi/anthropic/client.rbi +5 -0
- data/rbi/anthropic/helpers/bedrock/client.rbi +5 -0
- data/rbi/anthropic/helpers/bedrock/mantle_client.rbi +5 -0
- data/rbi/anthropic/helpers/threads/beta_message_thread.rbi +100 -0
- data/rbi/anthropic/helpers/vertex/client.rbi +5 -0
- data/rbi/anthropic/internal/tracing.rbi +4 -0
- data/rbi/anthropic/models/anthropic_beta.rbi +10 -0
- data/rbi/anthropic/models/beta/beta_message_thread_param.rbi +80 -0
- data/rbi/anthropic/models/beta/beta_thread_continue_params.rbi +43 -0
- data/rbi/anthropic/models/beta/beta_thread_create_params.rbi +31 -0
- data/rbi/anthropic/models/beta/message_create_params.rbi +37 -0
- data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +37 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_group.rbi +439 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_group_by.rbi +140 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_item.rbi +110 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_metrics.rbi +79 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_cost_order_by.rbi +50 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_group.rbi +399 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_group_by.rbi +130 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_item.rbi +110 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_metrics.rbi +120 -0
- data/rbi/anthropic/models/beta/organization/analytics/beta_analytics_usage_order_by.rbi +60 -0
- data/rbi/anthropic/models/beta/organization/analytics/cost_list_params.rbi +624 -0
- data/rbi/anthropic/models/beta/organization/analytics/usage_list_params.rbi +612 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_actor.rbi +134 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_actor_type.rbi +54 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_api_actor.rbi +40 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor.rbi +75 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_aws_provider.rbi +54 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_azure_provider.rbi +42 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_gcp_provider.rbi +42 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_oidc_provider.rbi +42 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_federated_actor_provider.rbi +107 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_grouped_cost_type.rbi +53 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_report_user_actor.rbi +94 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_service_account_actor.rbi +42 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_service_tier.rbi +63 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_speed.rbi +40 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_time_bucket_width.rbi +48 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_usage_cost_inference_geo.rbi +43 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_usage_cost_product_filter.rbi +98 -0
- data/rbi/anthropic/models/beta/organization/beta_analytics_usage_cost_sort_order.rbi +43 -0
- data/rbi/anthropic/models/beta/organization/beta_organization_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/beta/organization/beta_plugin.rbi +20 -8
- data/rbi/anthropic/models/beta/organization/beta_plugin_content_scan.rbi +15 -6
- data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/organization/organization_rate_limit.rbi +4 -2
- data/rbi/anthropic/models/organization/workspaces/workspace_rate_limit.rbi +4 -2
- data/rbi/anthropic/resources/beta/messages.rbi +191 -0
- data/rbi/anthropic/resources/beta/organization/analytics/cost.rbi +245 -0
- data/rbi/anthropic/resources/beta/organization/analytics/cost_report.rbi +12 -5
- data/rbi/anthropic/resources/beta/organization/analytics/usage.rbi +240 -0
- data/rbi/anthropic/resources/beta/organization/analytics/usage_report.rbi +9 -2
- data/rbi/anthropic/resources/beta/organization/analytics/user_cost_report.rbi +12 -5
- data/rbi/anthropic/resources/beta/organization/analytics/user_usage_report.rbi +14 -7
- data/rbi/anthropic/resources/beta/organization/analytics.rbi +10 -0
- data/rbi/anthropic/resources/beta/organization/plugin_marketplaces.rbi +6 -6
- data/rbi/anthropic/resources/beta/organization/plugins.rbi +12 -9
- data/rbi/lib/anthropic/helpers/stainless_helper_header.rbi +2 -0
- data/sig/anthropic/client.rbs +2 -0
- data/sig/anthropic/helpers/bedrock/client.rbs +2 -0
- data/sig/anthropic/helpers/threads/beta_message_thread.rbs +40 -0
- data/sig/anthropic/helpers/tools/runner.rbs +40 -0
- data/sig/anthropic/helpers/vertex/client.rbs +2 -0
- data/sig/anthropic/internal/tracing.rbs +2 -0
- data/sig/anthropic/models/anthropic_beta.rbs +4 -0
- data/sig/anthropic/models/beta/beta_message_thread_param.rbs +40 -0
- data/sig/anthropic/models/beta/beta_thread_continue_params.rbs +20 -0
- data/sig/anthropic/models/beta/beta_thread_create_params.rbs +17 -0
- data/sig/anthropic/models/beta/message_create_params.rbs +5 -0
- data/sig/anthropic/models/beta/messages/batch_create_params.rbs +5 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_group.rbs +126 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_group_by.rbs +60 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_item.rbs +41 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_metrics.rbs +41 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_cost_order_by.rbs +21 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_group.rbs +116 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_group_by.rbs +56 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_item.rbs +41 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_metrics.rbs +56 -0
- data/sig/anthropic/models/beta/organization/analytics/beta_analytics_usage_order_by.rbs +28 -0
- data/sig/anthropic/models/beta/organization/analytics/cost_list_params.rbs +188 -0
- data/sig/anthropic/models/beta/organization/analytics/usage_list_params.rbs +188 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_actor.rbs +67 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_actor_type.rbs +21 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_api_actor.rbs +19 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor.rbs +34 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_aws_provider.rbs +30 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_azure_provider.rbs +20 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_gcp_provider.rbs +20 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_oidc_provider.rbs +20 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_federated_actor_provider.rbs +60 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_grouped_cost_type.rbs +21 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_report_user_actor.rbs +44 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_service_account_actor.rbs +26 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_service_tier.rbs +28 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_speed.rbs +18 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_time_bucket_width.rbs +19 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_usage_cost_inference_geo.rbs +18 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_usage_cost_product_filter.rbs +40 -0
- data/sig/anthropic/models/beta/organization/beta_analytics_usage_cost_sort_order.rbs +18 -0
- data/sig/anthropic/resources/beta/messages.rbs +33 -0
- data/sig/anthropic/resources/beta/organization/analytics/cost.rbs +46 -0
- data/sig/anthropic/resources/beta/organization/analytics/usage.rbs +46 -0
- data/sig/anthropic/resources/beta/organization/analytics.rbs +4 -0
- metadata +111 -2
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
module Beta
|
|
6
|
+
module Organization
|
|
7
|
+
module Analytics
|
|
8
|
+
# @see Anthropic::Resources::Beta::Organization::Analytics::Cost#list
|
|
9
|
+
class CostListParams < Anthropic::Internal::Type::BaseModel
|
|
10
|
+
extend Anthropic::Internal::Type::RequestParameters::Converter
|
|
11
|
+
include Anthropic::Internal::Type::RequestParameters
|
|
12
|
+
|
|
13
|
+
# @!attribute starting_at
|
|
14
|
+
# Start of range, inclusive. RFC 3339 tz-aware. Must be within the last 365 days
|
|
15
|
+
# and no earlier than 2026-01-01T00:00:00Z.
|
|
16
|
+
#
|
|
17
|
+
# @return [Time]
|
|
18
|
+
required :starting_at, Time
|
|
19
|
+
|
|
20
|
+
# @!attribute actor_ids
|
|
21
|
+
# Filter to usage attributed to specific identities, by tagged ID: a `user_...`,
|
|
22
|
+
# `svac_...` (service account), or `apikey_...` ID. An `apikey_` entry matches
|
|
23
|
+
# only usage attributed to the key itself, not usage on that key attributed to a
|
|
24
|
+
# user or service account (use `api_key_ids[]` for every request a key
|
|
25
|
+
# authenticated). Federated identities have no tagged ID; select them with
|
|
26
|
+
# `actor_types[]`. Use `group_by[]=actor` to break out per-identity values.
|
|
27
|
+
#
|
|
28
|
+
# @return [Array<String>, nil]
|
|
29
|
+
optional :actor_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
30
|
+
|
|
31
|
+
# @!attribute actor_types
|
|
32
|
+
# Filter to usage attributed to specific kinds of identity. Use
|
|
33
|
+
# `group_by[]=actor_type` to break out per-kind values.
|
|
34
|
+
#
|
|
35
|
+
# @return [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsActorType>, nil]
|
|
36
|
+
optional :actor_types,
|
|
37
|
+
-> {
|
|
38
|
+
Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::Organization::BetaAnalyticsActorType]
|
|
39
|
+
},
|
|
40
|
+
nil?: true
|
|
41
|
+
|
|
42
|
+
# @!attribute agent_ids
|
|
43
|
+
# Filter to usage incurred by sessions of specific Claude Managed Agents agents.
|
|
44
|
+
# Use `group_by[]=agent_id` to break out per-agent values. Claude Developer
|
|
45
|
+
# Platform organizations only.
|
|
46
|
+
#
|
|
47
|
+
# @return [Array<String>, nil]
|
|
48
|
+
optional :agent_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
49
|
+
|
|
50
|
+
# @!attribute api_key_ids
|
|
51
|
+
# Filter to usage authenticated by specific API keys, by tagged API key ID
|
|
52
|
+
# (`apikey_...`), whichever identity the usage is attributed to. Include an empty
|
|
53
|
+
# entry (`api_key_ids[]=`) to also match usage that no API key authenticated. Use
|
|
54
|
+
# `group_by[]=api_key_id` to break out per-key values; usage without a key has a
|
|
55
|
+
# null `api_key_id`. Claude Developer Platform organizations only.
|
|
56
|
+
#
|
|
57
|
+
# @return [Array<String>, nil]
|
|
58
|
+
optional :api_key_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
59
|
+
|
|
60
|
+
# @!attribute claude_tag_categories
|
|
61
|
+
# Filter to Claude Tag (Claude in Slack) usage in specific spend categories. Usage
|
|
62
|
+
# with no category never matches. `dm` usage is reported under the user's product
|
|
63
|
+
# rather than `claude_tag`, so combining this filter with `products[]=claude_tag`
|
|
64
|
+
# excludes it. Use `group_by[]=claude_tag_category` to break out per-category
|
|
65
|
+
# values.
|
|
66
|
+
#
|
|
67
|
+
# @return [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsClaudeTagCategory>, nil]
|
|
68
|
+
optional :claude_tag_categories,
|
|
69
|
+
-> {
|
|
70
|
+
Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::Organization::BetaAnalyticsClaudeTagCategory]
|
|
71
|
+
},
|
|
72
|
+
nil?: true
|
|
73
|
+
|
|
74
|
+
# @!attribute claude_tag_user_ids
|
|
75
|
+
# Filter to Claude Tag (Claude in Slack) usage attributed to specific Slack users,
|
|
76
|
+
# by Slack user ID (for example `U0123ABCDEF`), not claude.ai user ID. Usage that
|
|
77
|
+
# is not Claude Tag, and Claude Tag usage not attributed to a single user, never
|
|
78
|
+
# matches. Use `group_by[]=claude_tag_user_id` to break out per-user values.
|
|
79
|
+
#
|
|
80
|
+
# @return [Array<String>, nil]
|
|
81
|
+
optional :claude_tag_user_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
82
|
+
|
|
83
|
+
# @!attribute context_windows
|
|
84
|
+
# Filter to specific context-window pricing tiers. Use `group_by[]=context_window`
|
|
85
|
+
# to break out per-tier values.
|
|
86
|
+
#
|
|
87
|
+
# @return [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsContextWindow>, nil]
|
|
88
|
+
optional :context_windows,
|
|
89
|
+
-> {
|
|
90
|
+
Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::Organization::BetaAnalyticsContextWindow]
|
|
91
|
+
},
|
|
92
|
+
nil?: true
|
|
93
|
+
|
|
94
|
+
# @!attribute deployment_ids
|
|
95
|
+
# Filter to usage incurred by Claude Managed Agents sessions that specific
|
|
96
|
+
# deployments started. Use `group_by[]=deployment_id` to break out per-deployment
|
|
97
|
+
# values. Claude Developer Platform organizations only.
|
|
98
|
+
#
|
|
99
|
+
# @return [Array<String>, nil]
|
|
100
|
+
optional :deployment_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
101
|
+
|
|
102
|
+
# @!attribute ending_at
|
|
103
|
+
# End of range, exclusive. Required when `time_bucket_width` is set. Without
|
|
104
|
+
# `time_bucket_width`, defaults to the earlier of now and `starting_at` + 31 days.
|
|
105
|
+
# The range may span at most 31 days.
|
|
106
|
+
#
|
|
107
|
+
# @return [Time, nil]
|
|
108
|
+
optional :ending_at, Time, nil?: true
|
|
109
|
+
|
|
110
|
+
# @!attribute environment_ids
|
|
111
|
+
# Filter to usage incurred by Claude Managed Agents sessions that ran in specific
|
|
112
|
+
# environments. Use `group_by[]=environment_id` to break out per-environment
|
|
113
|
+
# values. Claude Developer Platform organizations only.
|
|
114
|
+
#
|
|
115
|
+
# @return [Array<String>, nil]
|
|
116
|
+
optional :environment_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
117
|
+
|
|
118
|
+
# @!attribute exclude_deleted_users
|
|
119
|
+
# If true, omit rows whose `actor` is a `user_actor` with `deleted: true`.
|
|
120
|
+
# Requires `group_by[]=actor`. Rows for other actor types, and rows whose `actor`
|
|
121
|
+
# is null, are always kept. A page may contain fewer than `limit` rows; use
|
|
122
|
+
# `has_more` and `next_page` to paginate as usual.
|
|
123
|
+
#
|
|
124
|
+
# @return [Boolean, nil]
|
|
125
|
+
optional :exclude_deleted_users, Anthropic::Internal::Type::Boolean
|
|
126
|
+
|
|
127
|
+
# @!attribute group_by
|
|
128
|
+
# Dimensions to break cost out by (at most 5, not counting `cost_type` and
|
|
129
|
+
# `token_type`): one row per combination of their values with cost in the range
|
|
130
|
+
# (and per time bucket, when `time_bucket_width` is set), every combination
|
|
131
|
+
# returned across pages rather than a capped top set. `cost_type` and `token_type`
|
|
132
|
+
# do not count toward `limit`: `cost_type` returns one row per cost component
|
|
133
|
+
# (tokens, web search, code execution, and `session_usage`, Claude Managed Agents
|
|
134
|
+
# session time); `token_type` returns one row per token type, each with
|
|
135
|
+
# `cost_type: "tokens"`; combining both returns the per-token-type rows plus the
|
|
136
|
+
# web-search, code-execution and session-usage rows. When omitted, a single row
|
|
137
|
+
# aggregates the whole range.
|
|
138
|
+
#
|
|
139
|
+
# @return [Array<Symbol, Anthropic::Models::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy>, nil]
|
|
140
|
+
optional :group_by,
|
|
141
|
+
-> {
|
|
142
|
+
Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy]
|
|
143
|
+
},
|
|
144
|
+
nil?: true
|
|
145
|
+
|
|
146
|
+
# @!attribute inference_geos
|
|
147
|
+
# Filter to specific inference regions. `not_available` matches rows where the
|
|
148
|
+
# region is unset. Use `group_by[]=inference_geo` to break out per-region values.
|
|
149
|
+
#
|
|
150
|
+
# @return [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsInferenceGeoFilter>, nil]
|
|
151
|
+
optional :inference_geos,
|
|
152
|
+
-> {
|
|
153
|
+
Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::Organization::BetaAnalyticsInferenceGeoFilter]
|
|
154
|
+
},
|
|
155
|
+
nil?: true
|
|
156
|
+
|
|
157
|
+
# @!attribute limit
|
|
158
|
+
# Number of rows per page (1-1000, default 20). `cost_type`/`token_type` fan-out
|
|
159
|
+
# rows (cost endpoint only) do not count toward this limit, so `data` can exceed
|
|
160
|
+
# it.
|
|
161
|
+
#
|
|
162
|
+
# @return [Integer, nil]
|
|
163
|
+
optional :limit, Integer
|
|
164
|
+
|
|
165
|
+
# @!attribute models
|
|
166
|
+
# Models to include. Defaults to all models. Use `group_by[]=model` to break out
|
|
167
|
+
# per-model values.
|
|
168
|
+
#
|
|
169
|
+
# @return [Array<String>, nil]
|
|
170
|
+
optional :models, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
171
|
+
|
|
172
|
+
# @!attribute order
|
|
173
|
+
# Sort direction of the `order_by` metric, or of the time buckets when `order_by`
|
|
174
|
+
# is `time` and `time_bucket_width` is set. Defaults to `desc`.
|
|
175
|
+
#
|
|
176
|
+
# @return [Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsUsageCostSortOrder, nil]
|
|
177
|
+
optional :order, enum: -> { Anthropic::Beta::Organization::BetaAnalyticsUsageCostSortOrder }
|
|
178
|
+
|
|
179
|
+
# @!attribute order_by
|
|
180
|
+
# Row order. A metric ranks rows by that metric in the `order` direction. `time`
|
|
181
|
+
# orders rows by time bucket in the `order` direction (newest first by default)
|
|
182
|
+
# and, within a bucket, by `amount`, highest first. `time` takes effect only with
|
|
183
|
+
# `time_bucket_width`; without it, `time` is the same as `amount`. Defaults to
|
|
184
|
+
# `amount`.
|
|
185
|
+
#
|
|
186
|
+
# @return [Symbol, Anthropic::Models::Beta::Organization::Analytics::BetaAnalyticsCostOrderBy, nil]
|
|
187
|
+
optional :order_by, enum: -> { Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostOrderBy }
|
|
188
|
+
|
|
189
|
+
# @!attribute page
|
|
190
|
+
# Opaque cursor from a previous response's `next_page` field.
|
|
191
|
+
#
|
|
192
|
+
# @return [String, nil]
|
|
193
|
+
optional :page, String, nil?: true
|
|
194
|
+
|
|
195
|
+
# @!attribute products
|
|
196
|
+
# Product surfaces to include. Defaults to all products.
|
|
197
|
+
#
|
|
198
|
+
# @return [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsUsageCostProductFilter>, nil]
|
|
199
|
+
optional :products,
|
|
200
|
+
-> {
|
|
201
|
+
Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::Organization::BetaAnalyticsUsageCostProductFilter]
|
|
202
|
+
},
|
|
203
|
+
nil?: true
|
|
204
|
+
|
|
205
|
+
# @!attribute rbac_group_ids
|
|
206
|
+
# Filter to usage attributed to specific RBAC groups. Accepts tagged RBAC group
|
|
207
|
+
# IDs (`rbac_group_...`) or bare group UUIDs. A row matches when the user belonged
|
|
208
|
+
# to any of the listed groups on the (UTC) day the usage occurred; usage with no
|
|
209
|
+
# group attribution never matches.
|
|
210
|
+
#
|
|
211
|
+
# @return [Array<String>, nil]
|
|
212
|
+
optional :rbac_group_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
213
|
+
|
|
214
|
+
# @!attribute service_tiers
|
|
215
|
+
# Filter to specific service tiers. Use `group_by[]=service_tier` to break out
|
|
216
|
+
# per-tier values. Claude Developer Platform organizations only; matches nothing
|
|
217
|
+
# for a Claude Enterprise organization.
|
|
218
|
+
#
|
|
219
|
+
# @return [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsServiceTier>, nil]
|
|
220
|
+
optional :service_tiers,
|
|
221
|
+
-> {
|
|
222
|
+
Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::Organization::BetaAnalyticsServiceTier]
|
|
223
|
+
},
|
|
224
|
+
nil?: true
|
|
225
|
+
|
|
226
|
+
# @!attribute session_ids
|
|
227
|
+
# Filter to usage incurred by specific Claude Managed Agents sessions, by tagged
|
|
228
|
+
# session ID (`sesn_...`). Use `group_by[]=session_id` to break out per-session
|
|
229
|
+
# values. Claude Developer Platform organizations only.
|
|
230
|
+
#
|
|
231
|
+
# @return [Array<String>, nil]
|
|
232
|
+
optional :session_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
233
|
+
|
|
234
|
+
# @!attribute slack_channel_ids
|
|
235
|
+
# Filter to usage originating from specific Slack channels. Use
|
|
236
|
+
# `group_by[]=slack_channel_id` to break out per-channel values.
|
|
237
|
+
#
|
|
238
|
+
# @return [Array<String>, nil]
|
|
239
|
+
optional :slack_channel_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
240
|
+
|
|
241
|
+
# @!attribute speeds
|
|
242
|
+
# Filter to fast or standard inference mode. Use `group_by[]=speed` to break out
|
|
243
|
+
# per-mode values.
|
|
244
|
+
#
|
|
245
|
+
# @return [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsSpeed>, nil]
|
|
246
|
+
optional :speeds,
|
|
247
|
+
-> {
|
|
248
|
+
Anthropic::Internal::Type::ArrayOf[enum: Anthropic::Beta::Organization::BetaAnalyticsSpeed]
|
|
249
|
+
},
|
|
250
|
+
nil?: true
|
|
251
|
+
|
|
252
|
+
# @!attribute time_bucket_width
|
|
253
|
+
# Time-bucket granularity. When set, rows are returned per time bucket (one per
|
|
254
|
+
# bucket and dimension combination with usage) and each row's `starting_at` and
|
|
255
|
+
# `ending_at` are that bucket's bounds; the time bucket counts toward `limit`.
|
|
256
|
+
# `ending_at` is required when `time_bucket_width` is set, and with
|
|
257
|
+
# `time_bucket_width="1m"` the range may span at most 24 hours. When omitted, each
|
|
258
|
+
# row aggregates the requested range with `starting_at` and `ending_at` each
|
|
259
|
+
# rounded down to the hour.
|
|
260
|
+
#
|
|
261
|
+
# @return [Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsTimeBucketWidth, nil]
|
|
262
|
+
optional :time_bucket_width,
|
|
263
|
+
enum: -> { Anthropic::Beta::Organization::BetaAnalyticsTimeBucketWidth },
|
|
264
|
+
nil?: true
|
|
265
|
+
|
|
266
|
+
# @!attribute user_profile_ids
|
|
267
|
+
# Filter to usage attributed to specific user profiles, by tagged user profile ID
|
|
268
|
+
# (`uprof_...`). Use `group_by[]=user_profile_id` to break out per-profile values.
|
|
269
|
+
# Claude Developer Platform organizations only.
|
|
270
|
+
#
|
|
271
|
+
# @return [Array<String>, nil]
|
|
272
|
+
optional :user_profile_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
273
|
+
|
|
274
|
+
# @!attribute workspace_ids
|
|
275
|
+
# Filter to usage in specific workspaces, by tagged workspace ID (`wrkspc_...`).
|
|
276
|
+
# Use `group_by[]=workspace_id` to break out per-workspace values. Claude
|
|
277
|
+
# Developer Platform organizations only; matches nothing for a Claude Enterprise
|
|
278
|
+
# organization.
|
|
279
|
+
#
|
|
280
|
+
# @return [Array<String>, nil]
|
|
281
|
+
optional :workspace_ids, Anthropic::Internal::Type::ArrayOf[String], nil?: true
|
|
282
|
+
|
|
283
|
+
# @!attribute betas
|
|
284
|
+
# This endpoint is in beta: requests must send `analytics-usage-cost-2026-08-24`
|
|
285
|
+
# in this header.
|
|
286
|
+
#
|
|
287
|
+
# @return [Array<Symbol, String, Anthropic::Models::AnthropicBeta>, nil]
|
|
288
|
+
optional :betas, -> { Anthropic::Internal::Type::ArrayOf[union: Anthropic::AnthropicBeta] }
|
|
289
|
+
|
|
290
|
+
# @!method initialize(starting_at:, actor_ids: nil, actor_types: nil, agent_ids: nil, api_key_ids: nil, claude_tag_categories: nil, claude_tag_user_ids: nil, context_windows: nil, deployment_ids: nil, ending_at: nil, environment_ids: nil, exclude_deleted_users: nil, group_by: nil, inference_geos: nil, limit: nil, models: nil, order: nil, order_by: nil, page: nil, products: nil, rbac_group_ids: nil, service_tiers: nil, session_ids: nil, slack_channel_ids: nil, speeds: nil, time_bucket_width: nil, user_profile_ids: nil, workspace_ids: nil, betas: nil, request_options: {})
|
|
291
|
+
# Some parameter documentations has been truncated, see
|
|
292
|
+
# {Anthropic::Models::Beta::Organization::Analytics::CostListParams} for more
|
|
293
|
+
# details.
|
|
294
|
+
#
|
|
295
|
+
# @param starting_at [Time] Start of range, inclusive. RFC 3339 tz-aware. Must be within the last 365 days a
|
|
296
|
+
#
|
|
297
|
+
# @param actor_ids [Array<String>, nil] Filter to usage attributed to specific identities, by tagged ID: a `user_...`, `
|
|
298
|
+
#
|
|
299
|
+
# @param actor_types [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsActorType>, nil] Filter to usage attributed to specific kinds of identity. Use `group*by[]=actor*
|
|
300
|
+
#
|
|
301
|
+
# @param agent_ids [Array<String>, nil] Filter to usage incurred by sessions of specific Claude Managed Agents agents. U
|
|
302
|
+
#
|
|
303
|
+
# @param api_key_ids [Array<String>, nil] Filter to usage authenticated by specific API keys, by tagged API key ID (`apike
|
|
304
|
+
#
|
|
305
|
+
# @param claude_tag_categories [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsClaudeTagCategory>, nil] Filter to Claude Tag (Claude in Slack) usage in specific spend categories. Usage
|
|
306
|
+
#
|
|
307
|
+
# @param claude_tag_user_ids [Array<String>, nil] Filter to Claude Tag (Claude in Slack) usage attributed to specific Slack users,
|
|
308
|
+
#
|
|
309
|
+
# @param context_windows [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsContextWindow>, nil] Filter to specific context-window pricing tiers. Use `group_by[]=context_window`
|
|
310
|
+
#
|
|
311
|
+
# @param deployment_ids [Array<String>, nil] Filter to usage incurred by Claude Managed Agents sessions that specific deploym
|
|
312
|
+
#
|
|
313
|
+
# @param ending_at [Time, nil] End of range, exclusive. Required when `time_bucket_width` is set. Without `time
|
|
314
|
+
#
|
|
315
|
+
# @param environment_ids [Array<String>, nil] Filter to usage incurred by Claude Managed Agents sessions that ran in specific
|
|
316
|
+
#
|
|
317
|
+
# @param exclude_deleted_users [Boolean] If true, omit rows whose `actor` is a `user_actor` with `deleted: true`. Require
|
|
318
|
+
#
|
|
319
|
+
# @param group_by [Array<Symbol, Anthropic::Models::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy>, nil] Dimensions to break cost out by (at most 5, not counting `cost_type` and
|
|
320
|
+
# `token\_
|
|
321
|
+
#
|
|
322
|
+
# @param inference_geos [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsInferenceGeoFilter>, nil] Filter to specific inference regions. `not_available` matches rows where the reg
|
|
323
|
+
#
|
|
324
|
+
# @param limit [Integer] Number of rows per page (1-1000, default 20). `cost_type`/`token_type` fan-out r
|
|
325
|
+
#
|
|
326
|
+
# @param models [Array<String>, nil] Models to include. Defaults to all models. Use `group_by[]=model` to break out p
|
|
327
|
+
#
|
|
328
|
+
# @param order [Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsUsageCostSortOrder] Sort direction of the `order_by` metric, or of the time buckets when `order_by`
|
|
329
|
+
#
|
|
330
|
+
# @param order_by [Symbol, Anthropic::Models::Beta::Organization::Analytics::BetaAnalyticsCostOrderBy] Row order. A metric ranks rows by that metric in the `order` direction. `time` o
|
|
331
|
+
#
|
|
332
|
+
# @param page [String, nil] Opaque cursor from a previous response's `next_page` field.
|
|
333
|
+
#
|
|
334
|
+
# @param products [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsUsageCostProductFilter>, nil] Product surfaces to include. Defaults to all products.
|
|
335
|
+
#
|
|
336
|
+
# @param rbac_group_ids [Array<String>, nil] Filter to usage attributed to specific RBAC groups. Accepts tagged RBAC group ID
|
|
337
|
+
#
|
|
338
|
+
# @param service_tiers [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsServiceTier>, nil] Filter to specific service tiers. Use `group_by[]=service_tier` to break out per
|
|
339
|
+
#
|
|
340
|
+
# @param session_ids [Array<String>, nil] Filter to usage incurred by specific Claude Managed Agents sessions, by tagged s
|
|
341
|
+
#
|
|
342
|
+
# @param slack_channel_ids [Array<String>, nil] Filter to usage originating from specific Slack channels. Use `group*by[]=slack*
|
|
343
|
+
#
|
|
344
|
+
# @param speeds [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsSpeed>, nil] Filter to fast or standard inference mode. Use `group_by[]=speed` to break out p
|
|
345
|
+
#
|
|
346
|
+
# @param time_bucket_width [Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsTimeBucketWidth, nil] Time-bucket granularity. When set, rows are returned per time bucket (one per bu
|
|
347
|
+
#
|
|
348
|
+
# @param user_profile_ids [Array<String>, nil] Filter to usage attributed to specific user profiles, by tagged user profile ID
|
|
349
|
+
#
|
|
350
|
+
# @param workspace_ids [Array<String>, nil] Filter to usage in specific workspaces, by tagged workspace ID (`wrkspc_...`). U
|
|
351
|
+
#
|
|
352
|
+
# @param betas [Array<Symbol, String, Anthropic::Models::AnthropicBeta>] This endpoint is in beta: requests must send `analytics-usage-cost-2026-08-24` i
|
|
353
|
+
#
|
|
354
|
+
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}]
|
|
355
|
+
end
|
|
356
|
+
end
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
end
|
|
360
|
+
end
|