Skip to content

Conversation

@ogurash
Copy link

@ogurash ogurash commented Oct 14, 2025

Support count tokens API for bedrock client.

count-tokens is now supported by Amazon Bedrock (link). Anthropic python SDK doesn't support it, maybe because it was supported very recently.

Supporting it can simplify our codebase. We can switch model provider without rewriting code for bedrock.

Tested it with the example locally. Compared the number of tokens with the result of bedrock client, and they had the same number if the input was the same.

Questions:

  • I needed to add max_tokens in the request and it was not passed by Anthropic's count_tokens method. Is it OK to pass the fixed number (now 500)?

@ogurash ogurash requested a review from a team as a code owner October 14, 2025 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant