anthropic 1.79.0 → 1.81.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.
Files changed (545) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +54 -1
  3. data/README.md +1 -1
  4. data/lib/anthropic/client.rb +4 -0
  5. data/lib/anthropic/helpers/aws/client.rb +20 -3
  6. data/lib/anthropic/helpers/bedrock/client.rb +6 -0
  7. data/lib/anthropic/helpers/bedrock/mantle_client.rb +41 -2
  8. data/lib/anthropic/helpers/google_cloud/client.rb +113 -31
  9. data/lib/anthropic/helpers/refusal_fallback.rb +52 -21
  10. data/lib/anthropic/helpers/vertex/client.rb +7 -0
  11. data/lib/anthropic/internal/report_page_cursor.rb +98 -0
  12. data/lib/anthropic/internal/stream.rb +6 -13
  13. data/lib/anthropic/internal/tracing.rb +7 -4
  14. data/lib/anthropic/models/beta/agent_archive_params.rb +3 -2
  15. data/lib/anthropic/models/beta/agent_create_params.rb +3 -2
  16. data/lib/anthropic/models/beta/agent_list_params.rb +3 -2
  17. data/lib/anthropic/models/beta/agent_retrieve_params.rb +3 -2
  18. data/lib/anthropic/models/beta/agent_update_params.rb +3 -2
  19. data/lib/anthropic/models/beta/agents/version_list_params.rb +3 -2
  20. data/lib/anthropic/models/beta/beta_cache_miss_messages_changed.rb +8 -0
  21. data/lib/anthropic/models/beta/beta_cache_miss_model_changed.rb +7 -0
  22. data/lib/anthropic/models/beta/beta_cache_miss_previous_message_not_found.rb +9 -0
  23. data/lib/anthropic/models/beta/beta_cache_miss_reason.rb +22 -0
  24. data/lib/anthropic/models/beta/beta_cache_miss_system_changed.rb +7 -0
  25. data/lib/anthropic/models/beta/beta_cache_miss_tools_changed.rb +7 -0
  26. data/lib/anthropic/models/beta/beta_cache_miss_unavailable.rb +11 -0
  27. data/lib/anthropic/models/beta/beta_deleted_user_profile.rb +29 -0
  28. data/lib/anthropic/models/beta/beta_fallback_param.rb +74 -10
  29. data/lib/anthropic/models/beta/beta_managed_agents_deleted_vault.rb +2 -2
  30. data/lib/anthropic/models/beta/beta_managed_agents_memory_store.rb +28 -19
  31. data/lib/anthropic/models/beta/beta_managed_agents_vault.rb +2 -2
  32. data/lib/anthropic/models/beta/beta_thinking_types.rb +17 -2
  33. data/lib/anthropic/models/beta/beta_user_profile.rb +31 -28
  34. data/lib/anthropic/models/beta/beta_user_profile_enrollment_url.rb +1 -1
  35. data/lib/anthropic/models/beta/deployment_archive_params.rb +3 -2
  36. data/lib/anthropic/models/beta/deployment_create_params.rb +3 -2
  37. data/lib/anthropic/models/beta/deployment_list_params.rb +3 -2
  38. data/lib/anthropic/models/beta/deployment_pause_params.rb +3 -2
  39. data/lib/anthropic/models/beta/deployment_retrieve_params.rb +3 -2
  40. data/lib/anthropic/models/beta/deployment_run_list_params.rb +3 -2
  41. data/lib/anthropic/models/beta/deployment_run_params.rb +3 -2
  42. data/lib/anthropic/models/beta/deployment_run_retrieve_params.rb +3 -2
  43. data/lib/anthropic/models/beta/deployment_unpause_params.rb +3 -2
  44. data/lib/anthropic/models/beta/deployment_update_params.rb +3 -2
  45. data/lib/anthropic/models/beta/dream_archive_params.rb +3 -2
  46. data/lib/anthropic/models/beta/dream_cancel_params.rb +3 -2
  47. data/lib/anthropic/models/beta/dream_create_params.rb +3 -2
  48. data/lib/anthropic/models/beta/dream_list_params.rb +3 -2
  49. data/lib/anthropic/models/beta/dream_retrieve_params.rb +3 -2
  50. data/lib/anthropic/models/beta/memory_store_archive_params.rb +8 -6
  51. data/lib/anthropic/models/beta/memory_store_create_params.rb +23 -13
  52. data/lib/anthropic/models/beta/memory_store_delete_params.rb +8 -6
  53. data/lib/anthropic/models/beta/memory_store_list_params.rb +10 -11
  54. data/lib/anthropic/models/beta/memory_store_retrieve_params.rb +5 -5
  55. data/lib/anthropic/models/beta/memory_store_update_params.rb +22 -16
  56. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_content_sha256_precondition.rb +6 -6
  57. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_deleted_memory.rb +13 -6
  58. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_error.rb +1 -1
  59. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rb +38 -26
  60. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rb +17 -10
  61. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rb +3 -2
  62. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_prefix.rb +7 -6
  63. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rb +40 -26
  64. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version_operation.rb +4 -2
  65. data/lib/anthropic/models/beta/memory_stores/beta_managed_agents_memory_view.rb +5 -5
  66. data/lib/anthropic/models/beta/memory_stores/memory_create_params.rb +21 -17
  67. data/lib/anthropic/models/beta/memory_stores/memory_delete_params.rb +3 -2
  68. data/lib/anthropic/models/beta/memory_stores/memory_list_params.rb +30 -21
  69. data/lib/anthropic/models/beta/memory_stores/memory_retrieve_params.rb +9 -8
  70. data/lib/anthropic/models/beta/memory_stores/memory_update_params.rb +22 -20
  71. data/lib/anthropic/models/beta/memory_stores/memory_version_list_params.rb +16 -12
  72. data/lib/anthropic/models/beta/memory_stores/memory_version_redact_params.rb +3 -2
  73. data/lib/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rb +9 -8
  74. data/lib/anthropic/models/beta/message_count_tokens_params.rb +11 -1
  75. data/lib/anthropic/models/beta/message_create_params.rb +11 -1
  76. data/lib/anthropic/models/beta/messages/batch_create_params.rb +13 -3
  77. data/lib/anthropic/models/beta/organization/beta_organization_rate_limit.rb +2 -1
  78. data/lib/anthropic/models/beta/organization/beta_plugin.rb +34 -9
  79. data/lib/anthropic/models/beta/organization/beta_spend_limit.rb +14 -4
  80. data/lib/anthropic/models/beta/organization/beta_spend_limit_usage_tier_scope.rb +25 -0
  81. data/lib/anthropic/models/beta/organization/beta_spend_summary.rb +28 -8
  82. data/lib/anthropic/models/beta/organization/plugin_marketplace_validate_repository_params.rb +9 -4
  83. data/lib/anthropic/models/beta/organization/plugins/beta_plugin_version.rb +13 -7
  84. data/lib/anthropic/models/beta/organization/telemetry_destination_create_params.rb +3 -2
  85. data/lib/anthropic/models/beta/organization/telemetry_destination_delete_params.rb +7 -2
  86. data/lib/anthropic/models/beta/organization/telemetry_destination_list_params.rb +3 -2
  87. data/lib/anthropic/models/beta/organization/telemetry_destination_retrieve_params.rb +7 -2
  88. data/lib/anthropic/models/beta/organization/telemetry_destination_test_params.rb +7 -2
  89. data/lib/anthropic/models/beta/organization/telemetry_destination_update_params.rb +3 -2
  90. data/lib/anthropic/models/beta/organization/telemetry_destinations/workspace_add_params.rb +7 -2
  91. data/lib/anthropic/models/beta/organization/telemetry_destinations/workspace_list_params.rb +3 -2
  92. data/lib/anthropic/models/beta/organization/telemetry_destinations/workspace_remove_params.rb +7 -2
  93. data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit.rb +1 -1
  94. data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_type.rb +29 -0
  95. data/lib/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_update_value.rb +35 -0
  96. data/lib/anthropic/models/beta/organization/workspaces/rate_limit_update_params.rb +45 -0
  97. data/lib/anthropic/models/beta/session_archive_params.rb +3 -2
  98. data/lib/anthropic/models/beta/session_create_params.rb +3 -2
  99. data/lib/anthropic/models/beta/session_delete_params.rb +3 -2
  100. data/lib/anthropic/models/beta/session_list_params.rb +3 -2
  101. data/lib/anthropic/models/beta/session_retrieve_params.rb +3 -2
  102. data/lib/anthropic/models/beta/session_update_params.rb +3 -2
  103. data/lib/anthropic/models/beta/sessions/event_list_params.rb +3 -2
  104. data/lib/anthropic/models/beta/sessions/event_send_params.rb +3 -2
  105. data/lib/anthropic/models/beta/sessions/event_stream_params.rb +3 -2
  106. data/lib/anthropic/models/beta/sessions/resource_add_params.rb +3 -2
  107. data/lib/anthropic/models/beta/sessions/resource_delete_params.rb +3 -2
  108. data/lib/anthropic/models/beta/sessions/resource_list_params.rb +3 -2
  109. data/lib/anthropic/models/beta/sessions/resource_retrieve_params.rb +3 -2
  110. data/lib/anthropic/models/beta/sessions/resource_update_params.rb +3 -2
  111. data/lib/anthropic/models/beta/sessions/thread_archive_params.rb +3 -2
  112. data/lib/anthropic/models/beta/sessions/thread_list_params.rb +3 -2
  113. data/lib/anthropic/models/beta/sessions/thread_retrieve_params.rb +3 -2
  114. data/lib/anthropic/models/beta/sessions/threads/event_list_params.rb +3 -2
  115. data/lib/anthropic/models/beta/sessions/threads/event_stream_params.rb +3 -2
  116. data/lib/anthropic/models/beta/tunnel_archive_params.rb +3 -2
  117. data/lib/anthropic/models/beta/tunnel_create_params.rb +3 -2
  118. data/lib/anthropic/models/beta/tunnel_list_params.rb +3 -2
  119. data/lib/anthropic/models/beta/tunnel_retrieve_params.rb +3 -2
  120. data/lib/anthropic/models/beta/tunnel_reveal_token_params.rb +3 -2
  121. data/lib/anthropic/models/beta/tunnel_rotate_token_params.rb +3 -2
  122. data/lib/anthropic/models/beta/tunnels/certificate_archive_params.rb +3 -2
  123. data/lib/anthropic/models/beta/tunnels/certificate_create_params.rb +3 -2
  124. data/lib/anthropic/models/beta/tunnels/certificate_list_params.rb +3 -2
  125. data/lib/anthropic/models/beta/tunnels/certificate_retrieve_params.rb +3 -2
  126. data/lib/anthropic/models/beta/user_profile_create_params.rb +10 -8
  127. data/lib/anthropic/models/beta/user_profile_delete_params.rb +48 -0
  128. data/lib/anthropic/models/beta/user_profile_update_params.rb +9 -8
  129. data/lib/anthropic/models/beta/user_profiles/action_url_create_params.rb +58 -0
  130. data/lib/anthropic/models/beta/user_profiles/beta_user_profile_action_url.rb +44 -0
  131. data/lib/anthropic/models/beta/user_profiles/beta_user_profile_enroll_end_user_action.rb +21 -0
  132. data/lib/anthropic/models/beta/vault_archive_params.rb +3 -2
  133. data/lib/anthropic/models/beta/vault_create_params.rb +3 -2
  134. data/lib/anthropic/models/beta/vault_delete_params.rb +3 -2
  135. data/lib/anthropic/models/beta/vault_list_params.rb +9 -6
  136. data/lib/anthropic/models/beta/vault_retrieve_params.rb +3 -2
  137. data/lib/anthropic/models/beta/vault_update_params.rb +3 -2
  138. data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential.rb +7 -3
  139. data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_networking_params.rb +1 -1
  140. data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rb +3 -2
  141. data/lib/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rb +2 -2
  142. data/lib/anthropic/models/beta/vaults/beta_managed_agents_deleted_credential.rb +2 -2
  143. data/lib/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_auth_response.rb +1 -1
  144. data/lib/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_create_params.rb +7 -2
  145. data/lib/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_update_params.rb +4 -4
  146. data/lib/anthropic/models/beta/vaults/beta_managed_agents_injection_location_update_params.rb +8 -1
  147. data/lib/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_params.rb +7 -5
  148. data/lib/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_response.rb +6 -4
  149. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_auth_response.rb +7 -2
  150. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_create_params.rb +10 -4
  151. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_params.rb +15 -5
  152. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_response.rb +2 -2
  153. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_update_params.rb +14 -5
  154. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_update_params.rb +14 -4
  155. data/lib/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rb +4 -3
  156. data/lib/anthropic/models/beta/vaults/beta_managed_agents_static_bearer_create_params.rb +7 -2
  157. data/lib/anthropic/models/beta/vaults/beta_managed_agents_static_bearer_update_params.rb +2 -2
  158. data/lib/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_basic_param.rb +7 -2
  159. data/lib/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_basic_update_param.rb +10 -2
  160. data/lib/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_post_param.rb +2 -2
  161. data/lib/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_post_update_param.rb +10 -2
  162. data/lib/anthropic/models/beta/vaults/credential_archive_params.rb +3 -2
  163. data/lib/anthropic/models/beta/vaults/credential_create_params.rb +11 -6
  164. data/lib/anthropic/models/beta/vaults/credential_delete_params.rb +3 -2
  165. data/lib/anthropic/models/beta/vaults/credential_list_params.rb +9 -6
  166. data/lib/anthropic/models/beta/vaults/credential_mcp_oauth_validate_params.rb +3 -2
  167. data/lib/anthropic/models/beta/vaults/credential_retrieve_params.rb +3 -2
  168. data/lib/anthropic/models/beta/vaults/credential_update_params.rb +17 -12
  169. data/lib/anthropic/models/cache_miss_messages_changed.rb +8 -0
  170. data/lib/anthropic/models/cache_miss_model_changed.rb +7 -0
  171. data/lib/anthropic/models/cache_miss_previous_message_not_found.rb +9 -0
  172. data/lib/anthropic/models/cache_miss_reason.rb +22 -0
  173. data/lib/anthropic/models/cache_miss_system_changed.rb +7 -0
  174. data/lib/anthropic/models/cache_miss_tools_changed.rb +7 -0
  175. data/lib/anthropic/models/cache_miss_unavailable.rb +11 -0
  176. data/lib/anthropic/models/deleted_user_profile.rb +25 -0
  177. data/lib/anthropic/models/message_count_tokens_params.rb +33 -2
  178. data/lib/anthropic/models/message_create_params.rb +33 -2
  179. data/lib/anthropic/models/messages/batch_create_params.rb +41 -4
  180. data/lib/anthropic/models/organization/organization_rate_limit.rb +2 -1
  181. data/lib/anthropic/models/organization/workspaces/rate_limit_update_params.rb +43 -0
  182. data/lib/anthropic/models/organization/workspaces/workspace_rate_limit.rb +1 -1
  183. data/lib/anthropic/models/organization/workspaces/workspace_rate_limit_type.rb +29 -0
  184. data/lib/anthropic/models/organization/workspaces/workspace_rate_limit_update_value.rb +35 -0
  185. data/lib/anthropic/models/thinking_types.rb +17 -2
  186. data/lib/anthropic/models/usage.rb +22 -1
  187. data/lib/anthropic/models/user_profile.rb +108 -0
  188. data/lib/anthropic/models/user_profile_access_type.rb +23 -0
  189. data/lib/anthropic/models/user_profile_create_params.rb +74 -0
  190. data/lib/anthropic/models/user_profile_cyber_program.rb +52 -0
  191. data/lib/anthropic/models/user_profile_cyber_requirements.rb +35 -0
  192. data/lib/anthropic/models/user_profile_cyber_tier.rb +38 -0
  193. data/lib/anthropic/models/user_profile_delete_params.rb +38 -0
  194. data/lib/anthropic/models/user_profile_efs_feature.rb +38 -0
  195. data/lib/anthropic/models/user_profile_efs_program.rb +40 -0
  196. data/lib/anthropic/models/user_profile_external_user_account_status.rb +27 -0
  197. data/lib/anthropic/models/user_profile_external_user_details.rb +78 -0
  198. data/lib/anthropic/models/user_profile_external_user_details_params.rb +79 -0
  199. data/lib/anthropic/models/user_profile_external_user_entity_type.rb +19 -0
  200. data/lib/anthropic/models/user_profile_list_order.rb +19 -0
  201. data/lib/anthropic/models/user_profile_list_order_by.rb +20 -0
  202. data/lib/anthropic/models/user_profile_list_params.rb +67 -0
  203. data/lib/anthropic/models/user_profile_program_status.rb +23 -0
  204. data/lib/anthropic/models/user_profile_programs.rb +41 -0
  205. data/lib/anthropic/models/user_profile_retrieve_params.rb +38 -0
  206. data/lib/anthropic/models/user_profile_update_params.rb +78 -0
  207. data/lib/anthropic/models/user_profiles/action_url_create_params.rb +48 -0
  208. data/lib/anthropic/models/user_profiles/user_profile_action_url.rb +43 -0
  209. data/lib/anthropic/models/user_profiles/user_profile_enroll_end_user_action.rb +21 -0
  210. data/lib/anthropic/models.rb +44 -0
  211. data/lib/anthropic/resources/beta/agents/versions.rb +1 -1
  212. data/lib/anthropic/resources/beta/agents.rb +5 -5
  213. data/lib/anthropic/resources/beta/deployment_runs.rb +2 -2
  214. data/lib/anthropic/resources/beta/deployments.rb +8 -8
  215. data/lib/anthropic/resources/beta/dreams.rb +5 -5
  216. data/lib/anthropic/resources/beta/memory_stores/memories.rb +22 -22
  217. data/lib/anthropic/resources/beta/memory_stores/memory_versions.rb +9 -9
  218. data/lib/anthropic/resources/beta/memory_stores.rb +25 -25
  219. data/lib/anthropic/resources/beta/messages.rb +63 -111
  220. data/lib/anthropic/resources/beta/organization/analytics/cost_report.rb +2 -2
  221. data/lib/anthropic/resources/beta/organization/analytics/usage_report.rb +2 -2
  222. data/lib/anthropic/resources/beta/organization/analytics/user_cost_report.rb +2 -2
  223. data/lib/anthropic/resources/beta/organization/analytics/user_usage_report.rb +2 -2
  224. data/lib/anthropic/resources/beta/organization/spend_limits.rb +3 -2
  225. data/lib/anthropic/resources/beta/organization/telemetry_destinations/workspaces.rb +11 -3
  226. data/lib/anthropic/resources/beta/organization/telemetry_destinations.rb +18 -6
  227. data/lib/anthropic/resources/beta/organization/workspaces/rate_limits.rb +53 -0
  228. data/lib/anthropic/resources/beta/sessions/events.rb +3 -3
  229. data/lib/anthropic/resources/beta/sessions/resources.rb +5 -5
  230. data/lib/anthropic/resources/beta/sessions/threads/events.rb +2 -2
  231. data/lib/anthropic/resources/beta/sessions/threads.rb +3 -3
  232. data/lib/anthropic/resources/beta/sessions.rb +6 -6
  233. data/lib/anthropic/resources/beta/tunnels/certificates.rb +4 -4
  234. data/lib/anthropic/resources/beta/tunnels.rb +6 -6
  235. data/lib/anthropic/resources/beta/user_profiles/action_urls.rb +54 -0
  236. data/lib/anthropic/resources/beta/user_profiles.rb +36 -0
  237. data/lib/anthropic/resources/beta/vaults/credentials.rb +16 -16
  238. data/lib/anthropic/resources/beta/vaults.rb +13 -13
  239. data/lib/anthropic/resources/messages.rb +64 -90
  240. data/lib/anthropic/resources/organization/workspaces/rate_limits.rb +49 -0
  241. data/lib/anthropic/resources/user_profiles/action_urls.rb +50 -0
  242. data/lib/anthropic/resources/user_profiles.rb +196 -0
  243. data/lib/anthropic/version.rb +1 -1
  244. data/lib/anthropic.rb +40 -0
  245. data/rbi/anthropic/client.rbi +3 -0
  246. data/rbi/anthropic/helpers/aws/client.rbi +13 -0
  247. data/rbi/anthropic/helpers/bedrock/client.rbi +4 -0
  248. data/rbi/anthropic/helpers/bedrock/mantle_client.rbi +9 -0
  249. data/rbi/anthropic/helpers/google_cloud/client.rbi +19 -2
  250. data/rbi/anthropic/helpers/vertex/client.rbi +4 -0
  251. data/rbi/anthropic/internal/report_page_cursor.rbi +28 -0
  252. data/rbi/anthropic/internal/tracing.rbi +9 -4
  253. data/rbi/anthropic/models/beta/agent_archive_params.rbi +4 -2
  254. data/rbi/anthropic/models/beta/agent_create_params.rbi +4 -2
  255. data/rbi/anthropic/models/beta/agent_list_params.rbi +4 -2
  256. data/rbi/anthropic/models/beta/agent_retrieve_params.rbi +4 -2
  257. data/rbi/anthropic/models/beta/agent_update_params.rbi +4 -2
  258. data/rbi/anthropic/models/beta/agents/version_list_params.rbi +4 -2
  259. data/rbi/anthropic/models/beta/beta_cache_miss_messages_changed.rbi +7 -0
  260. data/rbi/anthropic/models/beta/beta_cache_miss_model_changed.rbi +6 -0
  261. data/rbi/anthropic/models/beta/beta_cache_miss_previous_message_not_found.rbi +8 -0
  262. data/rbi/anthropic/models/beta/beta_cache_miss_system_changed.rbi +6 -0
  263. data/rbi/anthropic/models/beta/beta_cache_miss_tools_changed.rbi +6 -0
  264. data/rbi/anthropic/models/beta/beta_cache_miss_unavailable.rbi +10 -0
  265. data/rbi/anthropic/models/beta/beta_deleted_user_profile.rbi +40 -0
  266. data/rbi/anthropic/models/beta/beta_fallback_param.rbi +116 -9
  267. data/rbi/anthropic/models/beta/beta_managed_agents_deleted_vault.rbi +2 -2
  268. data/rbi/anthropic/models/beta/beta_managed_agents_memory_store.rbi +44 -26
  269. data/rbi/anthropic/models/beta/beta_managed_agents_vault.rbi +2 -2
  270. data/rbi/anthropic/models/beta/beta_thinking_types.rbi +31 -2
  271. data/rbi/anthropic/models/beta/beta_user_profile.rbi +50 -43
  272. data/rbi/anthropic/models/beta/beta_user_profile_enrollment_url.rbi +1 -1
  273. data/rbi/anthropic/models/beta/deployment_archive_params.rbi +4 -2
  274. data/rbi/anthropic/models/beta/deployment_create_params.rbi +4 -2
  275. data/rbi/anthropic/models/beta/deployment_list_params.rbi +4 -2
  276. data/rbi/anthropic/models/beta/deployment_pause_params.rbi +4 -2
  277. data/rbi/anthropic/models/beta/deployment_retrieve_params.rbi +4 -2
  278. data/rbi/anthropic/models/beta/deployment_run_list_params.rbi +4 -2
  279. data/rbi/anthropic/models/beta/deployment_run_params.rbi +4 -2
  280. data/rbi/anthropic/models/beta/deployment_run_retrieve_params.rbi +4 -2
  281. data/rbi/anthropic/models/beta/deployment_unpause_params.rbi +4 -2
  282. data/rbi/anthropic/models/beta/deployment_update_params.rbi +4 -2
  283. data/rbi/anthropic/models/beta/dream_archive_params.rbi +4 -2
  284. data/rbi/anthropic/models/beta/dream_cancel_params.rbi +4 -2
  285. data/rbi/anthropic/models/beta/dream_create_params.rbi +4 -2
  286. data/rbi/anthropic/models/beta/dream_list_params.rbi +4 -2
  287. data/rbi/anthropic/models/beta/dream_retrieve_params.rbi +4 -2
  288. data/rbi/anthropic/models/beta/memory_store_archive_params.rbi +12 -8
  289. data/rbi/anthropic/models/beta/memory_store_create_params.rbi +38 -18
  290. data/rbi/anthropic/models/beta/memory_store_delete_params.rbi +12 -8
  291. data/rbi/anthropic/models/beta/memory_store_list_params.rbi +12 -14
  292. data/rbi/anthropic/models/beta/memory_store_retrieve_params.rbi +6 -6
  293. data/rbi/anthropic/models/beta/memory_store_update_params.rbi +34 -22
  294. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_content_sha256_precondition.rbi +6 -6
  295. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_deleted_memory.rbi +13 -6
  296. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory.rbi +54 -36
  297. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_list_item.rbi +25 -18
  298. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_path_conflict_error.rbi +3 -2
  299. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_prefix.rbi +7 -6
  300. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version.rbi +60 -38
  301. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_version_operation.rbi +4 -2
  302. data/rbi/anthropic/models/beta/memory_stores/beta_managed_agents_memory_view.rbi +5 -5
  303. data/rbi/anthropic/models/beta/memory_stores/memory_create_params.rbi +34 -26
  304. data/rbi/anthropic/models/beta/memory_stores/memory_delete_params.rbi +4 -2
  305. data/rbi/anthropic/models/beta/memory_stores/memory_list_params.rbi +48 -30
  306. data/rbi/anthropic/models/beta/memory_stores/memory_retrieve_params.rbi +14 -12
  307. data/rbi/anthropic/models/beta/memory_stores/memory_update_params.rbi +36 -32
  308. data/rbi/anthropic/models/beta/memory_stores/memory_version_list_params.rbi +26 -18
  309. data/rbi/anthropic/models/beta/memory_stores/memory_version_redact_params.rbi +4 -2
  310. data/rbi/anthropic/models/beta/memory_stores/memory_version_retrieve_params.rbi +14 -12
  311. data/rbi/anthropic/models/beta/message_count_tokens_params.rbi +17 -2
  312. data/rbi/anthropic/models/beta/message_create_params.rbi +17 -2
  313. data/rbi/anthropic/models/beta/messages/batch_create_params.rbi +21 -6
  314. data/rbi/anthropic/models/beta/organization/beta_organization_rate_limit.rbi +4 -2
  315. data/rbi/anthropic/models/beta/organization/beta_plugin.rbi +49 -11
  316. data/rbi/anthropic/models/beta/organization/beta_spend_limit.rbi +9 -2
  317. data/rbi/anthropic/models/beta/organization/beta_spend_limit_usage_tier_scope.rbi +38 -0
  318. data/rbi/anthropic/models/beta/organization/beta_spend_summary.rbi +18 -4
  319. data/rbi/anthropic/models/beta/organization/plugin_marketplace_validate_repository_params.rbi +18 -8
  320. data/rbi/anthropic/models/beta/organization/plugins/beta_plugin_version.rbi +20 -8
  321. data/rbi/anthropic/models/beta/organization/telemetry_destination_create_params.rbi +4 -2
  322. data/rbi/anthropic/models/beta/organization/telemetry_destination_delete_params.rbi +4 -2
  323. data/rbi/anthropic/models/beta/organization/telemetry_destination_list_params.rbi +4 -2
  324. data/rbi/anthropic/models/beta/organization/telemetry_destination_retrieve_params.rbi +4 -2
  325. data/rbi/anthropic/models/beta/organization/telemetry_destination_test_params.rbi +4 -2
  326. data/rbi/anthropic/models/beta/organization/telemetry_destination_update_params.rbi +4 -2
  327. data/rbi/anthropic/models/beta/organization/telemetry_destinations/workspace_add_params.rbi +4 -2
  328. data/rbi/anthropic/models/beta/organization/telemetry_destinations/workspace_list_params.rbi +4 -2
  329. data/rbi/anthropic/models/beta/organization/telemetry_destinations/workspace_remove_params.rbi +4 -2
  330. data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_type.rbi +81 -0
  331. data/rbi/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_update_value.rbi +62 -0
  332. data/rbi/anthropic/models/beta/organization/workspaces/rate_limit_update_params.rbi +80 -0
  333. data/rbi/anthropic/models/beta/session_archive_params.rbi +4 -2
  334. data/rbi/anthropic/models/beta/session_create_params.rbi +4 -2
  335. data/rbi/anthropic/models/beta/session_delete_params.rbi +4 -2
  336. data/rbi/anthropic/models/beta/session_list_params.rbi +4 -2
  337. data/rbi/anthropic/models/beta/session_retrieve_params.rbi +4 -2
  338. data/rbi/anthropic/models/beta/session_update_params.rbi +4 -2
  339. data/rbi/anthropic/models/beta/sessions/event_list_params.rbi +4 -2
  340. data/rbi/anthropic/models/beta/sessions/event_send_params.rbi +4 -2
  341. data/rbi/anthropic/models/beta/sessions/event_stream_params.rbi +4 -2
  342. data/rbi/anthropic/models/beta/sessions/resource_add_params.rbi +4 -2
  343. data/rbi/anthropic/models/beta/sessions/resource_delete_params.rbi +4 -2
  344. data/rbi/anthropic/models/beta/sessions/resource_list_params.rbi +4 -2
  345. data/rbi/anthropic/models/beta/sessions/resource_retrieve_params.rbi +4 -2
  346. data/rbi/anthropic/models/beta/sessions/resource_update_params.rbi +4 -2
  347. data/rbi/anthropic/models/beta/sessions/thread_archive_params.rbi +4 -2
  348. data/rbi/anthropic/models/beta/sessions/thread_list_params.rbi +4 -2
  349. data/rbi/anthropic/models/beta/sessions/thread_retrieve_params.rbi +4 -2
  350. data/rbi/anthropic/models/beta/sessions/threads/event_list_params.rbi +4 -2
  351. data/rbi/anthropic/models/beta/sessions/threads/event_stream_params.rbi +4 -2
  352. data/rbi/anthropic/models/beta/tunnel_archive_params.rbi +4 -2
  353. data/rbi/anthropic/models/beta/tunnel_create_params.rbi +4 -2
  354. data/rbi/anthropic/models/beta/tunnel_list_params.rbi +4 -2
  355. data/rbi/anthropic/models/beta/tunnel_retrieve_params.rbi +4 -2
  356. data/rbi/anthropic/models/beta/tunnel_reveal_token_params.rbi +4 -2
  357. data/rbi/anthropic/models/beta/tunnel_rotate_token_params.rbi +4 -2
  358. data/rbi/anthropic/models/beta/tunnels/certificate_archive_params.rbi +4 -2
  359. data/rbi/anthropic/models/beta/tunnels/certificate_create_params.rbi +4 -2
  360. data/rbi/anthropic/models/beta/tunnels/certificate_list_params.rbi +4 -2
  361. data/rbi/anthropic/models/beta/tunnels/certificate_retrieve_params.rbi +4 -2
  362. data/rbi/anthropic/models/beta/user_profile_create_params.rbi +20 -16
  363. data/rbi/anthropic/models/beta/user_profile_delete_params.rbi +91 -0
  364. data/rbi/anthropic/models/beta/user_profile_update_params.rbi +18 -16
  365. data/rbi/anthropic/models/beta/user_profiles/action_url_create_params.rbi +116 -0
  366. data/rbi/anthropic/models/beta/user_profiles/beta_user_profile_action_url.rbi +55 -0
  367. data/rbi/anthropic/models/beta/user_profiles/beta_user_profile_enroll_end_user_action.rbi +31 -0
  368. data/rbi/anthropic/models/beta/vault_archive_params.rbi +4 -2
  369. data/rbi/anthropic/models/beta/vault_create_params.rbi +4 -2
  370. data/rbi/anthropic/models/beta/vault_delete_params.rbi +4 -2
  371. data/rbi/anthropic/models/beta/vault_list_params.rbi +12 -6
  372. data/rbi/anthropic/models/beta/vault_retrieve_params.rbi +4 -2
  373. data/rbi/anthropic/models/beta/vault_update_params.rbi +4 -2
  374. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential.rbi +4 -3
  375. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_networking_params.rbi +6 -4
  376. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_validation.rbi +4 -2
  377. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rbi +2 -2
  378. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_deleted_credential.rbi +2 -2
  379. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_auth_response.rbi +5 -3
  380. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_create_params.rbi +4 -2
  381. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_environment_variable_update_params.rbi +4 -4
  382. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_injection_location_update_params.rbi +8 -1
  383. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_params.rbi +12 -8
  384. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_limited_credential_networking_response.rbi +10 -6
  385. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_auth_response.rbi +4 -2
  386. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_create_params.rbi +8 -4
  387. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_params.rbi +10 -5
  388. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_response.rbi +2 -2
  389. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_refresh_update_params.rbi +11 -5
  390. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_oauth_update_params.rbi +16 -4
  391. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_mcp_probe.rbi +6 -4
  392. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_static_bearer_create_params.rbi +4 -2
  393. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_static_bearer_update_params.rbi +2 -2
  394. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_basic_param.rbi +4 -2
  395. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_basic_update_param.rbi +10 -2
  396. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_post_param.rbi +2 -2
  397. data/rbi/anthropic/models/beta/vaults/beta_managed_agents_token_endpoint_auth_post_update_param.rbi +10 -2
  398. data/rbi/anthropic/models/beta/vaults/credential_archive_params.rbi +4 -2
  399. data/rbi/anthropic/models/beta/vaults/credential_create_params.rbi +12 -6
  400. data/rbi/anthropic/models/beta/vaults/credential_delete_params.rbi +4 -2
  401. data/rbi/anthropic/models/beta/vaults/credential_list_params.rbi +12 -6
  402. data/rbi/anthropic/models/beta/vaults/credential_mcp_oauth_validate_params.rbi +4 -2
  403. data/rbi/anthropic/models/beta/vaults/credential_retrieve_params.rbi +4 -2
  404. data/rbi/anthropic/models/beta/vaults/credential_update_params.rbi +21 -13
  405. data/rbi/anthropic/models/cache_miss_messages_changed.rbi +7 -0
  406. data/rbi/anthropic/models/cache_miss_model_changed.rbi +6 -0
  407. data/rbi/anthropic/models/cache_miss_previous_message_not_found.rbi +8 -0
  408. data/rbi/anthropic/models/cache_miss_system_changed.rbi +6 -0
  409. data/rbi/anthropic/models/cache_miss_tools_changed.rbi +6 -0
  410. data/rbi/anthropic/models/cache_miss_unavailable.rbi +10 -0
  411. data/rbi/anthropic/models/deleted_user_profile.rbi +33 -0
  412. data/rbi/anthropic/models/message_count_tokens_params.rbi +59 -2
  413. data/rbi/anthropic/models/message_create_params.rbi +51 -2
  414. data/rbi/anthropic/models/messages/batch_create_params.rbi +79 -6
  415. data/rbi/anthropic/models/organization/organization_rate_limit.rbi +4 -2
  416. data/rbi/anthropic/models/organization/workspaces/rate_limit_update_params.rbi +78 -0
  417. data/rbi/anthropic/models/organization/workspaces/workspace_rate_limit_type.rbi +81 -0
  418. data/rbi/anthropic/models/organization/workspaces/workspace_rate_limit_update_value.rbi +62 -0
  419. data/rbi/anthropic/models/thinking_types.rbi +27 -2
  420. data/rbi/anthropic/models/usage.rbi +29 -3
  421. data/rbi/anthropic/models/user_profile.rbi +152 -0
  422. data/rbi/anthropic/models/user_profile_access_type.rbi +34 -0
  423. data/rbi/anthropic/models/user_profile_create_params.rbi +135 -0
  424. data/rbi/anthropic/models/user_profile_cyber_program.rbi +95 -0
  425. data/rbi/anthropic/models/user_profile_cyber_requirements.rbi +52 -0
  426. data/rbi/anthropic/models/user_profile_cyber_tier.rbi +69 -0
  427. data/rbi/anthropic/models/user_profile_delete_params.rbi +67 -0
  428. data/rbi/anthropic/models/user_profile_efs_feature.rbi +69 -0
  429. data/rbi/anthropic/models/user_profile_efs_program.rbi +66 -0
  430. data/rbi/anthropic/models/user_profile_external_user_account_status.rbi +52 -0
  431. data/rbi/anthropic/models/user_profile_external_user_details.rbi +125 -0
  432. data/rbi/anthropic/models/user_profile_external_user_details_params.rbi +131 -0
  433. data/rbi/anthropic/models/user_profile_external_user_entity_type.rbi +46 -0
  434. data/rbi/anthropic/models/user_profile_list_order.rbi +28 -0
  435. data/rbi/anthropic/models/user_profile_list_order_by.rbi +30 -0
  436. data/rbi/anthropic/models/user_profile_list_params.rbi +110 -0
  437. data/rbi/anthropic/models/user_profile_program_status.rbi +34 -0
  438. data/rbi/anthropic/models/user_profile_programs.rbi +77 -0
  439. data/rbi/anthropic/models/user_profile_retrieve_params.rbi +67 -0
  440. data/rbi/anthropic/models/user_profile_update_params.rbi +130 -0
  441. data/rbi/anthropic/models/user_profiles/action_url_create_params.rbi +86 -0
  442. data/rbi/anthropic/models/user_profiles/user_profile_action_url.rbi +55 -0
  443. data/rbi/anthropic/models/user_profiles/user_profile_enroll_end_user_action.rbi +32 -0
  444. data/rbi/anthropic/models.rbi +48 -0
  445. data/rbi/anthropic/resources/beta/agents/versions.rbi +2 -1
  446. data/rbi/anthropic/resources/beta/agents.rbi +10 -5
  447. data/rbi/anthropic/resources/beta/deployment_runs.rbi +4 -2
  448. data/rbi/anthropic/resources/beta/deployments.rbi +16 -8
  449. data/rbi/anthropic/resources/beta/dreams.rbi +10 -5
  450. data/rbi/anthropic/resources/beta/memory_stores/memories.rbi +75 -56
  451. data/rbi/anthropic/resources/beta/memory_stores/memory_versions.rbi +25 -19
  452. data/rbi/anthropic/resources/beta/memory_stores.rbi +65 -44
  453. data/rbi/anthropic/resources/beta/messages/batches.rbi +3 -4
  454. data/rbi/anthropic/resources/beta/messages.rbi +207 -198
  455. data/rbi/anthropic/resources/beta/organization/analytics/cost_report.rbi +1 -1
  456. data/rbi/anthropic/resources/beta/organization/analytics/usage_report.rbi +1 -1
  457. data/rbi/anthropic/resources/beta/organization/analytics/user_cost_report.rbi +1 -1
  458. data/rbi/anthropic/resources/beta/organization/analytics/user_usage_report.rbi +1 -1
  459. data/rbi/anthropic/resources/beta/organization/plugin_marketplaces.rbi +9 -4
  460. data/rbi/anthropic/resources/beta/organization/spend_limits.rbi +3 -2
  461. data/rbi/anthropic/resources/beta/organization/telemetry_destinations/workspaces.rbi +6 -3
  462. data/rbi/anthropic/resources/beta/organization/telemetry_destinations.rbi +12 -6
  463. data/rbi/anthropic/resources/beta/organization/workspaces/rate_limits.rbi +35 -0
  464. data/rbi/anthropic/resources/beta/sessions/events.rbi +6 -3
  465. data/rbi/anthropic/resources/beta/sessions/resources.rbi +10 -5
  466. data/rbi/anthropic/resources/beta/sessions/threads/events.rbi +4 -2
  467. data/rbi/anthropic/resources/beta/sessions/threads.rbi +6 -3
  468. data/rbi/anthropic/resources/beta/sessions.rbi +12 -6
  469. data/rbi/anthropic/resources/beta/tunnels/certificates.rbi +8 -4
  470. data/rbi/anthropic/resources/beta/tunnels.rbi +12 -6
  471. data/rbi/anthropic/resources/beta/user_profiles/action_urls.rbi +46 -0
  472. data/rbi/anthropic/resources/beta/user_profiles.rbi +46 -15
  473. data/rbi/anthropic/resources/beta/vaults/credentials.rbi +27 -18
  474. data/rbi/anthropic/resources/beta/vaults.rbi +22 -13
  475. data/rbi/anthropic/resources/messages/batches.rbi +3 -4
  476. data/rbi/anthropic/resources/messages.rbi +151 -129
  477. data/rbi/anthropic/resources/organization/workspaces/rate_limits.rbi +33 -0
  478. data/rbi/anthropic/resources/user_profiles/action_urls.rbi +40 -0
  479. data/rbi/anthropic/resources/user_profiles.rbi +184 -0
  480. data/sig/anthropic/client.rbs +2 -0
  481. data/sig/anthropic/helpers/bedrock/client.rbs +2 -0
  482. data/sig/anthropic/helpers/google_cloud/client.rbs +10 -1
  483. data/sig/anthropic/helpers/vertex/client.rbs +2 -0
  484. data/sig/anthropic/internal/report_page_cursor.rbs +17 -0
  485. data/sig/anthropic/internal/tracing.rbs +7 -4
  486. data/sig/anthropic/models/beta/beta_deleted_user_profile.rbs +20 -0
  487. data/sig/anthropic/models/beta/beta_thinking_types.rbs +5 -0
  488. data/sig/anthropic/models/beta/beta_user_profile.rbs +8 -8
  489. data/sig/anthropic/models/beta/organization/beta_spend_limit.rbs +6 -0
  490. data/sig/anthropic/models/beta/organization/beta_spend_limit_usage_tier_scope.rbs +17 -0
  491. data/sig/anthropic/models/beta/organization/beta_spend_summary.rbs +12 -0
  492. data/sig/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_type.rbs +36 -0
  493. data/sig/anthropic/models/beta/organization/workspaces/beta_workspace_rate_limit_update_value.rbs +31 -0
  494. data/sig/anthropic/models/beta/organization/workspaces/rate_limit_update_params.rbs +42 -0
  495. data/sig/anthropic/models/beta/user_profile_delete_params.rbs +44 -0
  496. data/sig/anthropic/models/beta/user_profiles/action_url_create_params.rbs +51 -0
  497. data/sig/anthropic/models/beta/user_profiles/beta_user_profile_action_url.rbs +30 -0
  498. data/sig/anthropic/models/beta/user_profiles/beta_user_profile_enroll_end_user_action.rbs +18 -0
  499. data/sig/anthropic/models/beta/vaults/beta_managed_agents_credential_validation_status.rbs +2 -2
  500. data/sig/anthropic/models/deleted_user_profile.rbs +15 -0
  501. data/sig/anthropic/models/message_count_tokens_params.rbs +16 -0
  502. data/sig/anthropic/models/message_create_params.rbs +16 -0
  503. data/sig/anthropic/models/messages/batch_create_params.rbs +16 -0
  504. data/sig/anthropic/models/organization/workspaces/rate_limit_update_params.rbs +40 -0
  505. data/sig/anthropic/models/organization/workspaces/workspace_rate_limit_type.rbs +36 -0
  506. data/sig/anthropic/models/organization/workspaces/workspace_rate_limit_update_value.rbs +31 -0
  507. data/sig/anthropic/models/thinking_types.rbs +5 -0
  508. data/sig/anthropic/models/usage.rbs +19 -3
  509. data/sig/anthropic/models/user_profile.rbs +60 -0
  510. data/sig/anthropic/models/user_profile_access_type.rbs +17 -0
  511. data/sig/anthropic/models/user_profile_create_params.rbs +58 -0
  512. data/sig/anthropic/models/user_profile_cyber_program.rbs +30 -0
  513. data/sig/anthropic/models/user_profile_cyber_requirements.rbs +16 -0
  514. data/sig/anthropic/models/user_profile_cyber_tier.rbs +29 -0
  515. data/sig/anthropic/models/user_profile_delete_params.rbs +30 -0
  516. data/sig/anthropic/models/user_profile_efs_feature.rbs +29 -0
  517. data/sig/anthropic/models/user_profile_efs_program.rbs +25 -0
  518. data/sig/anthropic/models/user_profile_external_user_account_status.rbs +21 -0
  519. data/sig/anthropic/models/user_profile_external_user_details.rbs +50 -0
  520. data/sig/anthropic/models/user_profile_external_user_details_params.rbs +52 -0
  521. data/sig/anthropic/models/user_profile_external_user_entity_type.rbs +17 -0
  522. data/sig/anthropic/models/user_profile_list_order.rbs +17 -0
  523. data/sig/anthropic/models/user_profile_list_order_by.rbs +17 -0
  524. data/sig/anthropic/models/user_profile_list_params.rbs +60 -0
  525. data/sig/anthropic/models/user_profile_program_status.rbs +20 -0
  526. data/sig/anthropic/models/user_profile_programs.rbs +25 -0
  527. data/sig/anthropic/models/user_profile_retrieve_params.rbs +30 -0
  528. data/sig/anthropic/models/user_profile_update_params.rbs +59 -0
  529. data/sig/anthropic/models/user_profiles/action_url_create_params.rbs +40 -0
  530. data/sig/anthropic/models/user_profiles/user_profile_action_url.rbs +30 -0
  531. data/sig/anthropic/models/user_profiles/user_profile_enroll_end_user_action.rbs +17 -0
  532. data/sig/anthropic/models.rbs +44 -0
  533. data/sig/anthropic/resources/beta/messages.rbs +24 -24
  534. data/sig/anthropic/resources/beta/organization/analytics/cost_report.rbs +1 -1
  535. data/sig/anthropic/resources/beta/organization/analytics/usage_report.rbs +1 -1
  536. data/sig/anthropic/resources/beta/organization/analytics/user_cost_report.rbs +1 -1
  537. data/sig/anthropic/resources/beta/organization/analytics/user_usage_report.rbs +1 -1
  538. data/sig/anthropic/resources/beta/organization/workspaces/rate_limits.rbs +7 -0
  539. data/sig/anthropic/resources/beta/user_profiles/action_urls.rbs +19 -0
  540. data/sig/anthropic/resources/beta/user_profiles.rbs +9 -0
  541. data/sig/anthropic/resources/messages.rbs +22 -18
  542. data/sig/anthropic/resources/organization/workspaces/rate_limits.rbs +7 -0
  543. data/sig/anthropic/resources/user_profiles/action_urls.rbs +16 -0
  544. data/sig/anthropic/resources/user_profiles.rbs +49 -0
  545. metadata +122 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74e6cbcdcbbf6d31ad5a08947e0b061fb8be75a367c6be4aac63cf7a715279fc
