> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chowder.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# tokens

> Count tokens in text columns.

`tokens` counts the tokens in each row of a text column and returns a column of `BIGINT` counts.

By default, `tokens` uses the same tokenizer as `infer`'s default models. To use another model's tokenizer, pass a Hugging Face repository or a local `tokenizer.json` as the second argument.

## Signature

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
tokens(text [, tokenizer])
```

| Parameter | Type | Default | Description |
| - | - | - | - |
| `text` | `VARCHAR` | — | Text to tokenize. |
| `tokenizer` | Constant `VARCHAR` | `Qwen/Qwen3.5-0.8B` | Hugging Face repository or local `tokenizer.json` path. |

## Example

```chowder-sql theme={"theme":"css-variables","languages":{"custom":["/languages/chowder-sql.json"]}}
SELECT
    title,
    tokens(content) AS token_count
FROM read_parquet('hf://buckets/chowderai/chowder-demo/parquet/data/amazon-reviews/*.parquet')
WHERE token_count < 120
LIMIT 5;
```

## Return type

`BIGINT`, or null for a null input.

`tokens` performs tokenization but avoids building the token string list returned by [`tokenize`](https://docs.chowder.ai/reference/column-functions/tokenize). Use it for budgets, filters, and aggregates.

Special tokens are not added. Tokenizers load once per path into a process-scoped cache.

See [Count tokens in a dataset](https://docs.chowder.ai/guides/token-profiling.md) to count conversations, total tokens, and average input size across a hosted dataset.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.