API reference · Public
Estimate a token count
POST/api/tokensNo key
Send application/json as {text} or any other content type as a raw body.
Request body
application/json, optional
| Field | Type | What it is |
|---|---|---|
| text | string |
Example
{
"text": "string"
}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.