AWS Security ChangesHomeSearch

AWS bedrock documentation change

Service: bedrock · 2026-05-28 · Documentation low

File: bedrock/latest/userguide/count-tokens.md

Summary

Added documentation for counting tokens using bedrock-mantle endpoint, including request details, authentication requirements, and an example. Updated section titles and added notes about Anthropic Claude models that require bedrock-mantle for token counting.

Security assessment

The changes document authentication methods (SigV4 signatures and API keys) and IAM actions for the new bedrock-mantle endpoint, which qualifies as security documentation. There's no evidence of a specific security vulnerability being addressed.

Diff

diff --git a/bedrock/latest/userguide/count-tokens.md b/bedrock/latest/userguide/count-tokens.md
index 2fe568a9e..fcc586a71 100644
--- a//bedrock/latest/userguide/count-tokens.md
+++ b//bedrock/latest/userguide/count-tokens.md
@@ -7 +7 @@
-Supported models and Regions for token countingCount tokens in a requestTry an example
+Supported models and Regions for token countingCount tokens using the bedrock-runtime endpointExample for bedrock-runtimeCount tokens with bedrock-mantle
@@ -16,0 +17,4 @@ Using the [CountTokens](https://docs.aws.amazon.com/bedrock/latest/APIReference/
+###### Note
+
+Some Anthropic Claude models – including those that launch with cross-Region inference (CRIS) only on `bedrock-runtime` – don't support [CountTokens](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_CountTokens.html) on `bedrock-runtime`. For these models, count input tokens by calling Anthropic's `count_tokens` API on the `bedrock-mantle` endpoint instead. See Count tokens using the bedrock-mantle endpoint for the URL, request body, and an example.
+
@@ -34 +38,3 @@ You can use the `CountTokens` API to do the following:
-  * Count tokens in a request
+  * Count tokens using the bedrock-runtime endpoint
+
+  * Example: count tokens for a bedrock-runtime request
@@ -36 +42 @@ You can use the `CountTokens` API to do the following:
-  * Try an example
+  * Count tokens using the bedrock-mantle endpoint
@@ -45 +51 @@ To see which models support token counting, please visit [models at a glance](./
-## Count tokens in a request
+## Count tokens using the bedrock-runtime endpoint
@@ -56 +62 @@ To count the number of input tokens in an inference request, send a [CountTokens
-## Try an example
+## Example: count tokens for a bedrock-runtime request
@@ -155,0 +162,41 @@ To try out counting tokens for a [Converse](https://docs.aws.amazon.com/bedrock/
+## Count tokens using the bedrock-mantle endpoint
+
+The `bedrock-mantle` endpoint exposes Anthropic's `count_tokens` API at `/anthropic/v1/messages/count_tokens`. Use it to count input tokens for Anthropic Claude models that don't support [CountTokens](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_CountTokens.html) on `bedrock-runtime` – for example, when the model is offered only through cross-Region inference (CRIS) on `bedrock-runtime` and so has no Region-specific endpoint for [CountTokens](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_CountTokens.html) to target. The `/anthropic/v1/messages` path is Claude-specific; non-Anthropic models on `bedrock-mantle` return `The model 'X' does not support the '/anthropic/v1/messages' API`.
+
+###### Request details
+
+  * **URL** – `POST https://bedrock-mantle.`region`.api.aws/anthropic/v1/messages/count_tokens`. For supported Regions, see [Supported Regions and Endpoints](./bedrock-mantle.html#bedrock-mantle-supported).
+
+  * **Request body** – The Anthropic `count_tokens` shape, including `model`, `messages`, and optional `system` and `tools` fields. See the [Anthropic Messages count tokens reference](https://docs.anthropic.com/en/api/messages-count-tokens).
+
+  * **Authentication** – Either a SigV4 signature with service name `bedrock-mantle`, or an Amazon Bedrock API key passed in the `x-api-key` header. See [API keys](./api-keys.html).
+
+  * **IAM action** – `bedrock-mantle:CountTokens`. The authorization is scoped to a Amazon Bedrock [Project](./projects.html) resource of the form `arn:aws:bedrock-mantle:`region`:`account-id`:project/`project-name``. The default project name is `default`.
+
+  * **SDK support** – The AWS SDKs do not currently expose a method that targets this endpoint. Send the request as a SigV4-signed HTTP `POST`, or use any HTTP client with a Amazon Bedrock API key. The `bedrock-runtime` client method `count_tokens` does not target this endpoint and returns a validation error for models that are not supported on `bedrock-runtime`.
+
+  * **Error format** – Errors follow the Anthropic shape: `{"type": "error", "request_id": "...", "error": {"type": "error-type", "message": "error-message"}}`. This differs from the standard AWS JSON error envelope returned by `bedrock-runtime`.
+
+
+
+
+###### Note
+
+The `count_tokens` endpoint validates the request body using the same schema as the corresponding inference endpoint, so request fields that the model does not support are rejected with HTTP 400. For example, Anthropic Claude Opus 4.7 does not accept `strict: true` on `tools[]` and returns `tools.0.custom.strict: Extra inputs are not permitted`. Consult the [model card](./model-cards.html) for the model-specific feature surface.
+
+The following example uses `curl` with a Amazon Bedrock API key to count tokens on the `bedrock-mantle` endpoint:
+    
+    
+    curl -X POST https://bedrock-mantle.us-east-1.api.aws/anthropic/v1/messages/count_tokens \
+      -H "x-api-key: $BEDROCK_API_KEY" \
+      -H "anthropic-version: 2023-06-01" \
+      -H "Content-Type: application/json" \
+      -d '{
+        "model": "anthropic.claude-opus-4-7",
+        "messages": [
+            {"role": "user", "content": "How many tokens is this prompt?"}
+        ]
+      }'
+
+The response contains an `input_tokens` field whose value is the token count for the supplied input.
+
@@ -162 +209 @@ To use the Amazon Web Services Documentation, Javascript must be enabled. Please
-How tokens are counted
+Token counting
@@ -164 +211 @@ How tokens are counted
-Request an increase for Amazon Bedrock quotas
+bedrock-runtime quotas