{"version":"2.1.295","anchor":"bedrock-gateway-guide-count-tokens-can-use-counttokens","canonical_anchor":"bedrock-gateway-guide-count-tokens-can-use-counttokens","heading":"Bedrock gateways now count tokens with AWS CountTokens","tier":"notice","area":"LLM Gateway","scope":"org","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.295\/e\/bedrock-gateway-guide-count-tokens-can-use-counttokens","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.295","markdown":"### Bedrock gateways now count tokens with AWS CountTokens\n\nOn Bedrock gateways, count_tokens now calls AWS CountTokens with a 10-minute retry backoff, and the built-in gateway guide says the same\n\n**What**\n\nA gateway is a proxy between Claude Code and the model provider. Bedrock is Amazon's model service. `count_tokens` asks how many tokens (pieces of text the model counts) a request uses.\n\n- The Bedrock upstream now answers `count_tokens` with AWS `CountTokens`, with a 10-second timeout, instead of failing at once.\n\n- If that fails it retries only every 10 minutes, and meanwhile falls back to the next upstream or to a billed one-token request.\n\n- The built-in gateway guide now says to answer `count_tokens` with Bedrock's `CountTokens` and return `{\"input_tokens\": N}`, using 501 only if that fails or the model is an application inference profile. Before, it said Bedrock had no count-tokens API.\n\n**Why**\n\nToken counts on Bedrock gateways can now come from Amazon directly. The AWS identity the gateway uses needs permission for `bedrock:CountTokens`, or it falls back as described.\n\n- Area: LLM Gateway\n- Names: `count_tokens`\n- Tier: You'll notice\n- Useful: 3\/5\n- Signal: 1\/5\n- Scope: org\n- Heads-up: no"}