4
- data.tar.gz: 9dcb1523d20c8af4dce1dadd9d6387f6dca92c0c2c8647eed98caa4a1e915197
3
+ metadata.gz: 154fbf0eeb1ef7997d8bc33f44e588fbe3fb3327aed6be57fba6d6459703d580
4
+ data.tar.gz: 974d03138f614db3ecc816de5c3d25e4862951faf84b0679ee8058758a89789e
5
5
  SHA512:
6
- metadata.gz: 4d5532e5feec100f1edd36c35e00bc9b61192624fcd785710373fcb439fdc300cc0b499142df492bdc92098ebfe4a29ec36216fb0e8636f0c0e272c42865cdd0
7
- data.tar.gz: 734afbe0a5d61ca96d6872c8ac7ee0ec771ac76b07349843b826e14cad1afa8a46619ed6ee416b3ba48405c4f3453800a174f15fe75f7e78a8f774b3384f979b
6
+ metadata.gz: e8701990520600baf05a9a240c836ba0245272b08a4df77a52d13da4d6c29cfaf4c884671ec3d2e8cec60a067ab5a859feff5630dbe1d3b796372bf691402408
7
+ data.tar.gz: bdad1379435404bc3ad2ab1534024c9a7baaa3bfbce296080e51fec7a31c9f1a95650f86c3e42ff94eb9b1dcd30c3f412bca8718148cbbd50b05b33c05624392
data/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.81.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.80.0...v1.81.0) (2026-10-20)
4
+
5
+ ### Features
6
+
7
+ * **api:** add data_refreshed_at and has_more to analytics report pages
8
+ * **api:** add workspace rate-limit updates to the Admin API
9
+ * **api:** make User Profiles generally available
10
+ * **client:** yield server-sent events with unrecognized event names
11
+ * **google-cloud:** use the v1 endpoints and add the organization endpoint
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * **client:** `messages.stream` and `beta.messages.stream` now take the same parameters as `stream_raw`; their Sorbet and RBS signatures take one params hash
17
+ * **types:** type the keyword parameters of messages.stream and beta.messages.stream
18
+
19
+
20
+ ### Chores
21
+
22
+ * **ci:** publish gems from a fixed Ubuntu 24.04 runner
23
+ * **ci:** set up Ruby 3.2 with a newer setup-ruby in the build and dependency version jobs
24
+ * **ci:** skip the changelog check on draft pull requests
25
+ * **docs:** add credential expiry descriptions to the Managed Agents API reference
26
+ * **docs:** add Messages API request descriptions
27
+ * **docs:** correct plugin manifest_version and reach descriptions
28
+ * **docs:** improve Managed Agents memory store descriptions
29
+ * **docs:** improve Managed Agents vault and credential descriptions
30
+ * **tests:** cover per-request timeouts and later union variants
31
+ * **tests:** make the tracing tests independent of test order
32
+ * **tests:** send events that the stream yields in the tracing test
33
+
34
+ ## [1.80.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.79.0...v1.80.0) (2026-10-15)
35
+
36
+ ### Features
37
+
38
+ * **api:** add between_tools to thinking types in model capabilities
39
+ * **api:** add the speed parameter and usage.speed to Messages
40
+ * **api:** return a Console organization's usage-tier spend cap as a read-only spend limit
41
+
42
+
43
+ ### Chores
44
+
45
+ * **ci:** speed up breaking change detection
46
+ * **docs:** describe headers on Managed Agents and telemetry endpoints
47
+ * **tests:** cover trace context propagation and failing telemetry
48
+
49
+
50
+ ### Documentation
51
+
52
+ * **api:** note that some models need a beta header to use speed
53
+
3
54
  ## [1.79.0](https://github.com/anthropics/anthropic-sdk-ruby/compare/v1.78.0...v1.79.0) (2026-10-14)
