diff --git a/src/anthropic/lib/bedrock/_beta_messages.py b/src/anthropic/lib/bedrock/_beta_messages.py index 332f6fba..59bafcc3 100644 --- a/src/anthropic/lib/bedrock/_beta_messages.py +++ b/src/anthropic/lib/bedrock/_beta_messages.py @@ -13,6 +13,7 @@ class Messages(SyncAPIResource): create = FirstPartyMessagesAPI.create + count_tokens = FirstPartyMessagesAPI.count_tokens @cached_property def with_raw_response(self) -> MessagesWithRawResponse: @@ -36,6 +37,7 @@ def with_streaming_response(self) -> MessagesWithStreamingResponse: class AsyncMessages(AsyncAPIResource): create = FirstPartyAsyncMessagesAPI.create + count_tokens = FirstPartyAsyncMessagesAPI.count_tokens @cached_property def with_raw_response(self) -> AsyncMessagesWithRawResponse: diff --git a/src/anthropic/lib/bedrock/_client.py b/src/anthropic/lib/bedrock/_client.py index 013d2702..e4a5beae 100644 --- a/src/anthropic/lib/bedrock/_client.py +++ b/src/anthropic/lib/bedrock/_client.py @@ -61,7 +61,7 @@ def _prepare_options(input_options: FinalRequestOptions) -> FinalRequestOptions: if options.url.startswith("/v1/messages/batches"): raise AnthropicError("The Batch API is not supported in Bedrock yet") - if options.url == "/v1/messages/count_tokens": + if options.url in {"/v1/messages/count_tokens", "/v1/messages/count_tokens?beta=true"}: raise AnthropicError("Token counting is not supported in Bedrock yet") return options