builders · review · first seen Nov 18, 10:32 UTC
Anthropic adds billing support to Python SDK
Anthropic shipped Python SDK v2.10.0 with beta support for a billing_policy request parameter and new billing-related error codes. Builders handling billing flows should check whether their request and error handling need to change, while treating the parameter as beta.
In short
- v2.10.0 shipped beta billing_policy request-parameter support; its behavior is not detailed here.
- The release adds billing-related message error codes and external-key webhook events worth checking in existing handlers.
- Failed aiohttp connections are no longer reported as timeouts; retest logic that depends on that label.
What shipped
The release adds beta support for the billing_policy request parameter. That is the extent of the confirmed parameter detail here: the release excerpt names it, but does not describe its accepted values, defaults, or effect on a request. I would treat this as a reason to inspect a billing-policy integration, not as evidence that any particular policy behavior is ready for production use. [1]
The SDK also adds contract_spend_limit_reached as an error code on messages. The release excerpt separately lists error codes for linked billing refusals and user_profile_billing_not_authorized. These names give a builder concrete cases to look for when reviewing error handling. They do not, by themselves, establish when each error is returned or whether an existing application will encounter one. [1]
Two other changes affect adjacent operational paths. The release adds webhook events for external key failure and recovery. It also fixes the client so failed aiohttp connections are no longer reported as timeouts. One concerns events a webhook consumer may need to recognize; the other concerns how a failed connection is reported. Neither release-note line supplies an event payload or a complete error-handling contract. [1][2]
Why it matters if you build
For a builder making a billing decision today, the useful change is separation: a named spend-limit error can be considered apart from other message errors, and the release names additional billing-refusal cases. If an application currently puts all message errors into one branch, review that branch before deciding what a user should see or what an operator should investigate. The source supports the existence of the codes, not a prescribed response, retry rule, or financial outcome. [1]
The beta billing_policy parameter creates a possible request-level integration point, but the excerpt does not say what values it accepts or what a policy controls. Do not budget work or promise a billing behavior on the parameter name alone. First determine whether the application has a billing-policy requirement, then check the parameter’s documented contract before changing requests. This is an assessment step, not a claim that the parameter solves a particular cost problem. [1]
Operational reviews should include both webhook handling and connection-failure handling. A consumer that distinguishes external key failure from recovery has new event names to account for, though the excerpt gives no payload details. A client that interprets every reported timeout as a timeout should also be retested against failed aiohttp connections after the upgrade. The fix changes that reported classification; the excerpt does not say how those failures are reported instead. [1][2]
How to try it today
- Review requests that might use billing_policy; identify where the beta parameter would be set, without assuming its values or effect.
- Find message-error handling and check whether contract_spend_limit_reached needs a distinct branch.
- Check handling for linked billing refusals and user_profile_billing_not_authorized, which the release excerpt also names.
- Review webhook dispatch for external key failure and recovery events.
- Retest any logic that classifies failed aiohttp connections as timeouts.
What we checked
Every claim below was walked down the source ladder. The rung is how close the source is to the thing itself; the tense is the source's own.
-
shipped L0 · primary
Anthropic Python SDK v2.10.0 adds beta support for the billing_policy request parameter.
per GitHub releases · anthropics/anthropic-sdk-python (L0) -
shipped L0 · primary
Anthropic Python SDK v2.10.0 adds the contract_spend_limit_reached error code to messages.
per GitHub releases · anthropics/anthropic-sdk-python (L0) -
shipped L0 · primary
Anthropic Python SDK v2.10.0 adds webhook events for external key failure and recovery.
per GitHub releases · anthropics/anthropic-sdk-python (L0) -
shipped L0 · primary
Anthropic Python SDK v2.10.0 stops reporting failed aiohttp connections as timeouts.
per GitHub releases · anthropics/anthropic-sdk-python (L0)
What is not confirmed
The supplied release excerpt does not establish billing_policy values, defaults, eligibility, or its effect on charges. It gives no spend-limit amount or rule for when contract_spend_limit_reached appears. Those details are necessary before treating either addition as a cost control. [1][2]
The excerpt does not specify webhook event payloads, delivery behavior, or the replacement classification for failed aiohttp connections. It therefore does not support a claim that an existing webhook consumer will work unchanged, or that a particular connection error will replace a timeout in every case. [1][2]
Who should act, who should wait
Move now if your Python SDK integration already handles billing-related message errors, consumes external-key webhooks, or relies on aiohttp timeout classification. Review those paths against v2.10.0 and test the behavior relevant to your application. If your decision depends on the precise semantics of billing_policy or a guaranteed cost outcome, wait on that change until you have the parameter contract; this excerpt confirms beta support, not those semantics. [1][2][3][4]
Sources
- v2.10.0 — GitHub releases · anthropics/anthropic-sdk-python L0 · primary