4
55
 
5
56
  ### Features
@@ -8,7 +59,9 @@
8
59
  * **api:** add organization_type_not_supported error to spend limit lists
9
60
  * **api:** add telemetry destination test endpoint
10
61
  * **api:** add telemetry destinations to the Admin API
11
- * **client:** add OpenTelemetry tracing for API calls, streaming and tool runs, on by default: once the application registers a tracer provider each call emits a span, and each request carries the trace context in the headers of the registered propagator, such as `traceparent`. `open_telemetry: false` or `ANTHROPIC_OPEN_TELEMETRY=false` turns both off, and `open_telemetry: {propagation: false}` or `ANTHROPIC_OPEN_TELEMETRY_PROPAGATION=false` only the headers, where a variable applies only to a client that is given no `open_telemetry` option. Adds the dependency `opentelemetry-api` (`>= 1.2.4`, `< 2`)
62
+ * **client:** add native support for OpenTelemetry tracing
63
+
64
+ If your app registers a global tracer provider, the SDK will create spans with it after upgrading, and they'll be exported with the rest of your traces. Requests will also get trace context headers from the global propagator. To disable, pass `open_telemetry: false` to the client or set `ANTHROPIC_OPEN_TELEMETRY=false`. Learn more in the [documentation](https://platform.claude.com/docs/en/manage-claude/opentelemetry/sdk).
12
65
 
