anthropic 2.0.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 +35 -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/models/user_profile.rb +26 -1
- data/lib/anthropic/models/user_profile_enforcement_action.rb +66 -0
- data/lib/anthropic/models/user_profile_enforcement_action_ban.rb +62 -0
- data/lib/anthropic/models/user_profile_enforcement_action_next_step.rb +17 -0
- data/lib/anthropic/models/user_profile_enforcement_action_reason.rb +23 -0
- data/lib/anthropic/models/user_profile_enforcement_action_restriction.rb +67 -0
- data/lib/anthropic/models/user_profile_enforcement_status.rb +20 -0
- data/lib/anthropic/models/user_profile_list_params.rb +17 -1
- data/lib/anthropic/models.rb +12 -0
- 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/resources/user_profiles.rb +5 -3
- data/lib/anthropic/version.rb +1 -1
- data/lib/anthropic.rb +42 -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/models/user_profile.rbi +42 -0
- data/rbi/anthropic/models/user_profile_enforcement_action.rbi +95 -0
- data/rbi/anthropic/models/user_profile_enforcement_action_ban.rbi +96 -0
- data/rbi/anthropic/models/user_profile_enforcement_action_next_step.rbi +34 -0
- data/rbi/anthropic/models/user_profile_enforcement_action_reason.rbi +58 -0
- data/rbi/anthropic/models/user_profile_enforcement_action_restriction.rbi +106 -0
- data/rbi/anthropic/models/user_profile_enforcement_status.rbi +39 -0
- data/rbi/anthropic/models/user_profile_list_params.rbi +36 -0
- data/rbi/anthropic/models.rbi +16 -0
- 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/anthropic/resources/user_profiles.rbi +12 -0
- 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/models/user_profile.rbs +10 -0
- data/sig/anthropic/models/user_profile_enforcement_action.rbs +50 -0
- data/sig/anthropic/models/user_profile_enforcement_action_ban.rbs +45 -0
- data/sig/anthropic/models/user_profile_enforcement_action_next_step.rbs +13 -0
- data/sig/anthropic/models/user_profile_enforcement_action_reason.rbs +24 -0
- data/sig/anthropic/models/user_profile_enforcement_action_restriction.rbs +45 -0
- data/sig/anthropic/models/user_profile_enforcement_status.rbs +17 -0
- data/sig/anthropic/models/user_profile_list_params.rbs +9 -0
- data/sig/anthropic/models.rbs +12 -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
- data/sig/anthropic/resources/user_profiles.rbs +1 -0
- metadata +130 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
# Why Anthropic placed this enforcement action: `unsupported_region`,
|
|
6
|
+
# `fraud_or_abuse`, `high_harm`, `usage_policy_violation`, `account_compromise` or
|
|
7
|
+
# `unspecified`. More values may be added; read a value you do not recognize as
|
|
8
|
+
# `unspecified`.
|
|
9
|
+
module UserProfileEnforcementActionReason
|
|
10
|
+
extend Anthropic::Internal::Type::Enum
|
|
11
|
+
|
|
12
|
+
UNSUPPORTED_REGION = :unsupported_region
|
|
13
|
+
FRAUD_OR_ABUSE = :fraud_or_abuse
|
|
14
|
+
HIGH_HARM = :high_harm
|
|
15
|
+
USAGE_POLICY_VIOLATION = :usage_policy_violation
|
|
16
|
+
ACCOUNT_COMPROMISE = :account_compromise
|
|
17
|
+
UNSPECIFIED = :unspecified
|
|
18
|
+
|
|
19
|
+
# @!method self.values
|
|
20
|
+
# @return [Array<Symbol>]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
class UserProfileEnforcementActionRestriction < Anthropic::Internal::Type::BaseModel
|
|
6
|
+
# @!attribute id
|
|
7
|
+
# The action's ID (`enac_...`), stable while the action is open.
|
|
8
|
+
#
|
|
9
|
+
# @return [String]
|
|
10
|
+
required :id, String
|
|
11
|
+
|
|
12
|
+
# @!attribute action
|
|
13
|
+
# The next step on the action: `verify` or `null`. `verify`: the end user can
|
|
14
|
+
# clear it now by passing an identity check. `null`: there is nothing the end user
|
|
15
|
+
# can do now to clear it, including while Anthropic reviews an identity check the
|
|
16
|
+
# end user submitted.
|
|
17
|
+
#
|
|
18
|
+
# @return [Symbol, Anthropic::Models::UserProfileEnforcementActionNextStep, nil]
|
|
19
|
+
required :action, enum: -> { Anthropic::UserProfileEnforcementActionNextStep }, nil?: true
|
|
20
|
+
|
|
21
|
+
# @!attribute expires_at
|
|
22
|
+
# When the action ends on its own, in RFC 3339 format; it stops showing once this
|
|
23
|
+
# time has passed. `null` when it has no end date, and always `null` when `reason`
|
|
24
|
+
# is `account_compromise`.
|
|
25
|
+
#
|
|
26
|
+
# @return [Time, nil]
|
|
27
|
+
required :expires_at, Time, nil?: true
|
|
28
|
+
|
|
29
|
+
# @!attribute opened_at
|
|
30
|
+
# When Anthropic opened the action, in RFC 3339 format.
|
|
31
|
+
#
|
|
32
|
+
# @return [Time]
|
|
33
|
+
required :opened_at, Time
|
|
34
|
+
|
|
35
|
+
# @!attribute reason
|
|
36
|
+
# Why Anthropic placed the limit: `unsupported_region`, `fraud_or_abuse`,
|
|
37
|
+
# `high_harm`, `usage_policy_violation`, `account_compromise` or `unspecified`.
|
|
38
|
+
#
|
|
39
|
+
# @return [Symbol, Anthropic::Models::UserProfileEnforcementActionReason]
|
|
40
|
+
required :reason, enum: -> { Anthropic::UserProfileEnforcementActionReason }
|
|
41
|
+
|
|
42
|
+
# @!attribute type
|
|
43
|
+
#
|
|
44
|
+
# @return [Symbol, :restriction]
|
|
45
|
+
required :type, const: :restriction
|
|
46
|
+
|
|
47
|
+
# @!method initialize(id:, action:, expires_at:, opened_at:, reason:, type: :restriction)
|
|
48
|
+
# Anthropic has limited how it serves the end user until the action is resolved.
|
|
49
|
+
# The end user may still be served in part.
|
|
50
|
+
#
|
|
51
|
+
# Some parameter documentations has been truncated, see
|
|
52
|
+
# {Anthropic::Models::UserProfileEnforcementActionRestriction} for more details.
|
|
53
|
+
#
|
|
54
|
+
# @param id [String] The action's ID (`enac_...`), stable while the action is open.
|
|
55
|
+
#
|
|
56
|
+
# @param action [Symbol, Anthropic::Models::UserProfileEnforcementActionNextStep, nil] The next step on the action: `verify` or `null`. `verify`: the end user can clea
|
|
57
|
+
#
|
|
58
|
+
# @param expires_at [Time, nil] When the action ends on its own, in RFC 3339 format; it stops showing once this
|
|
59
|
+
#
|
|
60
|
+
# @param opened_at [Time] When Anthropic opened the action, in RFC 3339 format.
|
|
61
|
+
#
|
|
62
|
+
# @param reason [Symbol, Anthropic::Models::UserProfileEnforcementActionReason] Why Anthropic placed the limit: `unsupported_region`, `fraud_or_abuse`, `high_ha
|
|
63
|
+
#
|
|
64
|
+
# @param type [Symbol, :restriction]
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Models
|
|
5
|
+
# Anthropic's enforcement status of this profile: `unrestricted`, `pending`,
|
|
6
|
+
# `restricted` or `banned`. More values may be added; read a value you do not
|
|
7
|
+
# recognize as `restricted`.
|
|
8
|
+
module UserProfileEnforcementStatus
|
|
9
|
+
extend Anthropic::Internal::Type::Enum
|
|
10
|
+
|
|
11
|
+
UNRESTRICTED = :unrestricted
|
|
12
|
+
PENDING = :pending
|
|
13
|
+
RESTRICTED = :restricted
|
|
14
|
+
BANNED = :banned
|
|
15
|
+
|
|
16
|
+
# @!method self.values
|
|
17
|
+
# @return [Array<Symbol>]
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -7,6 +7,20 @@ module Anthropic
|
|
|
7
7
|
extend Anthropic::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include Anthropic::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
|
+
# @!attribute enforcement_status
|
|
11
|
+
# Return only the user profiles whose `enforcement_status` is one of these values:
|
|
12
|
+
# `unrestricted`, `pending`, `restricted` or `banned`. Repeat the parameter to
|
|
13
|
+
# match any of several. With it set, a page may hold fewer than `limit` profiles,
|
|
14
|
+
# or none, and still carry a `next_page`: the service examines a bounded number of
|
|
15
|
+
# profiles per request, and only a null `next_page` means the listing is complete.
|
|
16
|
+
# Rejected with `invalid_request_error` under the `user-profiles-2026-09-04` and
|
|
17
|
+
# earlier beta headers. Fails with `overloaded_error` when a profile's enforcement
|
|
18
|
+
# actions cannot be read for the moment.
|
|
19
|
+
#
|
|
20
|
+
# @return [Array<Symbol, Anthropic::Models::UserProfileEnforcementStatus>, nil]
|
|
21
|
+
optional :enforcement_status,
|
|
22
|
+
-> { Anthropic::Internal::Type::ArrayOf[enum: Anthropic::UserProfileEnforcementStatus] }
|
|
23
|
+
|
|
10
24
|
# @!attribute limit
|
|
11
25
|
# The maximum number of user profiles to return, from 1 to 100. Defaults to 20.
|
|
12
26
|
#
|
|
@@ -47,10 +61,12 @@ module Anthropic
|
|
|
47
61
|
# @return [String, nil]
|
|
48
62
|
optional :workspace_id, String
|
|
49
63
|
|
|
50
|
-
# @!method initialize(limit: nil, order: nil, order_by: nil, page: nil, workspace_id: nil, request_options: {})
|
|
64
|
+
# @!method initialize(enforcement_status: nil, limit: nil, order: nil, order_by: nil, page: nil, workspace_id: nil, request_options: {})
|
|
51
65
|
# Some parameter documentations has been truncated, see
|
|
52
66
|
# {Anthropic::Models::UserProfileListParams} for more details.
|
|
53
67
|
#
|
|
68
|
+
# @param enforcement_status [Array<Symbol, Anthropic::Models::UserProfileEnforcementStatus>] Return only the user profiles whose `enforcement_status` is one of these values:
|
|
69
|
+
#
|
|
54
70
|
# @param limit [Integer] The maximum number of user profiles to return, from 1 to 100. Defaults to 20.
|
|
55
71
|
#
|
|
56
72
|
# @param order [Symbol, Anthropic::Models::UserProfileListOrder] The sort direction, applied to the field that `order_by` selects. Defaults to `d
|
data/lib/anthropic/models.rb
CHANGED
|
@@ -836,6 +836,18 @@ module Anthropic
|
|
|
836
836
|
|
|
837
837
|
UserProfileEfsProgram = Anthropic::Models::UserProfileEfsProgram
|
|
838
838
|
|
|
839
|
+
UserProfileEnforcementAction = Anthropic::Models::UserProfileEnforcementAction
|
|
840
|
+
|
|
841
|
+
UserProfileEnforcementActionBan = Anthropic::Models::UserProfileEnforcementActionBan
|
|
842
|
+
|
|
843
|
+
UserProfileEnforcementActionNextStep = Anthropic::Models::UserProfileEnforcementActionNextStep
|
|
844
|
+
|
|
845
|
+
UserProfileEnforcementActionReason = Anthropic::Models::UserProfileEnforcementActionReason
|
|
846
|
+
|
|
847
|
+
UserProfileEnforcementActionRestriction = Anthropic::Models::UserProfileEnforcementActionRestriction
|
|
848
|
+
|
|
849
|
+
UserProfileEnforcementStatus = Anthropic::Models::UserProfileEnforcementStatus
|
|
850
|
+
|
|
839
851
|
UserProfileExternalUserAccountStatus = Anthropic::Models::UserProfileExternalUserAccountStatus
|
|
840
852
|
|
|
841
853
|
UserProfileExternalUserDetails = Anthropic::Models::UserProfileExternalUserDetails
|
|
@@ -7,14 +7,59 @@ module Anthropic
|
|
|
7
7
|
# @return [Anthropic::Resources::Beta::Messages::Batches]
|
|
8
8
|
attr_reader :batches
|
|
9
9
|
|
|
10
|
+
# Runs the tool calls of a conversation until the model gives its final reply.
|
|
11
|
+
#
|
|
12
|
+
# The runner sends its requests on a message thread, so that each request after the first
|
|
13
|
+
# carries only the messages that are new. Pass `thread: false` to send the whole history
|
|
14
|
+
# with every request instead.
|
|
15
|
+
#
|
|
10
16
|
# @param params [Anthropic::Models::Beta::MessageCreateParams]
|
|
11
17
|
#
|
|
18
|
+
# @option params [false, nil] :thread `false` turns the message thread off; `nil` leaves it on.
|
|
19
|
+
#
|
|
20
|
+
# @raise [ArgumentError] if `thread` is anything else
|
|
21
|
+
#
|
|
12
22
|
# @return [Anthropic::Helpers::Tools::Runner]
|
|
13
23
|
def tool_runner(params)
|
|
14
24
|
params = params.to_h.transform_keys(&:to_sym)
|
|
15
25
|
warn_thinking_enabled(params)
|
|
16
26
|
max_iterations = params.delete(:max_iterations)
|
|
17
|
-
|
|
27
|
+
thread = runner_thread(params)
|
|
28
|
+
Anthropic::Helpers::Tools::Runner.new(@client, params:, max_iterations:, thread:)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Creates a message thread: a conversation that the API keeps between requests, so that
|
|
32
|
+
# each turn sends only the messages that are new. It sends no request.
|
|
33
|
+
#
|
|
34
|
+
# Takes the keywords of {#create} except `thread` and `stream`. `messages` is optional and
|
|
35
|
+
# seeds the history, which the first turn sends.
|
|
36
|
+
#
|
|
37
|
+
# @param params [Hash{Symbol=>Object}]
|
|
38
|
+
#
|
|
39
|
+
# @option params [Symbol] :unsupported_request_behavior What a turn does when the API cannot
|
|
40
|
+
# serve the request on a thread: `:error` (the default) raises the error, and
|
|
41
|
+
# `:continue_unthreaded` sends the turn again, and every later turn, with the whole
|
|
42
|
+
# history and no thread.
|
|
43
|
+
#
|
|
44
|
+
# @raise [ArgumentError] if `thread` or `stream` is given
|
|
45
|
+
#
|
|
46
|
+
# @raise [NotImplementedError] if the client's platform has no message threads
|
|
47
|
+
#
|
|
48
|
+
# @return [Anthropic::Helpers::Threads::BetaMessageThread]
|
|
49
|
+
def thread(params)
|
|
50
|
+
unless @client.message_threads?
|
|
51
|
+
raise NotImplementedError.new(
|
|
52
|
+
"Message threads are not available on this client. Use `#create` with the whole history instead."
|
|
53
|
+
)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
params = params.to_h.transform_keys(&:to_sym)
|
|
57
|
+
unsupported_request_behavior = params.delete(:unsupported_request_behavior) || :error
|
|
58
|
+
Anthropic::Helpers::Threads::BetaMessageThread.new(
|
|
59
|
+
@client,
|
|
60
|
+
params:,
|
|
61
|
+
unsupported_request_behavior:
|
|
62
|
+
)
|
|
18
63
|
end
|
|
19
64
|
|
|
20
65
|
# See {Anthropic::Resources::Beta::Messages#stream_raw} for streaming counterpart.
|
|
@@ -31,7 +76,7 @@ module Anthropic
|
|
|
31
76
|
# Some parameter documentations has been truncated, see
|
|
32
77
|
# {Anthropic::Models::Beta::MessageCreateParams} for more details.
|
|
33
78
|
#
|
|
34
|
-
# @overload create(max_tokens:, messages:, model:, cache_control: nil, compaction: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, user_profile_id: nil, workspace_id: nil, request_options: {})
|
|
79
|
+
# @overload create(max_tokens:, messages:, model:, cache_control: nil, compaction: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, thinking: nil, thread: nil, tool_choice: nil, tools: nil, betas: nil, user_profile_id: nil, workspace_id: nil, request_options: {})
|
|
35
80
|
#
|
|
36
81
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
37
82
|
#
|
|
@@ -73,6 +118,8 @@ module Anthropic
|
|
|
73
118
|
#
|
|
74
119
|
# @param thinking [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled, Anthropic::Models::Beta::BetaThinkingConfigBetweenTools, Anthropic::Models::Beta::BetaThinkingConfigAdaptive] Body param: Configuration for Claude's thinking.
|
|
75
120
|
#
|
|
121
|
+
# @param thread [Anthropic::Models::Beta::BetaThreadCreateParams, Anthropic::Models::Beta::BetaThreadContinueParams, nil] Body param: Server-held conversation state (a Thread). `{"type": "create"}` asks
|
|
122
|
+
#
|
|
76
123
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
|
77
124
|
#
|
|
78
125
|
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaCodeExecutionTool20260120, Anthropic::Models::Beta::BetaCodeExecutionTool20260521, Anthropic::Models::Beta::BetaBrowserToolset20260801, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20251124, Anthropic::Models::Beta::BetaComputerToolset20260801, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910, Anthropic::Models::Beta::BetaWebSearchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260309, Anthropic::Models::Beta::BetaWebSearchTool20260318, Anthropic::Models::Beta::BetaWebFetchTool20260318, Anthropic::Models::Beta::BetaAdvisorTool20260301, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119, Anthropic::Models::Beta::BetaMCPToolset>] Body param: Definitions of tools that the model may use.
|
|
@@ -148,7 +195,7 @@ module Anthropic
|
|
|
148
195
|
# Some parameter documentations has been truncated, see
|
|
149
196
|
# {Anthropic::Models::Beta::MessageCreateParams} for more details.
|
|
150
197
|
#
|
|
151
|
-
# @overload stream_raw(max_tokens:, messages:, model:, cache_control: nil, compaction: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, user_profile_id: nil, workspace_id: nil, request_options: {})
|
|
198
|
+
# @overload stream_raw(max_tokens:, messages:, model:, cache_control: nil, compaction: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, thinking: nil, thread: nil, tool_choice: nil, tools: nil, betas: nil, user_profile_id: nil, workspace_id: nil, request_options: {})
|
|
152
199
|
#
|
|
153
200
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
154
201
|
#
|
|
@@ -190,6 +237,8 @@ module Anthropic
|
|
|
190
237
|
#
|
|
191
238
|
# @param thinking [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled, Anthropic::Models::Beta::BetaThinkingConfigBetweenTools, Anthropic::Models::Beta::BetaThinkingConfigAdaptive] Body param: Configuration for Claude's thinking.
|
|
192
239
|
#
|
|
240
|
+
# @param thread [Anthropic::Models::Beta::BetaThreadCreateParams, Anthropic::Models::Beta::BetaThreadContinueParams, nil] Body param: Server-held conversation state (a Thread). `{"type": "create"}` asks
|
|
241
|
+
#
|
|
193
242
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
|
194
243
|
#
|
|
195
244
|
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaCodeExecutionTool20260120, Anthropic::Models::Beta::BetaCodeExecutionTool20260521, Anthropic::Models::Beta::BetaBrowserToolset20260801, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20251124, Anthropic::Models::Beta::BetaComputerToolset20260801, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910, Anthropic::Models::Beta::BetaWebSearchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260309, Anthropic::Models::Beta::BetaWebSearchTool20260318, Anthropic::Models::Beta::BetaWebFetchTool20260318, Anthropic::Models::Beta::BetaAdvisorTool20260301, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119, Anthropic::Models::Beta::BetaMCPToolset>] Body param: Definitions of tools that the model may use.
|
|
@@ -318,7 +367,7 @@ module Anthropic
|
|
|
318
367
|
# Some parameter documentations has been truncated, see
|
|
319
368
|
# {Anthropic::Models::Beta::MessageCreateParams} for more details.
|
|
320
369
|
#
|
|
321
|
-
# @overload stream(max_tokens:, messages:, model:, cache_control: nil, compaction: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, thinking: nil, tool_choice: nil, tools: nil, betas: nil, user_profile_id: nil, workspace_id: nil, request_options: {})
|
|
370
|
+
# @overload stream(max_tokens:, messages:, model:, cache_control: nil, compaction: nil, container: nil, context_management: nil, diagnostics: nil, fallback_credit_token: nil, fallbacks: nil, inference_geo: nil, mcp_servers: nil, metadata: nil, output_config: nil, output_format: nil, service_tier: nil, speed: nil, stop_sequences: nil, system_: nil, thinking: nil, thread: nil, tool_choice: nil, tools: nil, betas: nil, user_profile_id: nil, workspace_id: nil, request_options: {})
|
|
322
371
|
#
|
|
323
372
|
# @param max_tokens [Integer] Body param: The maximum number of tokens to generate before stopping.
|
|
324
373
|
#
|
|
@@ -360,6 +409,8 @@ module Anthropic
|
|
|
360
409
|
#
|
|
361
410
|
# @param thinking [Anthropic::Models::Beta::BetaThinkingConfigEnabled, Anthropic::Models::Beta::BetaThinkingConfigDisabled, Anthropic::Models::Beta::BetaThinkingConfigBetweenTools, Anthropic::Models::Beta::BetaThinkingConfigAdaptive] Body param: Configuration for Claude's thinking.
|
|
362
411
|
#
|
|
412
|
+
# @param thread [Anthropic::Models::Beta::BetaThreadCreateParams, Anthropic::Models::Beta::BetaThreadContinueParams, nil] Body param: Server-held conversation state (a Thread). `{"type": "create"}` asks
|
|
413
|
+
#
|
|
363
414
|
# @param tool_choice [Anthropic::Models::Beta::BetaToolChoiceAuto, Anthropic::Models::Beta::BetaToolChoiceAny, Anthropic::Models::Beta::BetaToolChoiceTool, Anthropic::Models::Beta::BetaToolChoiceNone] Body param: How the model should use the provided tools. The model can use a spe
|
|
364
415
|
#
|
|
365
416
|
# @param tools [Array<Anthropic::Models::Beta::BetaTool, Anthropic::Models::Beta::BetaToolBash20241022, Anthropic::Models::Beta::BetaToolBash20250124, Anthropic::Models::Beta::BetaCodeExecutionTool20250522, Anthropic::Models::Beta::BetaCodeExecutionTool20250825, Anthropic::Models::Beta::BetaCodeExecutionTool20260120, Anthropic::Models::Beta::BetaCodeExecutionTool20260521, Anthropic::Models::Beta::BetaBrowserToolset20260801, Anthropic::Models::Beta::BetaToolComputerUse20241022, Anthropic::Models::Beta::BetaMemoryTool20250818, Anthropic::Models::Beta::BetaToolComputerUse20250124, Anthropic::Models::Beta::BetaToolTextEditor20241022, Anthropic::Models::Beta::BetaToolComputerUse20251124, Anthropic::Models::Beta::BetaComputerToolset20260801, Anthropic::Models::Beta::BetaToolTextEditor20250124, Anthropic::Models::Beta::BetaToolTextEditor20250429, Anthropic::Models::Beta::BetaToolTextEditor20250728, Anthropic::Models::Beta::BetaWebSearchTool20250305, Anthropic::Models::Beta::BetaWebFetchTool20250910, Anthropic::Models::Beta::BetaWebSearchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260209, Anthropic::Models::Beta::BetaWebFetchTool20260309, Anthropic::Models::Beta::BetaWebSearchTool20260318, Anthropic::Models::Beta::BetaWebFetchTool20260318, Anthropic::Models::Beta::BetaAdvisorTool20260301, Anthropic::Models::Beta::BetaToolSearchToolBm25_20251119, Anthropic::Models::Beta::BetaToolSearchToolRegex20251119, Anthropic::Models::Beta::BetaMCPToolset>] Body param: Definitions of tools that the model may use.
|
|
@@ -381,6 +432,29 @@ module Anthropic
|
|
|
381
432
|
|
|
382
433
|
private
|
|
383
434
|
|
|
435
|
+
# The message thread of a tool runner, `nil` when the runner sends the whole history with
|
|
436
|
+
# every request. Removes `thread` from `params`.
|
|
437
|
+
#
|
|
438
|
+
# @param params [Hash{Symbol=>Object}]
|
|
439
|
+
#
|
|
440
|
+
# @return [Anthropic::Helpers::Threads::BetaMessageThread, nil]
|
|
441
|
+
def runner_thread(params)
|
|
442
|
+
thread = params.delete(:thread)
|
|
443
|
+
unless thread.nil? || thread == false
|
|
444
|
+
raise ArgumentError.new(
|
|
445
|
+
"`thread` on a tool runner can only be `false`, got #{thread.inspect}. " \
|
|
446
|
+
"The runner sets `thread` for each request itself."
|
|
447
|
+
)
|
|
448
|
+
end
|
|
449
|
+
return nil if thread == false || !@client.message_threads?
|
|
450
|
+
|
|
451
|
+
Anthropic::Helpers::Threads::BetaMessageThread.new(
|
|
452
|
+
@client,
|
|
453
|
+
params: {},
|
|
454
|
+
unsupported_request_behavior: :continue_unthreaded
|
|
455
|
+
)
|
|
456
|
+
end
|
|
457
|
+
|
|
384
458
|
def warn_thinking_enabled(parsed)
|
|
385
459
|
if Anthropic::Resources::Messages::MODELS_TO_WARN_WITH_THINKING_ENABLED.include?(parsed[:model]) &&
|
|
386
460
|
parsed[:thinking] &&
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Anthropic
|
|
4
|
+
module Resources
|
|
5
|
+
class Beta
|
|
6
|
+
class Organization
|
|
7
|
+
class Analytics
|
|
8
|
+
class Cost
|
|
9
|
+
# Get cost in USD across a date range, broken out by dimension.
|
|
10
|
+
#
|
|
11
|
+
# Returns one row per combination of the requested `group_by[]` dimensions (and
|
|
12
|
+
# time bucket, when `time_bucket_width` is set) that has cost in the range, ranked
|
|
13
|
+
# by spend or ordered by time bucket; every combination is returned across pages.
|
|
14
|
+
# With no `group_by[]` and no `time_bucket_width`, a single row aggregates the
|
|
15
|
+
# whole range. Includes all cost, whether or not it is attributable to a seat
|
|
16
|
+
# user. Requires an API key with the `read:analytics` scope, or an Admin API key.
|
|
17
|
+
#
|
|
18
|
+
# Some parameter documentations has been truncated, see
|
|
19
|
+
# {Anthropic::Models::Beta::Organization::Analytics::CostListParams} for more
|
|
20
|
+
# details.
|
|
21
|
+
#
|
|
22
|
+
# @overload list(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: {})
|
|
23
|
+
#
|
|
24
|
+
# @param starting_at [Time] Query param: Start of range, inclusive. RFC 3339 tz-aware. Must be within the la
|
|
25
|
+
#
|
|
26
|
+
# @param actor_ids [Array<String>, nil] Query param: Filter to usage attributed to specific identities, by tagged ID: a
|
|
27
|
+
#
|
|
28
|
+
# @param actor_types [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsActorType>, nil] Query param: Filter to usage attributed to specific kinds of identity. Use `grou
|
|
29
|
+
#
|
|
30
|
+
# @param agent_ids [Array<String>, nil] Query param: Filter to usage incurred by sessions of specific Claude Managed Age
|
|
31
|
+
#
|
|
32
|
+
# @param api_key_ids [Array<String>, nil] Query param: Filter to usage authenticated by specific API keys, by tagged API k
|
|
33
|
+
#
|
|
34
|
+
# @param claude_tag_categories [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsClaudeTagCategory>, nil] Query param: Filter to Claude Tag (Claude in Slack) usage in specific spend cate
|
|
35
|
+
#
|
|
36
|
+
# @param claude_tag_user_ids [Array<String>, nil] Query param: Filter to Claude Tag (Claude in Slack) usage attributed to specific
|
|
37
|
+
#
|
|
38
|
+
# @param context_windows [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsContextWindow>, nil] Query param: Filter to specific context-window pricing tiers. Use `group_by[]=co
|
|
39
|
+
#
|
|
40
|
+
# @param deployment_ids [Array<String>, nil] Query param: Filter to usage incurred by Claude Managed Agents sessions that spe
|
|
41
|
+
#
|
|
42
|
+
# @param ending_at [Time, nil] Query param: End of range, exclusive. Required when `time_bucket_width` is set.
|
|
43
|
+
#
|
|
44
|
+
# @param environment_ids [Array<String>, nil] Query param: Filter to usage incurred by Claude Managed Agents sessions that ran
|
|
45
|
+
#
|
|
46
|
+
# @param exclude_deleted_users [Boolean] Query param: If true, omit rows whose `actor` is a `user_actor` with `deleted: t
|
|
47
|
+
#
|
|
48
|
+
# @param group_by [Array<Symbol, Anthropic::Models::Beta::Organization::Analytics::BetaAnalyticsCostGroupBy>, nil] Query param: Dimensions to break cost out by (at most 5, not counting `cost_type
|
|
49
|
+
#
|
|
50
|
+
# @param inference_geos [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsInferenceGeoFilter>, nil] Query param: Filter to specific inference regions. `not_available` matches rows
|
|
51
|
+
#
|
|
52
|
+
# @param limit [Integer] Query param: Number of rows per page (1-1000, default 20). `cost_type`/`token_ty
|
|
53
|
+
#
|
|
54
|
+
# @param models [Array<String>, nil] Query param: Models to include. Defaults to all models. Use `group_by[]=model` t
|
|
55
|
+
#
|
|
56
|
+
# @param order [Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsUsageCostSortOrder] Query param: Sort direction of the `order_by` metric, or of the time buckets whe
|
|
57
|
+
#
|
|
58
|
+
# @param order_by [Symbol, Anthropic::Models::Beta::Organization::Analytics::BetaAnalyticsCostOrderBy] Query param: Row order. A metric ranks rows by that metric in the `order` direct
|
|
59
|
+
#
|
|
60
|
+
# @param page [String, nil] Query param: Opaque cursor from a previous response's `next_page` field.
|
|
61
|
+
#
|
|
62
|
+
# @param products [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsUsageCostProductFilter>, nil] Query param: Product surfaces to include. Defaults to all products.
|
|
63
|
+
#
|
|
64
|
+
# @param rbac_group_ids [Array<String>, nil] Query param: Filter to usage attributed to specific RBAC groups. Accepts tagged
|
|
65
|
+
#
|
|
66
|
+
# @param service_tiers [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsServiceTier>, nil] Query param: Filter to specific service tiers. Use `group_by[]=service_tier` to
|
|
67
|
+
#
|
|
68
|
+
# @param session_ids [Array<String>, nil] Query param: Filter to usage incurred by specific Claude Managed Agents sessions
|
|
69
|
+
#
|
|
70
|
+
# @param slack_channel_ids [Array<String>, nil] Query param: Filter to usage originating from specific Slack channels. Use `grou
|
|
71
|
+
#
|
|
72
|
+
# @param speeds [Array<Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsSpeed>, nil] Query param: Filter to fast or standard inference mode. Use `group_by[]=speed` t
|
|
73
|
+
#
|
|
74
|
+
# @param time_bucket_width [Symbol, Anthropic::Models::Beta::Organization::BetaAnalyticsTimeBucketWidth, nil] Query param: Time-bucket granularity. When set, rows are returned per time bucke
|
|
75
|
+
#
|
|
76
|
+
# @param user_profile_ids [Array<String>, nil] Query param: Filter to usage attributed to specific user profiles, by tagged use
|
|
77
|
+
#
|
|
78
|
+
# @param workspace_ids [Array<String>, nil] Query param: Filter to usage in specific workspaces, by tagged workspace ID (`wr
|
|
79
|
+
#
|
|
80
|
+
# @param betas [Array<Symbol, String, Anthropic::Models::AnthropicBeta>] Header param: This endpoint is in beta: requests must send `analytics-usage-cost
|
|
81
|
+
#
|
|
82
|
+
# @param request_options [Anthropic::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
83
|
+
#
|
|
84
|
+
# @return [Anthropic::Internal::ReportPageCursor<Anthropic::Models::Beta::Organization::Analytics::BetaAnalyticsCostItem>]
|
|
85
|
+
#
|
|
86
|
+
# @see Anthropic::Models::Beta::Organization::Analytics::CostListParams
|
|
87
|
+
def list(params)
|
|
88
|
+
query_params =
|
|
89
|
+
[
|
|
90
|
+
:starting_at,
|
|
91
|
+
:actor_ids,
|
|
92
|
+
:actor_types,
|
|
93
|
+
:agent_ids,
|
|
94
|
+
:api_key_ids,
|
|
95
|
+
:claude_tag_categories,
|
|
96
|
+
:claude_tag_user_ids,
|
|
97
|
+
:context_windows,
|
|
98
|
+
:deployment_ids,
|
|
99
|
+
:ending_at,
|
|
100
|
+
:environment_ids,
|
|
101
|
+
:exclude_deleted_users,
|
|
102
|
+
:group_by,
|
|
103
|
+
:inference_geos,
|
|
104
|
+
:limit,
|
|
105
|
+
:models,
|
|
106
|
+
:order,
|
|
107
|
+
:order_by,
|
|
108
|
+
:page,
|
|
109
|
+
:products,
|
|
110
|
+
:rbac_group_ids,
|
|
111
|
+
:service_tiers,
|
|
112
|
+
:session_ids,
|
|
113
|
+
:slack_channel_ids,
|
|
114
|
+
:speeds,
|
|
115
|
+
:time_bucket_width,
|
|
116
|
+
:user_profile_ids,
|
|
117
|
+
:workspace_ids
|
|
118
|
+
]
|
|
119
|
+
parsed, options = Anthropic::Beta::Organization::Analytics::CostListParams.dump_request(params)
|
|
120
|
+
query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
|
|
121
|
+
@client.request(
|
|
122
|
+
span_name: Anthropic::Internal::Tracing::SpanName::ORGANIZATION_ANALYTICS_COST_LIST,
|
|
123
|
+
span_route: "/v1/organizations/analytics/cost",
|
|
124
|
+
span_query: %w[
|
|
125
|
+
actor_ids
|
|
126
|
+
actor_types
|
|
127
|
+
agent_ids
|
|
128
|
+
api_key_ids
|
|
129
|
+
claude_tag_categories
|
|
130
|
+
claude_tag_user_ids
|
|
131
|
+
context_windows
|
|
132
|
+
deployment_ids
|
|
133
|
+
ending_at
|
|
134
|
+
environment_ids
|
|
135
|
+
exclude_deleted_users
|
|
136
|
+
group_by
|
|
137
|
+
inference_geos
|
|
138
|
+
limit
|
|
139
|
+
models
|
|
140
|
+
order
|
|
141
|
+
order_by
|
|
142
|
+
page
|
|
143
|
+
products
|
|
144
|
+
rbac_group_ids
|
|
145
|
+
service_tiers
|
|
146
|
+
session_ids
|
|
147
|
+
slack_channel_ids
|
|
148
|
+
speeds
|
|
149
|
+
starting_at
|
|
150
|
+
time_bucket_width
|
|
151
|
+
user_profile_ids
|
|
152
|
+
workspace_ids
|
|
153
|
+
],
|
|
154
|
+
method: :get,
|
|
155
|
+
path: "v1/organizations/analytics/cost?beta=true",
|
|
156
|
+
query: query,
|
|
157
|
+
headers: parsed.except(*query_params).transform_keys(betas: "anthropic-beta"),
|
|
158
|
+
page: Anthropic::Internal::ReportPageCursor,
|
|
159
|
+
model: Anthropic::Beta::Organization::Analytics::BetaAnalyticsCostItem,
|
|
160
|
+
options: {extra_headers: {"anthropic-beta" => "analytics-usage-cost-2026-08-24"}, **options}
|
|
161
|
+
)
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# @api private
|
|
165
|
+
#
|
|
166
|
+
# @param client [Anthropic::Client]
|
|
167
|
+
def initialize(client:)
|
|
168
|
+
@client = client
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
@@ -6,12 +6,19 @@ module Anthropic
|
|
|
6
6
|
class Organization
|
|
7
7
|
class Analytics
|
|
8
8
|
class CostReport
|
|
9
|
-
# Get cost in USD over time across a date range.
|
|
10
|
-
#
|
|
11
|
-
# Returns cost bucketed by minute, hour, or day, optionally broken down by
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
9
|
+
# [Legacy] Get cost in USD over time across a date range.
|
|
10
|
+
#
|
|
11
|
+
# Returns cost bucketed by minute, hour, or day, optionally broken down by one or
|
|
12
|
+
# more `group_by[]` dimensions, such as model or cost type. Available to
|
|
13
|
+
# organizations on a Claude Enterprise plan. Requires an API key with the
|
|
14
|
+
# `read:analytics` scope.
|
|
15
|
+
#
|
|
16
|
+
# This endpoint is one of the legacy Claude Enterprise usage and cost reports. For
|
|
17
|
+
# new integrations, use
|
|
18
|
+
# [`GET /v1/organizations/analytics/cost`](/docs/en/api/beta/organization/analytics/cost/list)
|
|
19
|
+
# in the Usage and Cost Analytics API instead. To move an existing integration,
|
|
20
|
+
# see
|
|
21
|
+
# [Migrate from the Claude Enterprise usage and cost reports](/docs/en/manage-claude/usage-cost-analytics-api#migrate-from-enterprise-analytics-reports).
|
|
15
22
|
#
|
|
16
23
|
# Some parameter documentations has been truncated, see
|
|
17
24
|
# {Anthropic::Models::Beta::Organization::Analytics::CostReportListParams} for
|