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,439 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
module Beta
|
|
6
|
+
module Organization
|
|
7
|
+
module Analytics
|
|
8
|
+
class BetaAnalyticsCostGroup < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroup,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The identity the usage is attributed to: the user if one is attributed, else the
|
|
18
|
+
# service account, else the federated (cloud-platform) identity, else the API key.
|
|
19
|
+
# Populated only when `actor` is in `group_by[]`; null for usage with no
|
|
20
|
+
# attributable identity, and for users' and federated identities' usage when the
|
|
21
|
+
# reader is a member who can see only some workspaces. Distinct identities the
|
|
22
|
+
# server cannot render also read null, each as its own row.
|
|
23
|
+
sig do
|
|
24
|
+
returns(
|
|
25
|
+
T.nilable(
|
|
26
|
+
Anthropic::Beta::Organization::BetaAnalyticsActor::Variants
|
|
27
|
+
)
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
attr_accessor :actor
|
|
31
|
+
|
|
32
|
+
# Kind of identity the usage is attributed to; matches `actor.type` when `actor`
|
|
33
|
+
# is set. Populated only when `actor_type` is in `group_by[]`.
|
|
34
|
+
sig do
|
|
35
|
+
returns(
|
|
36
|
+
T.nilable(
|
|
37
|
+
Anthropic::Beta::Organization::BetaAnalyticsActorType::TaggedSymbol
|
|
38
|
+
)
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
attr_accessor :actor_type
|
|
42
|
+
|
|
43
|
+
# Claude Managed Agents agent whose session incurred the usage. Populated only
|
|
44
|
+
# when `agent_id` is in `group_by[]`; null for usage outside a managed session.
|
|
45
|
+
sig { returns(T.nilable(String)) }
|
|
46
|
+
attr_accessor :agent_id
|
|
47
|
+
|
|
48
|
+
# API key that authenticated the requests, as a tagged API key ID, whichever
|
|
49
|
+
# identity `actor` resolves to. Populated only when `api_key_id` is in
|
|
50
|
+
# `group_by[]`; null for usage not authenticated by an API key.
|
|
51
|
+
sig { returns(T.nilable(String)) }
|
|
52
|
+
attr_accessor :api_key_id
|
|
53
|
+
|
|
54
|
+
# Claude Tag (Claude in Slack) spend category: `engaged` (a person addressed
|
|
55
|
+
# Claude in a channel or thread), `proactive` (Claude responded without being
|
|
56
|
+
# addressed), `scheduled` (a scheduled routine ran), `monitoring` (Claude watching
|
|
57
|
+
# a channel it was asked to monitor), or `dm` (direct messages with Claude).
|
|
58
|
+
# Populated only when `claude_tag_category` is in `group_by[]`; null for usage
|
|
59
|
+
# that is not Claude Tag. Direct-message usage is billed to the individual user
|
|
60
|
+
# and is reported under that user's product, not under `claude_tag`. New
|
|
61
|
+
# categories may be added over time.
|
|
62
|
+
sig do
|
|
63
|
+
returns(
|
|
64
|
+
T.nilable(
|
|
65
|
+
Anthropic::Beta::Organization::BetaAnalyticsClaudeTagCategory::TaggedSymbol
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
end
|
|
69
|
+
attr_accessor :claude_tag_category
|
|
70
|
+
|
|
71
|
+
# Slack user ID (for example `U0123ABCDEF`) of the member the Claude Tag (Claude
|
|
72
|
+
# in Slack) usage is attributed to, not a claude.ai user ID. Populated only when
|
|
73
|
+
# `claude_tag_user_id` is in `group_by[]`; null for usage that is not Claude Tag
|
|
74
|
+
# and for Claude Tag usage that is not attributed to a single user (for example
|
|
75
|
+
# `monitoring`, and `proactive` usage Claude initiated), so per-user rows can sum
|
|
76
|
+
# to less than the Claude Tag total. Cannot be combined with
|
|
77
|
+
# `group_by[]=rbac_group_id` or the `rbac_group_ids[]` filter.
|
|
78
|
+
sig { returns(T.nilable(String)) }
|
|
79
|
+
attr_accessor :claude_tag_user_id
|
|
80
|
+
|
|
81
|
+
# Context-window pricing tier of the usage or cost. Null unless `context_window`
|
|
82
|
+
# is in `group_by[]`; it can also be null on grouped rows with no context-window
|
|
83
|
+
# tier, such as code execution.
|
|
84
|
+
sig do
|
|
85
|
+
returns(
|
|
86
|
+
T.nilable(
|
|
87
|
+
Anthropic::Beta::Organization::BetaAnalyticsContextWindow::TaggedSymbol
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
end
|
|
91
|
+
attr_accessor :context_window
|
|
92
|
+
|
|
93
|
+
# Cost component breakdown; null when returning the combined total.
|
|
94
|
+
sig do
|
|
95
|
+
returns(
|
|
96
|
+
T.nilable(
|
|
97
|
+
Anthropic::Beta::Organization::BetaAnalyticsGroupedCostType::TaggedSymbol
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
end
|
|
101
|
+
attr_accessor :cost_type
|
|
102
|
+
|
|
103
|
+
# Deployment that started the Claude Managed Agents session. Populated only when
|
|
104
|
+
# `deployment_id` is in `group_by[]`; null for usage outside a managed session and
|
|
105
|
+
# for sessions no deployment started.
|
|
106
|
+
sig { returns(T.nilable(String)) }
|
|
107
|
+
attr_accessor :deployment_id
|
|
108
|
+
|
|
109
|
+
# Claude Managed Agents environment the session ran in. Populated only when
|
|
110
|
+
# `environment_id` is in `group_by[]`; null for usage outside a managed session.
|
|
111
|
+
sig { returns(T.nilable(String)) }
|
|
112
|
+
attr_accessor :environment_id
|
|
113
|
+
|
|
114
|
+
# Inference region of the usage or cost. Null unless `inference_geo` is in
|
|
115
|
+
# `group_by[]`; it can also be null on grouped rows where the region is not set
|
|
116
|
+
# (the rows that `inference_geos[]=not_available` matches).
|
|
117
|
+
sig do
|
|
118
|
+
returns(
|
|
119
|
+
T.nilable(
|
|
120
|
+
Anthropic::Beta::Organization::BetaAnalyticsUsageCostInferenceGeo::TaggedSymbol
|
|
121
|
+
)
|
|
122
|
+
)
|
|
123
|
+
end
|
|
124
|
+
attr_accessor :inference_geo
|
|
125
|
+
|
|
126
|
+
# Model that produced the usage or cost, as a model name in the form the
|
|
127
|
+
# `models[]` filter accepts (for example, `claude-opus-5-5`). Null unless `model`
|
|
128
|
+
# is in `group_by[]`; it can also be null on grouped rows whose usage or cost is
|
|
129
|
+
# not attributed to a specific model, such as code execution.
|
|
130
|
+
sig { returns(T.nilable(String)) }
|
|
131
|
+
attr_accessor :model
|
|
132
|
+
|
|
133
|
+
# Product surface that produced the usage or cost. Null unless product is in
|
|
134
|
+
# `group_by[]`; it can also be null on grouped rows whose usage cannot be
|
|
135
|
+
# attributed to a known surface. Values include `chat`, `claude_code`, `cowork`,
|
|
136
|
+
# `office_agent`, `claude_in_chrome`, `claude_design`, `claude_tag`, and
|
|
137
|
+
# `chat_cowork_unified`. `claude_tag` is Claude Tag, the Claude product in Slack.
|
|
138
|
+
# `chat_cowork_unified` is Chat and Cowork unified, Cowork's features inside
|
|
139
|
+
# claude.ai chat: chat and Cowork usage by a member who has it turned on is
|
|
140
|
+
# reported under this value instead of `chat` or `cowork`. It is accepted as a
|
|
141
|
+
# filter only on deployments that offer Chat and Cowork unified. Some unattributed
|
|
142
|
+
# usage is reported as "other".
|
|
143
|
+
sig { returns(T.nilable(String)) }
|
|
144
|
+
attr_accessor :product
|
|
145
|
+
|
|
146
|
+
# RBAC group (team) the usage is attributed to, in the public tagged
|
|
147
|
+
# `rbac_group_...` spelling — the same spelling the activity resources use for
|
|
148
|
+
# this key, so the same team has one id across resources and it round-trips as an
|
|
149
|
+
# `rbac_group_ids[]` filter value. Populated only when `rbac_group_id` is in
|
|
150
|
+
# `group_by[]`. Any-membership semantics: a user in several groups contributes
|
|
151
|
+
# their full usage to each of those groups' rows, so the named-group rows overlap
|
|
152
|
+
# and their sum can exceed the org total. A null value is the single unassigned
|
|
153
|
+
# row: users in no group on that (UTC) day. For the true org total, run the same
|
|
154
|
+
# query without `group_by[]`.
|
|
155
|
+
sig { returns(T.nilable(String)) }
|
|
156
|
+
attr_accessor :rbac_group_id
|
|
157
|
+
|
|
158
|
+
# Service tier the usage was served at. Populated only when `service_tier` is in
|
|
159
|
+
# `group_by[]`; null for usage with no service tier (for example, code execution)
|
|
160
|
+
# and for Claude Enterprise usage.
|
|
161
|
+
sig do
|
|
162
|
+
returns(
|
|
163
|
+
T.nilable(
|
|
164
|
+
Anthropic::Beta::Organization::BetaAnalyticsServiceTier::TaggedSymbol
|
|
165
|
+
)
|
|
166
|
+
)
|
|
167
|
+
end
|
|
168
|
+
attr_accessor :service_tier
|
|
169
|
+
|
|
170
|
+
# Claude Managed Agents session that incurred the usage. Populated only when
|
|
171
|
+
# `session_id` is in `group_by[]`; null for usage outside a managed session.
|
|
172
|
+
sig { returns(T.nilable(String)) }
|
|
173
|
+
attr_accessor :session_id
|
|
174
|
+
|
|
175
|
+
# Slack channel the usage originated from. Populated only when `slack_channel_id`
|
|
176
|
+
# is in `group_by[]`; null for usage outside Slack (and for rows recorded before
|
|
177
|
+
# channel attribution was enabled).
|
|
178
|
+
sig { returns(T.nilable(String)) }
|
|
179
|
+
attr_accessor :slack_channel_id
|
|
180
|
+
|
|
181
|
+
# Inference speed mode of the usage or cost: `fast` or `standard`. Null unless
|
|
182
|
+
# `speed` is in `group_by[]`.
|
|
183
|
+
sig do
|
|
184
|
+
returns(
|
|
185
|
+
T.nilable(
|
|
186
|
+
Anthropic::Beta::Organization::BetaAnalyticsSpeed::TaggedSymbol
|
|
187
|
+
)
|
|
188
|
+
)
|
|
189
|
+
end
|
|
190
|
+
attr_accessor :speed
|
|
191
|
+
|
|
192
|
+
# Token type when `cost_type` is `tokens`; null otherwise.
|
|
193
|
+
sig do
|
|
194
|
+
returns(
|
|
195
|
+
T.nilable(
|
|
196
|
+
Anthropic::Beta::Organization::BetaAnalyticsTokenType::TaggedSymbol
|
|
197
|
+
)
|
|
198
|
+
)
|
|
199
|
+
end
|
|
200
|
+
attr_accessor :token_type
|
|
201
|
+
|
|
202
|
+
# User profile the usage was attributed to, as a tagged `uprof_` ID. Populated
|
|
203
|
+
# only when `user_profile_id` is in `group_by[]`; null for usage that named no
|
|
204
|
+
# profile and for Claude Enterprise usage.
|
|
205
|
+
sig { returns(T.nilable(String)) }
|
|
206
|
+
attr_accessor :user_profile_id
|
|
207
|
+
|
|
208
|
+
# Workspace the usage occurred in, as a tagged workspace ID, including the
|
|
209
|
+
# organization's default workspace. Populated only when `workspace_id` is in
|
|
210
|
+
# `group_by[]`; null for Claude Enterprise usage.
|
|
211
|
+
sig { returns(T.nilable(String)) }
|
|
212
|
+
attr_accessor :workspace_id
|
|
213
|
+
|
|
214
|
+
# The dimension values one cost row is broken out by, including `cost_type` and
|
|
215
|
+
# `token_type`.
|
|
216
|
+
sig do
|
|
217
|
+
params(
|
|
218
|
+
actor:
|
|
219
|
+
T.nilable(
|
|
220
|
+
T.any(
|
|
221
|
+
Anthropic::Beta::Organization::BetaAnalyticsReportUserActor::OrHash,
|
|
222
|
+
Anthropic::Beta::Organization::BetaAnalyticsServiceAccountActor::OrHash,
|
|
223
|
+
Anthropic::Beta::Organization::BetaAnalyticsFederatedActor::OrHash,
|
|
224
|
+
Anthropic::Beta::Organization::BetaAnalyticsAPIActor::OrHash
|
|
225
|
+
)
|
|
226
|
+
),
|
|
227
|
+
actor_type:
|
|
228
|
+
T.nilable(
|
|
229
|
+
Anthropic::Beta::Organization::BetaAnalyticsActorType::OrSymbol
|
|
230
|
+
),
|
|
231
|
+
agent_id: T.nilable(String),
|
|
232
|
+
api_key_id: T.nilable(String),
|
|
233
|
+
claude_tag_category:
|
|
234
|
+
T.nilable(
|
|
235
|
+
Anthropic::Beta::Organization::BetaAnalyticsClaudeTagCategory::OrSymbol
|
|
236
|
+
),
|
|
237
|
+
claude_tag_user_id: T.nilable(String),
|
|
238
|
+
context_window:
|
|
239
|
+
T.nilable(
|
|
240
|
+
Anthropic::Beta::Organization::BetaAnalyticsContextWindow::OrSymbol
|
|
241
|
+
),
|
|
242
|
+
cost_type:
|
|
243
|
+
T.nilable(
|
|
244
|
+
Anthropic::Beta::Organization::BetaAnalyticsGroupedCostType::OrSymbol
|
|
245
|
+
),
|
|
246
|
+
deployment_id: T.nilable(String),
|
|
247
|
+
environment_id: T.nilable(String),
|
|
248
|
+
inference_geo:
|
|
249
|
+
T.nilable(
|
|
250
|
+
Anthropic::Beta::Organization::BetaAnalyticsUsageCostInferenceGeo::OrSymbol
|
|
251
|
+
),
|
|
252
|
+
model: T.nilable(String),
|
|
253
|
+
product: T.nilable(String),
|
|
254
|
+
rbac_group_id: T.nilable(String),
|
|
255
|
+
service_tier:
|
|
256
|
+
T.nilable(
|
|
257
|
+
Anthropic::Beta::Organization::BetaAnalyticsServiceTier::OrSymbol
|
|
258
|
+
),
|
|
259
|
+
session_id: T.nilable(String),
|
|
260
|
+
slack_channel_id: T.nilable(String),
|
|
261
|
+
speed:
|
|
262
|
+
T.nilable(
|
|
263
|
+
Anthropic::Beta::Organization::BetaAnalyticsSpeed::OrSymbol
|
|
264
|
+
),
|
|
265
|
+
token_type:
|
|
266
|
+
T.nilable(
|
|
267
|
+
Anthropic::Beta::Organization::BetaAnalyticsTokenType::OrSymbol
|
|
268
|
+
),
|
|
269
|
+
user_profile_id: T.nilable(String),
|
|
270
|
+
workspace_id: T.nilable(String)
|
|
271
|
+
).returns(T.attached_class)
|
|
272
|
+
end
|
|
273
|
+
def self.new(
|
|
274
|
+
# The identity the usage is attributed to: the user if one is attributed, else the
|
|
275
|
+
# service account, else the federated (cloud-platform) identity, else the API key.
|
|
276
|
+
# Populated only when `actor` is in `group_by[]`; null for usage with no
|
|
277
|
+
# attributable identity, and for users' and federated identities' usage when the
|
|
278
|
+
# reader is a member who can see only some workspaces. Distinct identities the
|
|
279
|
+
# server cannot render also read null, each as its own row.
|
|
280
|
+
actor:,
|
|
281
|
+
# Kind of identity the usage is attributed to; matches `actor.type` when `actor`
|
|
282
|
+
# is set. Populated only when `actor_type` is in `group_by[]`.
|
|
283
|
+
actor_type:,
|
|
284
|
+
# Claude Managed Agents agent whose session incurred the usage. Populated only
|
|
285
|
+
# when `agent_id` is in `group_by[]`; null for usage outside a managed session.
|
|
286
|
+
agent_id:,
|
|
287
|
+
# API key that authenticated the requests, as a tagged API key ID, whichever
|
|
288
|
+
# identity `actor` resolves to. Populated only when `api_key_id` is in
|
|
289
|
+
# `group_by[]`; null for usage not authenticated by an API key.
|
|
290
|
+
api_key_id:,
|
|
291
|
+
# Claude Tag (Claude in Slack) spend category: `engaged` (a person addressed
|
|
292
|
+
# Claude in a channel or thread), `proactive` (Claude responded without being
|
|
293
|
+
# addressed), `scheduled` (a scheduled routine ran), `monitoring` (Claude watching
|
|
294
|
+
# a channel it was asked to monitor), or `dm` (direct messages with Claude).
|
|
295
|
+
# Populated only when `claude_tag_category` is in `group_by[]`; null for usage
|
|
296
|
+
# that is not Claude Tag. Direct-message usage is billed to the individual user
|
|
297
|
+
# and is reported under that user's product, not under `claude_tag`. New
|
|
298
|
+
# categories may be added over time.
|
|
299
|
+
claude_tag_category:,
|
|
300
|
+
# Slack user ID (for example `U0123ABCDEF`) of the member the Claude Tag (Claude
|
|
301
|
+
# in Slack) usage is attributed to, not a claude.ai user ID. Populated only when
|
|
302
|
+
# `claude_tag_user_id` is in `group_by[]`; null for usage that is not Claude Tag
|
|
303
|
+
# and for Claude Tag usage that is not attributed to a single user (for example
|
|
304
|
+
# `monitoring`, and `proactive` usage Claude initiated), so per-user rows can sum
|
|
305
|
+
# to less than the Claude Tag total. Cannot be combined with
|
|
306
|
+
# `group_by[]=rbac_group_id` or the `rbac_group_ids[]` filter.
|
|
307
|
+
claude_tag_user_id:,
|
|
308
|
+
# Context-window pricing tier of the usage or cost. Null unless `context_window`
|
|
309
|
+
# is in `group_by[]`; it can also be null on grouped rows with no context-window
|
|
310
|
+
# tier, such as code execution.
|
|
311
|
+
context_window:,
|
|
312
|
+
# Cost component breakdown; null when returning the combined total.
|
|
313
|
+
cost_type:,
|
|
314
|
+
# Deployment that started the Claude Managed Agents session. Populated only when
|
|
315
|
+
# `deployment_id` is in `group_by[]`; null for usage outside a managed session and
|
|
316
|
+
# for sessions no deployment started.
|
|
317
|
+
deployment_id:,
|
|
318
|
+
# Claude Managed Agents environment the session ran in. Populated only when
|
|
319
|
+
# `environment_id` is in `group_by[]`; null for usage outside a managed session.
|
|
320
|
+
environment_id:,
|
|
321
|
+
# Inference region of the usage or cost. Null unless `inference_geo` is in
|
|
322
|
+
# `group_by[]`; it can also be null on grouped rows where the region is not set
|
|
323
|
+
# (the rows that `inference_geos[]=not_available` matches).
|
|
324
|
+
inference_geo:,
|
|
325
|
+
# Model that produced the usage or cost, as a model name in the form the
|
|
326
|
+
# `models[]` filter accepts (for example, `claude-opus-5-5`). Null unless `model`
|
|
327
|
+
# is in `group_by[]`; it can also be null on grouped rows whose usage or cost is
|
|
328
|
+
# not attributed to a specific model, such as code execution.
|
|
329
|
+
model:,
|
|
330
|
+
# Product surface that produced the usage or cost. Null unless product is in
|
|
331
|
+
# `group_by[]`; it can also be null on grouped rows whose usage cannot be
|
|
332
|
+
# attributed to a known surface. Values include `chat`, `claude_code`, `cowork`,
|
|
333
|
+
# `office_agent`, `claude_in_chrome`, `claude_design`, `claude_tag`, and
|
|
334
|
+
# `chat_cowork_unified`. `claude_tag` is Claude Tag, the Claude product in Slack.
|
|
335
|
+
# `chat_cowork_unified` is Chat and Cowork unified, Cowork's features inside
|
|
336
|
+
# claude.ai chat: chat and Cowork usage by a member who has it turned on is
|
|
337
|
+
# reported under this value instead of `chat` or `cowork`. It is accepted as a
|
|
338
|
+
# filter only on deployments that offer Chat and Cowork unified. Some unattributed
|
|
339
|
+
# usage is reported as "other".
|
|
340
|
+
product:,
|
|
341
|
+
# RBAC group (team) the usage is attributed to, in the public tagged
|
|
342
|
+
# `rbac_group_...` spelling — the same spelling the activity resources use for
|
|
343
|
+
# this key, so the same team has one id across resources and it round-trips as an
|
|
344
|
+
# `rbac_group_ids[]` filter value. Populated only when `rbac_group_id` is in
|
|
345
|
+
# `group_by[]`. Any-membership semantics: a user in several groups contributes
|
|
346
|
+
# their full usage to each of those groups' rows, so the named-group rows overlap
|
|
347
|
+
# and their sum can exceed the org total. A null value is the single unassigned
|
|
348
|
+
# row: users in no group on that (UTC) day. For the true org total, run the same
|
|
349
|
+
# query without `group_by[]`.
|
|
350
|
+
rbac_group_id:,
|
|
351
|
+
# Service tier the usage was served at. Populated only when `service_tier` is in
|
|
352
|
+
# `group_by[]`; null for usage with no service tier (for example, code execution)
|
|
353
|
+
# and for Claude Enterprise usage.
|
|
354
|
+
service_tier:,
|
|
355
|
+
# Claude Managed Agents session that incurred the usage. Populated only when
|
|
356
|
+
# `session_id` is in `group_by[]`; null for usage outside a managed session.
|
|
357
|
+
session_id:,
|
|
358
|
+
# Slack channel the usage originated from. Populated only when `slack_channel_id`
|
|
359
|
+
# is in `group_by[]`; null for usage outside Slack (and for rows recorded before
|
|
360
|
+
# channel attribution was enabled).
|
|
361
|
+
slack_channel_id:,
|
|
362
|
+
# Inference speed mode of the usage or cost: `fast` or `standard`. Null unless
|
|
363
|
+
# `speed` is in `group_by[]`.
|
|
364
|
+
speed:,
|
|
365
|
+
# Token type when `cost_type` is `tokens`; null otherwise.
|
|
366
|
+
token_type:,
|
|
367
|
+
# User profile the usage was attributed to, as a tagged `uprof_` ID. Populated
|
|
368
|
+
# only when `user_profile_id` is in `group_by[]`; null for usage that named no
|
|
369
|
+
# profile and for Claude Enterprise usage.
|
|
370
|
+
user_profile_id:,
|
|
371
|
+
# Workspace the usage occurred in, as a tagged workspace ID, including the
|
|
372
|
+
# organization's default workspace. Populated only when `workspace_id` is in
|
|
373
|
+
# `group_by[]`; null for Claude Enterprise usage.
|
|
374
|
+
workspace_id:
|
|
375
|
+
)
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
sig do
|
|
379
|
+
override.returns(
|
|
380
|
+
{
|
|
381
|
+
actor:
|
|
382
|
+
T.nilable(
|
|
383
|
+
Anthropic::Beta::Organization::BetaAnalyticsActor::Variants
|
|
384
|
+
),
|
|
385
|
+
actor_type:
|
|
386
|
+
T.nilable(
|
|
387
|
+
Anthropic::Beta::Organization::BetaAnalyticsActorType::TaggedSymbol
|
|
388
|
+
),
|
|
389
|
+
agent_id: T.nilable(String),
|
|
390
|
+
api_key_id: T.nilable(String),
|
|
391
|
+
claude_tag_category:
|
|
392
|
+
T.nilable(
|
|
393
|
+
Anthropic::Beta::Organization::BetaAnalyticsClaudeTagCategory::TaggedSymbol
|
|
394
|
+
),
|
|
395
|
+
claude_tag_user_id: T.nilable(String),
|
|
396
|
+
context_window:
|
|
397
|
+
T.nilable(
|
|
398
|
+
Anthropic::Beta::Organization::BetaAnalyticsContextWindow::TaggedSymbol
|
|
399
|
+
),
|
|
400
|
+
cost_type:
|
|
401
|
+
T.nilable(
|
|
402
|
+
Anthropic::Beta::Organization::BetaAnalyticsGroupedCostType::TaggedSymbol
|
|
403
|
+
),
|
|
404
|
+
deployment_id: T.nilable(String),
|
|
405
|
+
environment_id: T.nilable(String),
|
|
406
|
+
inference_geo:
|
|
407
|
+
T.nilable(
|
|
408
|
+
Anthropic::Beta::Organization::BetaAnalyticsUsageCostInferenceGeo::TaggedSymbol
|
|
409
|
+
),
|
|
410
|
+
model: T.nilable(String),
|
|
411
|
+
product: T.nilable(String),
|
|
412
|
+
rbac_group_id: T.nilable(String),
|
|
413
|
+
service_tier:
|
|
414
|
+
T.nilable(
|
|
415
|
+
Anthropic::Beta::Organization::BetaAnalyticsServiceTier::TaggedSymbol
|
|
416
|
+
),
|
|
417
|
+
session_id: T.nilable(String),
|
|
418
|
+
slack_channel_id: T.nilable(String),
|
|
419
|
+
speed:
|
|
420
|
+
T.nilable(
|
|
421
|
+
Anthropic::Beta::Organization::BetaAnalyticsSpeed::TaggedSymbol
|
|
422
|
+
),
|
|
423
|
+
token_type:
|
|
424
|
+
T.nilable(
|
|
425
|
+
Anthropic::Beta::Organization::BetaAnalyticsTokenType::TaggedSymbol
|
|
426
|
+
),
|
|
427
|
+
user_profile_id: T.nilable(String),
|
|
428
|
+
workspace_id: T.nilable(String)
|
|
429
|
+
}
|
|
430
|
+
)
|
|
431
|
+
end
|
|
432
|
+
def to_hash
|
|
433
|
+
end
|
|
434
|
+
end
|
|
435
|
+
end
|
|
436
|
+
end
|
|
437
|
+
end
|
|
438
|
+
end
|
|
439
|
+
end
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
module Beta
|
|
6
|
+
module Organization
|
|
7
|
+
module Analytics
|
|
8
|
+
module BetaAnalyticsCostGroupBy
|
|
9
|
+
extend Anthropic::Internal::Type::Enum
|
|
10
|
+
|
|
11
|
+
TaggedSymbol =
|
|
12
|
+
T.type_alias do
|
|
13
|
+
T.all(
|
|
14
|
+
Symbol,
|
|
15
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
19
|
+
|
|
20
|
+
ACTOR =
|
|
21
|
+
T.let(
|
|
22
|
+
:actor,
|
|
23
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
24
|
+
)
|
|
25
|
+
ACTOR_TYPE =
|
|
26
|
+
T.let(
|
|
27
|
+
:actor_type,
|
|
28
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
29
|
+
)
|
|
30
|
+
AGENT_ID =
|
|
31
|
+
T.let(
|
|
32
|
+
:agent_id,
|
|
33
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
34
|
+
)
|
|
35
|
+
API_KEY_ID =
|
|
36
|
+
T.let(
|
|
37
|
+
:api_key_id,
|
|
38
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
39
|
+
)
|
|
40
|
+
CLAUDE_TAG_CATEGORY =
|
|
41
|
+
T.let(
|
|
42
|
+
:claude_tag_category,
|
|
43
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
44
|
+
)
|
|
45
|
+
CLAUDE_TAG_USER_ID =
|
|
46
|
+
T.let(
|
|
47
|
+
:claude_tag_user_id,
|
|
48
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
49
|
+
)
|
|
50
|
+
CONTEXT_WINDOW =
|
|
51
|
+
T.let(
|
|
52
|
+
:context_window,
|
|
53
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
54
|
+
)
|
|
55
|
+
COST_TYPE =
|
|
56
|
+
T.let(
|
|
57
|
+
:cost_type,
|
|
58
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
59
|
+
)
|
|
60
|
+
DEPLOYMENT_ID =
|
|
61
|
+
T.let(
|
|
62
|
+
:deployment_id,
|
|
63
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
64
|
+
)
|
|
65
|
+
ENVIRONMENT_ID =
|
|
66
|
+
T.let(
|
|
67
|
+
:environment_id,
|
|
68
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
69
|
+
)
|
|
70
|
+
INFERENCE_GEO =
|
|
71
|
+
T.let(
|
|
72
|
+
:inference_geo,
|
|
73
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
74
|
+
)
|
|
75
|
+
MODEL =
|
|
76
|
+
T.let(
|
|
77
|
+
:model,
|
|
78
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
79
|
+
)
|
|
80
|
+
PRODUCT =
|
|
81
|
+
T.let(
|
|
82
|
+
:product,
|
|
83
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
84
|
+
)
|
|
85
|
+
RBAC_GROUP_ID =
|
|
86
|
+
T.let(
|
|
87
|
+
:rbac_group_id,
|
|
88
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
89
|
+
)
|
|
90
|
+
SERVICE_TIER =
|
|
91
|
+
T.let(
|
|
92
|
+
:service_tier,
|
|
93
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
94
|
+
)
|
|
95
|
+
SESSION_ID =
|
|
96
|
+
T.let(
|
|
97
|
+
:session_id,
|
|
98
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
99
|
+
)
|
|
100
|
+
SLACK_CHANNEL_ID =
|
|
101
|
+
T.let(
|
|
102
|
+
:slack_channel_id,
|
|
103
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
104
|
+
)
|
|
105
|
+
SPEED =
|
|
106
|
+
T.let(
|
|
107
|
+
:speed,
|
|
108
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
109
|
+
)
|
|
110
|
+
TOKEN_TYPE =
|
|
111
|
+
T.let(
|
|
112
|
+
:token_type,
|
|
113
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
114
|
+
)
|
|
115
|
+
USER_PROFILE_ID =
|
|
116
|
+
T.let(
|
|
117
|
+
:user_profile_id,
|
|
118
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
119
|
+
)
|
|
120
|
+
WORKSPACE_ID =
|
|
121
|
+
T.let(
|
|
122
|
+
:workspace_id,
|
|
123
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
sig do
|
|
127
|
+
override.returns(
|
|
128
|
+
T::Array[
|
|
129
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy::TaggedSymbol
|
|
130
|
+
]
|
|
131
|
+
)
|
|
132
|
+
end
|
|
133
|
+
def self.values
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
module Beta
|
|
6
|
+
module Organization
|
|
7
|
+
module Analytics
|
|
8
|
+
class BetaAnalyticsCostItem < Anthropic::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostItem,
|
|
13
|
+
Anthropic::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Cost for this row.
|
|
18
|
+
sig do
|
|
19
|
+
returns(
|
|
20
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostMetrics
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
attr_reader :cost
|
|
24
|
+
|
|
25
|
+
sig do
|
|
26
|
+
params(
|
|
27
|
+
cost:
|
|
28
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostMetrics::OrHash
|
|
29
|
+
).void
|
|
30
|
+
end
|
|
31
|
+
attr_writer :cost
|
|
32
|
+
|
|
33
|
+
# End of the period this row covers (exclusive), as an RFC 3339 UTC timestamp: the
|
|
34
|
+
# end of the row's time bucket when a time-bucket width is set; otherwise the
|
|
35
|
+
# requested `ending_at` (or, when omitted, the earlier of now and `starting_at`
|
|
36
|
+
# plus 31 days) rounded down to the hour, because without a time bucket the report
|
|
37
|
+
# covers whole hours.
|
|
38
|
+
sig { returns(Time) }
|
|
39
|
+
attr_accessor :ending_at
|
|
40
|
+
|
|
41
|
+
# The dimension values this row's cost is broken out by.
|
|
42
|
+
sig do
|
|
43
|
+
returns(
|
|
44
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroup
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
attr_reader :group
|
|
48
|
+
|
|
49
|
+
sig do
|
|
50
|
+
params(
|
|
51
|
+
group:
|
|
52
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroup::OrHash
|
|
53
|
+
).void
|
|
54
|
+
end
|
|
55
|
+
attr_writer :group
|
|
56
|
+
|
|
57
|
+
# Start of the period this row covers (inclusive), as an RFC 3339 UTC timestamp:
|
|
58
|
+
# the start of the row's time bucket when a time-bucket width is set, otherwise
|
|
59
|
+
# the requested `starting_at` rounded down to the hour.
|
|
60
|
+
sig { returns(Time) }
|
|
61
|
+
attr_accessor :starting_at
|
|
62
|
+
|
|
63
|
+
sig do
|
|
64
|
+
params(
|
|
65
|
+
cost:
|
|
66
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostMetrics::OrHash,
|
|
67
|
+
ending_at: Time,
|
|
68
|
+
group:
|
|
69
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroup::OrHash,
|
|
70
|
+
starting_at: Time
|
|
71
|
+
).returns(T.attached_class)
|
|
72
|
+
end
|
|
73
|
+
def self.new(
|
|
74
|
+
# Cost for this row.
|
|
75
|
+
cost:,
|
|
76
|
+
# End of the period this row covers (exclusive), as an RFC 3339 UTC timestamp: the
|
|
77
|
+
# end of the row's time bucket when a time-bucket width is set; otherwise the
|
|
78
|
+
# requested `ending_at` (or, when omitted, the earlier of now and `starting_at`
|
|
79
|
+
# plus 31 days) rounded down to the hour, because without a time bucket the report
|
|
80
|
+
# covers whole hours.
|
|
81
|
+
ending_at:,
|
|
82
|
+
# The dimension values this row's cost is broken out by.
|
|
83
|
+
group:,
|
|
84
|
+
# Start of the period this row covers (inclusive), as an RFC 3339 UTC timestamp:
|
|
85
|
+
# the start of the row's time bucket when a time-bucket width is set, otherwise
|
|
86
|
+
# the requested `starting_at` rounded down to the hour.
|
|
87
|
+
starting_at:
|
|
88
|
+
)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
sig do
|
|
92
|
+
override.returns(
|
|
93
|
+
{
|
|
94
|
+
cost:
|
|
95
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostMetrics,
|
|
96
|
+
ending_at: Time,
|
|
97
|
+
group:
|
|
98
|
+
Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostGroup,
|
|
99
|
+
starting_at: Time
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
end
|
|
103
|
+
def to_hash
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|