13
66
 
14
67
  ### Bug Fixes
data/README.md CHANGED
@@ -15,7 +15,7 @@ Add to your application's Gemfile:
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "anthropic", "~> 1.79.0"
18
+ gem "anthropic", "~> 1.81.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -82,6 +82,9 @@ module Anthropic
82
82
  # @return [Anthropic::Resources::Skills]
83
83
  attr_reader :skills
84
84
 
85
+ # @return [Anthropic::Resources::UserProfiles]
86
+ attr_reader :user_profiles
87
+
85
88
  # @return [Anthropic::Resources::Organization]
86
89
  attr_reader :organization
87
90
 
@@ -342,6 +345,7 @@ module Anthropic
342
345
  @models = Anthropic::Resources::Models.new(client: self)
343
346
  @files = Anthropic::Resources::Files.new(client: self)
344
347
  @skills = Anthropic::Resources::Skills.new(client: self)
348
+ @user_profiles = Anthropic::Resources::UserProfiles.new(client: self)
345
349
  @organization = Anthropic::Resources::Organization.new(client: self)
346
350
  @beta = Anthropic::Resources::Beta.new(client: self)
347
351
  end
@@ -91,9 +91,9 @@ module Anthropic
91
91
 
92
92
  # In API-key mode the gateway key rides the base client's `api_key`
