Anthropic Python SDK v2.4.0 Adds Analytics, Spend Limits, and New Error Types in API
The anthropic-sdk-python v2.4.0 release introduces new GA methods for analytics, spend limits, and RBAC, adds new error types, extends filter options, improves key management, and refines API responses.
What changed?
Anthropic released version 2.4.0 of their Python SDK, adding new GA API methods for analytics, spend limits, and role-based access control (RBAC). The update introduces new error types like tool_use_limit_reached_error and compaction_limit_reached_error, provides additional filtering capabilities in analytics, and includes user_profile_id for better key and workspace management. The spend_limit field in relevant responses can now be null, and analytics responses no longer include the unused project product field.
- GA API methods for analytics, spend limits, RBAC
- New error types for session tracking: tool_use_limit_reached_error, compaction_limit_reached_error
- Extended analytics: new group_by and spend limit period filters
- Support for user_profile_id in External Keys and Workspaces
- Bug fix: spend_limit may be null; always-sent analytics fields are required

