Skip to main content
POST
Count input tokens

Authorizations

Authorization
string
header
required

Project customer key. Requires the permission for the requested endpoint.

Headers

anthropic-version
string
default:2023-06-01

Messages protocol version.

anthropic-beta
string

Model-supported beta protocol flags.

Maximum string length: 512
X-Limitless-Session-ID
string

Optional cache-affinity hint, isolated to this organization and project. X-Abliteration-Session-ID is accepted for compatibility.

Required string length: 1 - 512

Body

application/json

Model-dependent request fields. Read the compatibility guide for supported combinations and limits.

model
string
required
Required string length: 1 - 200
messages
object[]
required
Minimum array length: 1
system
tools
object[] | null

Chat: function tools. Responses: functions and supported web_search aliases. Messages: custom functions, web_search_2025_03_05 and web_fetch_2025_03_05. See the tools guide.

tool_choice
object | null
thinking
object | null
output_config
object | null
context_management
object | null

Response

Successful response.

input_tokens
integer
required
Required range: x >= 0