93
93
  # slot; {#resolve_default_credentials?} keeps first-party credential
94
- # auto-discovery out of the picture when it is absent. The gateway
95
- # serves the full first-party API, so every resource the parent wires
96
- # up stays available.
94
+ # auto-discovery out of the picture when it is absent. Every resource
95
+ # the parent wires up stays available; {#build_request} rejects the
96
+ # one route the gateway does not serve.
97
97
  super(
98
98
  api_key: effective_api_key,
99
99
  base_url: resolved_base_url,
@@ -105,6 +105,23 @@ module Anthropic
105
105
  )
106
106
  end
107
107
 
108
+ # @api private
109
+ #
110
+ # Fails fast on user profile action URLs, which the gateway does not serve.
111
+ #
112
+ # @param req [Hash{Symbol=>Object}]
113
+ # @param opts [Hash{Symbol=>Object}]
114
+ # @return [Hash{Symbol=>Object}]
115
+ private def build_request(req, opts)
116
+ # Id-parameterized routes pass `path` as an Array whose first element
117
+ # is the format string (e.g. `["v1/user_profiles/%1$s/action_urls", id]`).
118
+ if Array(req[:path]).first.to_s.match?(%r{\Av1/user_profiles/[^/]+/action_urls})
119
+ raise NotImplementedError.new("User profile action URLs are not supported on the AWS gateway.")
120
+ end
121
+
122
+ super
123
+ end
124
+
108
125
  # @api private
