Count tokens
count_tokensCounts the input tokens a generate_text request would use for a prompt, model, optional images, instructions, and web search, without running the model.
Instructions
Count the input tokens a generate_text request would use, without running the model
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | Yes | OpenAI model whose tokenizer to use. Must support image input if images are provided | |
| images | No | Images to include in the count, each as an http(s) URL or a file path on this server's filesystem (PNG, JPEG, WEBP, or GIF) | |
| prompt | Yes | The input text to count | |
| webSearch | No | Count the request as one that has web search enabled | |
| instructions | No | Optional instructions to include in the count |