Tokens

Count tokens (Anthropic format)

Count tokens using Anthropic’s provider tokenizer. Requires a model with an Anthropic provider route and provider credentials. Unlike /v1/count_tokens, this sends the request to Anthropic and includes supported tool/system input. max_tokens is not required. Subscription passthrough is a separate CLI flow.

post/v1/messages/count_tokens

Request

  • Base URL: https://edgee.io
  • URL: https://edgee.io/v1/messages/count_tokens
  • Auth: one of:
    • HTTP bearer
    • API key in header x-api-key

Request body

modelstring required

Model identifier from GET /v1/models, in author/model format, or a configured global alias. Append :provider to request a specific provider route. Available models and providers depend on your key and organization policies.

Response

Token count estimated successfully

input_tokensinteger required

Estimated number of input tokens for the provided messages. This is an approximation, counts may differ from provider-native tokenizers. Use for estimation and budgeting, not exact billing.

Example response

{
  "input_tokens": 42
}

Changes

No recorded changes to this operation across all 1 revision of this API.