109
126
  #
110
127
  # @return [String]
@@ -169,6 +169,10 @@ module Anthropic
169
169
  raise NotImplementedError, "Skills are not supported on Bedrock."
170
170
  end
171
171
 
172
+ def user_profiles
173
+ raise NotImplementedError, "User profiles are not supported on Bedrock."
174
+ end
175
+
172
176
  # @api private
173
177
  #
174
178
  # @param req [Hash{Symbol=>Object}] .
@@ -318,6 +322,8 @@ module Anthropic
318
322
  message = "Please instead use https://docs.anthropic.com/en/api/claude-on-amazon-bedrock#list-available-models to list available models on Bedrock."
319
323
  # rubocop:enable Layout/LineLength
320
324
  raise NotImplementedError.new(message)
325
+ in %r{^v1/user_profiles}
326
+ raise NotImplementedError.new("User profiles are not supported on Bedrock.")
321
327
  else
322
328
  end
323
329
  end
@@ -131,6 +131,13 @@ module Anthropic
131
131
  "Skills are not supported on Bedrock Mantle. Only Messages (/v1/messages) is supported."
132
132
  end
133
133
 
134
+ # User profiles are not supported on Bedrock Mantle. Only Messages (/v1/messages) is supported.
135
+ def user_profiles
136
+ raise NotImplementedError,
137
+ "User profiles are not supported on Bedrock Mantle. " \
138
+ "Only Messages (/v1/messages) is supported."
139
+ end
140
+
134
141
  # @api private
135
142
  #
136
143
  # @return [Hash{String=>String}]
@@ -146,10 +153,36 @@ module Anthropic
146
153
  # @api private
147
154
  #
148
155
  # @return [#call]
149
- private def provider_middleware = method(:aws_auth_provider)
156
+ private def provider_middleware
157
+ ->(req, nxt) { aws_auth_provider(adapt_request(req), nxt) }
158
+ end
159
+
160
+ # @api private
161
+ #
162
+ # Mantle drops custom request headers, so Messages and token counting send the user profile ID
163
+ # in the body.
164
+ #
165
+ # @param req [Anthropic::APIRequest]
166
+ # @return [Anthropic::APIRequest]
167
+ private def adapt_request(req)
168
+ path = req.url.path.to_s
169
+ return req unless req.method == :post && path.end_with?("/v1/messages", "/v1/messages/count_tokens")
170
+
171
+ body = req.body
172
+ profile_headers, headers = req.headers.partition do |name, _|
173
+ name.to_s.casecmp?("anthropic-user-profile-id")
174
+ end
175
+ user_profile_id = profile_headers.last&.last
176
+ return req if user_profile_id.to_s.empty? || !body.is_a?(Hash)
177
+
178
+ unless body.keys.any? { _1.to_s == "user_profile_id" }
179
+ body = {**body, user_profile_id: user_profile_id}
180
+ end
181
+ req.with(headers: headers.to_h, body: body)
182
+ end
150
183
 
151
184
  # Restricted Beta service that only exposes messages. Other beta resources
152
- # (models, files, skills) are not supported on Bedrock Mantle.
185
+ # (models, files, skills, user profiles) are not supported on Bedrock Mantle.
153
186
  class MantleBeta
154
187
  # @return [Anthropic::Resources::Beta::Messages]
155
188
  attr_reader :messages
@@ -173,6 +206,12 @@ module Anthropic
173
206
  raise NotImplementedError,
174
207
  "Beta skills are not supported on Bedrock Mantle. Only Messages (/v1/messages) is supported."
175
208
  end
209
+
210
+ def user_profiles
211
+ raise NotImplementedError,
212
+ "Beta user profiles are not supported on Bedrock Mantle. " \
213
+ "Only Messages (/v1/messages) is supported."
214
+ end
176
215
  end
177
216
  end
178
217
  end
@@ -10,17 +10,26 @@ module Anthropic
10
10
  # `:rawPredict` publisher-model API (publisher model IDs, messages
11
11
  # only). This client speaks the full first-party Anthropic API: requests
12
12
  # pass through the gateway unchanged — standard `/v1/*` paths, standard
