count_tokens
Read-onlyIdempotent
Estimate the token count of a text string using the cl100k_base approximation (~4 chars/token). Shows whether a text fits the context window of a model and what it costs. Returns token estimate, character count, and word count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | Text to count tokens for |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chars | No | ||
| words | No | ||
| tokens_estimate | No |