API reference · Public
Estimate a token count
GET/api/tokensNo key
A heuristic estimate, not a tokenizer. 200 KB cap on the input.
Parameters
| Field | Type | What it is |
|---|---|---|
| text (query) | string | The text to measure. |
Answer 200
The estimate.
| Field | Type | What it is |
|---|---|---|
| estimate | integer | |
| method | "heuristic" | |
| note | string | Says plainly that this is an estimate, not a tokenizer. |
Errors
- 413OpenAI shaped error.
Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.