13
- # model names, the complete API surface. The deprecated text Completions
14
- # endpoint is intentionally not exposed.
13
+ # model names. The deprecated text Completions endpoint is intentionally
14
+ # not exposed, and the gateway does not serve the User Profiles API.
15
15
  class Client < Anthropic::Client
16
16
  # OAuth2 scope required to call the gateway.
17
17
  SCOPE = "https://www.googleapis.com/auth/cloud-platform"
18
18
 
19
+ LOCATION_URL_TEMPLATE =
20
+ "https://claude.googleapis.com/v1/projects/%<project>s/locations/%<location>s"
21
+
19
22
  # Gateway base URL template; override via `base_url` or
20
23
  # `ANTHROPIC_GOOGLE_CLOUD_BASE_URL`.
21
- URL_TEMPLATE =
22
- "https://claude.googleapis.com/v1alpha" \
23
- "/projects/%<project>s/locations/%<location>s/workspaces/%<workspace_id>s/invoke"
24
+ URL_TEMPLATE = "#{LOCATION_URL_TEMPLATE}/workspaces/%<workspace_id>s/invoke".freeze
25
+
26
+ # Gateway base URL template for organization-level routes, which are
27
+ # served from a base with no workspace in it.
28
+ ORGANIZATION_URL_TEMPLATE = "#{LOCATION_URL_TEMPLATE}/claudeOrganization/invoke".freeze
29
+
30
+ ORGANIZATION_PATH_PREFIX = "/v1/organizations/"
31
+
32
+ private_constant :LOCATION_URL_TEMPLATE, :ORGANIZATION_PATH_PREFIX
24
33
 
25
34
  # @return [String, nil]
26
35
  attr_reader :project
@@ -53,12 +62,14 @@ module Anthropic
53
62
  # explicit `nil` falls back to the same defaults.
54
63
  #
55
64
  # @param workspace_id [String, nil] Defaults to
56
- # `ENV["ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID"]`. Required unless
57
- # `skip_auth` is true and an explicit `base_url` is given.
65
+ # `ENV["ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID"]`. Required when the base
66
+ # URL is derived, except for organization-level routes
67
+ # (`/v1/organizations/`), which need no workspace ID.
58
68
  #
59
- # @param base_url [String, nil] Override the gateway base URL. Defaults to
60
- # `ENV["ANTHROPIC_GOOGLE_CLOUD_BASE_URL"]`, otherwise derived from
61
- # `project`, `location`, and `workspace_id` via {URL_TEMPLATE}.
69
+ # @param base_url [String, nil] Override the gateway base URL for every
70
+ # route. Defaults to `ENV["ANTHROPIC_GOOGLE_CLOUD_BASE_URL"]`, otherwise
71
+ # derived from `project`, `location`, and `workspace_id` via
72
+ # {URL_TEMPLATE}.
62
73
  #
63
74
  # @param google_credentials [#apply, nil] A `googleauth`-compatible
64
75
  # credentials object. Mutually exclusive with `skip_auth`.
@@ -67,10 +78,9 @@ module Anthropic
67
78
  # token string. Takes precedence over `google_credentials`. Mutually
68
79
  # exclusive with `skip_auth`.
69
80
  #
70
- # @param skip_auth [Boolean] When true, no token is attached and
71
- # `workspace_id` is only required when the base URL must be derived.
72
- # For callers fronting with their own authenticated proxy. Mutually
73
- # exclusive with `token_provider` and `google_credentials`.
81
+ # @param skip_auth [Boolean] When true, no token is attached. For callers
82
+ # fronting with their own authenticated proxy. Mutually exclusive with
83
+ # `token_provider` and `google_credentials`.
74
84
  #
75
85
  # @param max_retries [Integer] Max number of retries to attempt after a
76
86
  # failed retryable request.
@@ -132,23 +142,23 @@ module Anthropic
132
142
  # so nil can't reach the derived URL (matches the other SDKs).
133
143
  @location = location || ENV["ANTHROPIC_GOOGLE_CLOUD_LOCATION"] || "global"
134
144
 
135
- if workspace_id.nil? && !skip_auth
136
- raise ArgumentError.new(
137
- "No workspace ID was given. Set the `workspace_id` argument or the " \
138
- "`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID` environment variable."
139
- )
140
- end
141
145
  @workspace_id = workspace_id
142
146
 
143
147
  base_url = nil if base_url.to_s.empty?
144
- base_url ||= derive_base_url
148
+ unless base_url
149
+ @organization_base_url = URI.parse(derive_base_url(ORGANIZATION_URL_TEMPLATE))
150
+ # Without a workspace ID there is no workspace base to derive, so
151
+ # `base_url` is the organization base.
152
+ base_url = @workspace_id.nil? ? @organization_base_url.to_s : derive_base_url(URL_TEMPLATE)
153
+ end
145
154
 
146
155
  # No first-party credential is ever passed up, and
147
156
  # {#resolve_default_credentials?} keeps the parent from discovering
148
157
  # one; `base_url` is always resolved by this point, so the parent's
149
158
  # `ANTHROPIC_BASE_URL` fallback never applies. The parent wires up
150
- # every resource; {#completions} withholds the one the gateway does
151
- # not serve.
159
+ # every resource; {#completions} and {#user_profiles} withhold the
160
+ # ones the gateway does not serve, and {#build_request} refuses the
161
+ # user profile routes however the resource is reached.
152
162
  super(
153
163
  base_url: base_url,
154
164
  timeout: timeout,
@@ -176,6 +186,83 @@ module Anthropic
176
186
  )
177
187
  end
178
188
 
189
+ # User profiles are not supported on the Google Cloud gateway.
190
+ #
191
+ # @raise [NotImplementedError]
192
+ def user_profiles
193
+ raise NotImplementedError.new("User profiles are not supported on the Google Cloud gateway.")
194
+ end
195
+
196
+ # @api private
197
+ #
198
+ # @param req [Hash{Symbol=>Object}] .
199
+ #
200
+ # @option req [Symbol] :method
201
+ #
202
+ # @option req [String, Array<String>] :path
203
+ #
204
+ # @option req [Hash{String=>Array<String>, String, nil}, nil] :query
205
+ #
206
+ # @option req [Hash{String=>String, Integer, Array<String, Integer, nil>, nil}, nil] :headers
207
+ #
208
+ # @option req [Object, nil] :body
209
+ #
210
+ # @option req [Symbol, Integer, Array<Symbol, Integer>, Proc, nil] :unwrap
211
+ #
212
+ # @option req [Class<Anthropic::Internal::Type::BasePage>, nil] :page
213
+ #
214
+ # @option req [Class<Anthropic::Internal::Type::BaseStream>, nil] :stream
215
+ #
216
+ # @option req [Anthropic::Internal::Type::Converter, Class, nil] :model
217
+ #
218
+ # @param opts [Hash{Symbol=>Object}] .
219
+ #
220
+ # @option opts [String, nil] :idempotency_key
221
+ #
222
+ # @option opts [Hash{String=>Array<String>, String, nil}, nil] :extra_query
223
+ #
224
+ # @option opts [Hash{String=>String, nil}, nil] :extra_headers
225
+ #
226
+ # @option opts [Object, nil] :extra_body
227
+ #
228
+ # @option opts [Integer, nil] :max_retries
229
+ #
230
+ # @option opts [Float, nil] :timeout
231
+ #
232
+ # @raise [ArgumentError]
233
+ # @raise [NotImplementedError]
234
+ # @return [Hash{Symbol=>Object}]
235
+ private def build_request(req, opts)
236
+ # Id-parameterized routes pass `path` as an Array whose first element
237
+ # is the format string (e.g. `["v1/user_profiles/%1$s", id]`).
238
+ if Array(req[:path]).first.to_s.start_with?("v1/user_profiles")
239
+ raise NotImplementedError.new("User profiles are not supported on the Google Cloud gateway.")
240
+ end
241
+
242
+ request = super
243
+ return request if @organization_base_url.nil?
244
+
245
+ url = request.fetch(:url)
246
+ under_base_url =
247
+ url.path.start_with?("#{base_url.path}/") &&
248
+ Anthropic::Internal::Util.uri_origin(url) == Anthropic::Internal::Util.uri_origin(base_url)
249
+ return request unless under_base_url
250
+
251
+ path = url.path.delete_prefix(base_url.path)
252
+ if path.start_with?(ORGANIZATION_PATH_PREFIX)
253
+ url = url.dup
254
+ url.path = "#{@organization_base_url.path}#{path}"
255
+ {**request, url: url}
256
+ elsif @workspace_id.nil?
257
+ raise ArgumentError.new(
258
+ "No workspace ID was given. Set the `workspace_id` argument or the " \
259
+ "`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID` environment variable."
260
+ )
261
+ else
262
+ request
263
+ end
264
+ end
265
+
179
266
  # @api private
180
267
  #
181
268
  # Hard guarantee that no first-party `X-Api-Key` / `Authorization`
@@ -230,9 +317,10 @@ module Anthropic
230
317
 
231
318
  # @api private
232
319
  #
320
+ # @param template [String]
233
321
  # @return [String]
234
322
  # @raise [ArgumentError]
235
- private def derive_base_url
323
+ private def derive_base_url(template)
236
324
  if @project.nil?
237
325
  raise ArgumentError.new(
238
326
  "No project found. Set the `project` argument, set the " \
@@ -240,13 +328,7 @@ module Anthropic
240
328
  "application default credentials with a project."
241
329
  )
242
330
  end
243
- if @workspace_id.nil?
244
- raise ArgumentError.new(
245
- "No workspace ID was given. Set the `workspace_id` argument or the " \
246
- "`ANTHROPIC_GOOGLE_CLOUD_WORKSPACE_ID` environment variable."
247
- )
248
- end
249
- format(URL_TEMPLATE, project: @project, location: @location, workspace_id: @workspace_id)
331
+ format(template, project: @project, location: @location, workspace_id: @workspace_id)
250
332
  end
