messages

Count message tokens (Anthropic Messages API)

Changed on

Counts the input tokens of a Messages request. Exact when the provider that owns the model has a token counting endpoint (Anthropic); otherwise a calibrated estimate.

post/v1/messages/count_tokens

Request

  • Base URL
    http://localhost:8080
  • URL
    http://localhost:8080/v1/messages/count_tokens
  • Auth
    HTTP bearer

Request body

cache_controlobject
max_tokensinteger
modelstring
output_formatobject

OutputFormat is the deprecated top-level form of output_config.format.

stop_sequencesstring[]
streamboolean
temperaturenumber
top_kinteger
top_pnumber

Response

OK

input_tokensinteger

Changes