Skip to main content
POST
llm.tokens.count

Authorizations

Authorization
string
header
required

API key: sk_live_…

Headers

Idempotency-Key
string

Optional. A retry with the same key returns the stored result.

Maximum string length: 255
Pramaan-Max-Price-Micro
string

Optional. The most this request may be priced at, in micro-USD (a whole number above 0). It replaces the capability's own price ceiling for this request, lower or higher. Sources that could cost more are left out; when none is left the answer is 400 with the lowest limit that would work.

Pattern: ^[1-9]\d{0,14}$

Body

application/json
messages
object[]
required

The chat so far, oldest first: 1 to 500 messages, at most 1,000,000 characters in total, with at least one user or assistant message.

Required array length: 1 - 500 elements
model
enum<string>
default:balanced

Quality tier: "fast" is cheapest, "best" is most capable. Default "balanced".

Available options:
fast,
balanced,
best

Response

The result

inputTokens
integer
required

Tokens in the supplied messages, including role and system instructions, for the chosen tier.

Required range: 0 <= x <= 9007199254740991