251
333
 
252
334
  # @api private
@@ -38,10 +38,11 @@ module Anthropic
38
38
  # — and the fallback's events are spliced onto the still-open stream, so the
39
39
  # client sees one continuous message: a `fallback` content block at each
40
40
  # model boundary, monotonic block indices, and per-hop `usage.iterations` on
41
- # the final `message_delta`. Only `model` is honored from each entry on this
42
- # path: the credit token is redeemable only against the refused request's
43
- # body, so the other per-entry overrides would be rejected. A
44
- # `between_tools` thinking config is always sent as `disabled` on this path.
41
+ # the final `message_delta`. Only `model` and `speed` are honored from each
42
+ # entry on this path. The other per-entry overrides are ignored, because the
43
+ # credit token is tied to the refused request's body. A `speed` value replaces
44
+ # the request's, and `speed: nil` omits it. A `between_tools` thinking config
45
+ # is always sent as `disabled` on this path.
45
46
  #
46
47
  # Credit tokens are sent in the object form with `mode: :best_effort`, so a
47
48
  # failing redemption never rejects the retry — it proceeds at normal price
@@ -49,6 +50,10 @@ module Anthropic
49
50
  # beta this requires is sent by default on every request the middleware
50
51
  # handles; the `betas:` option controls this.
51
52
  #
53
+ # A `speed: "fast"` request that falls back to an entry with no `speed`, and
54
+ # is rejected with a 429 or 529, is retried once on that entry without
55
+ # `speed`. Set `speed: "fast"` on the entry to keep it fast-only.
56
+ #
52
57
  # To keep later requests on the model that accepted, pass a
53
58
  # {BetaFallbackState} via the `fallback_state` request option; requests
54
59
  # sharing that state start directly at the pinned fallback.
@@ -72,7 +77,7 @@ module Anthropic
72
77
  # …) patch the original request body for that hop — a value overrides
73
78
  # the param, an explicit `nil` unsets it, an absent key keeps the
74
79
  # original value (an absent `thinking:` sends `between_tools` as
75
- # `disabled`).
80
+ # `disabled`). On the streaming path only `speed:` patches it.
76
81
  # @param betas [Array<String>] betas added to the `anthropic-beta` header
77
82
  # of every `/v1/messages` request this middleware handles. Defaults to
78
83
  # `["fallback-credit-2026-07-01"]`; pass `[]` to send none.
@@ -129,24 +134,24 @@ module Anthropic
129
134
  end
130
135
 
131
136
  streaming = req.streaming?
137
+ entry = @fallbacks.fetch(start_index) unless start_index == -1
132
138
  initial_body =
133
- if start_index == -1
139
+ if entry.nil?
134
140
  body
135
141
  elsif streaming
136
- # Only `model` is honored on the streaming path so the credit token
137
- # — redeemable only against the refused request's body — stays valid
138
- # for the spliced hops.
139
- degrade_between_tools(body.merge(model: @fallbacks.fetch(start_index).fetch(:model)))
142
+ # Only `model` and `speed` are honored on the streaming path: the credit
143
+ # token is tied to the refused request's body.
144
+ degrade_between_tools(patch(body, entry.slice(:speed)).merge(model: entry.fetch(:model)))
140
145
  else
141
- apply_fallback(body, @fallbacks.fetch(start_index))
146
+ apply_fallback(body, entry)
142
147
  end
143
- res = nxt.call(req.with(body: initial_body))
148
+ res = entry ? send_hop(req, nxt, entry, initial_body).first : nxt.call(req.with(body: initial_body))
144
149
  return res unless res.status < 300
145
150
 
146
151
  if streaming
147
152
  first_hop = start_index + 1
148
153
  return res unless first_hop < @fallbacks.length
149
- return splice_fallback_stream(req, res, nxt, body, first_hop, pin)
154
+ return splice_fallback_stream(req, res, nxt, initial_body, first_hop, pin)
150
155
  end
151
156
 
152
157
  handle_non_streaming(req, res, nxt, body, start_index, pin)
@@ -276,6 +281,25 @@ module Anthropic
276
281
  {token: token, mode: Anthropic::Models::Beta::BetaFallbackCreditTokenParam::Mode::BEST_EFFORT}
277
282
  end
278
283
 
284
+ # Send a request built from `entry`. One that is fast only because the
285
+ # original request was, and is rejected with a 429 or 529, is resent once
286
+ # without `speed`, and that response stands in for the first.
287
+ #
288
+ # @param req [Anthropic::APIRequest]
289
+ # @param nxt [#call]
290
+ # @param entry [Hash{Symbol=>Object}]
291
+ # @param hop_body [Hash{Symbol=>Object}]
292
+ # @return [Array(Anthropic::APIResponse, Boolean)] the response, and whether
293
+ # it answers the resend.
294
+ def send_hop(req, nxt, entry, hop_body)
295
+ res = nxt.call(req.with(body: hop_body))
296
+ return [res, false] unless [429, 529].include?(res.status)
297
+ return [res, false] if entry.key?(:speed) || hop_body[:speed].to_s != "fast"
298
+
299
+ Anthropic::Internal::Util.close_fused!(res.body)
300
+ [nxt.call(req.with(body: hop_body.except(:speed))), true]
301
+ end
302
+
279
303
  # --- non-streaming ------------------------------------------------------
280
304
 
281
305
  # @param req [Anthropic::APIRequest]
@@ -303,7 +327,7 @@ module Anthropic
303
327
  hop_body = hop_body.merge(fallback_credit_token: credit_token_param(token)) if token
304
328
 
305
329
  begin
306
- hop_res = nxt.call(req.with(body: hop_body))
330
+ hop_res = send_hop(req, nxt, entry, hop_body).first
307
331
  rescue StandardError
308
332
  hop_res = nil
309
333
  end
@@ -359,7 +383,7 @@ module Anthropic
359
383
  # @param req [Anthropic::APIRequest]
360
384
  # @param res [Anthropic::APIResponse]
361
385
  # @param nxt [#call]
362
- # @param body [Hash{Symbol=>Object}] the stripped request body
386
+ # @param body [Hash{Symbol=>Object}] the body built for stream A
363
387
  # @param first_hop [Integer]
364
388
  # @param pin [Proc]
365
389
  # @return [Anthropic::APIResponse]
@@ -399,10 +423,12 @@ module Anthropic
399
423
  iterations = [iteration_usage("message", a[:model] || "", a.dig(:refused, :usage))]
400
424
 
401
425
  (first_hop...@fallbacks.length).each do |hop|
402
- model = @fallbacks.fetch(hop).fetch(:model).to_s
426
+ entry = @fallbacks.fetch(hop)
427
+ model = entry.fetch(:model).to_s
403
428
  has_next = hop + 1 < @fallbacks.length
404
429
 
405
- res_b, sent, failed = issue_hop(req, nxt, degrade_between_tools(body), model, token, base, partial)
430
+ hop_body = degrade_between_tools(patch(body, entry.slice(:speed)))
431
+ res_b, sent, failed = issue_hop(req, nxt, hop_body, entry, token, base, partial)
406
432
 
407
433
  if failed
408
434
  next if has_next
@@ -465,15 +491,19 @@ module Anthropic
465
491
  end
466
492
  end
467
493
 
468
- # Issue one fallback hop with a single 400-on-prefill retry.
494
+ # Issue one fallback hop with a single 400-on-prefill retry, which stays
495
+ # without `speed` once the hop has been resent without it.
469
496
  #
470
497
  # @return [Array(Anthropic::APIResponse, Array<Hash>, false), Array(nil, Array<Hash>, true)]
471
498
  # the response, the continuation actually sent (`base + partial`, or
472
499
  # `base` if the prefill was dropped on retry), and whether the hop failed.
473
- def issue_hop(req, nxt, body, model, token, base, partial)
500
+ def issue_hop(req, nxt, body, entry, token, base, partial)
474
501
  continuation = base + partial
475
502
  2.times do |attempt|
476
- hop_body = body.merge(model: model, fallback_credit_token: credit_token_param(token))
503
+ hop_body = body.merge(
504
+ model: entry.fetch(:model).to_s,
505
+ fallback_credit_token: credit_token_param(token)
506
+ )
477
507
  unless continuation.empty?
478
508
  hop_body = hop_body.merge(
479
509
  messages: body.fetch(:messages) + [{role: :assistant, content: continuation}]
@@ -481,10 +511,11 @@ module Anthropic
481
511
  end
482
512
 
483
513
  begin
484
- res = nxt.call(req.with(body: hop_body))
514
+ res, resent = send_hop(req, nxt, entry, hop_body)
485
515
  rescue StandardError
486
516
  return [nil, continuation, true]
487
517
  end
518
+ body = body.except(:speed) if resent
488
519
  return [res, continuation, false] if res.status < 300
489
520
 
490
521
  if attempt.zero? && res.status == 400 && !partial.empty?
@@ -141,6 +141,10 @@ module Anthropic
141
141
  raise NotImplementedError, "Skills are not supported on Vertex."
142
142
  end
143
143
 
144
+ def user_profiles
145
+ raise NotImplementedError, "Managing user profiles is not supported on Vertex."
146
+ end
147
+
144
148
  # @api private
145
149
  #
146
150
  # @param req [Hash{Symbol=>Object}] .
@@ -185,6 +189,9 @@ module Anthropic
185
189
  if path.start_with?("v1/messages/batches")
186
190
  raise NotImplementedError.new("The Batch API is not supported in the Vertex client yet")
187
191
  end
192
+ if path.start_with?("v1/user_profiles")
193
+ raise NotImplementedError.new("Managing user profiles is not supported on Vertex.")
194
+ end
188
195
 
189
196
  super
190
197
  end