---
title: "Proxy Bedrock Count Tokens"
method: POST
path: "/gateway/model/{model_id}/count-tokens"
---

# Proxy Bedrock Count Tokens

`POST /gateway/model/{model_id}/count-tokens`

## Request

- Base URL: `https://api.ai21.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.ai21.com/gateway/model/{model_id}/count-tokens`
- Auth: none declared

Bedrock ``CountTokens`` — optional for Claude Code (``/context``), not a generation.

## Path parameters

- `model_id` string, required

## Headers

- `X-AI21-Key` string

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-20** `b292e41fd5ac`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/ai21/apis/ai21-studio-api/changes/gateway/model/:model_id/count-tokens/post.md)

---

[API](https://skmtc.dev/ai21/apis/ai21-studio-api.md) - [All operations](https://skmtc.dev/ai21/apis/ai21-studio-api/llms.txt) - [OpenAPI document](https://skmtc.dev/ai21/apis/ai21-studio-api/revisions/b235ae533c95?raw)
