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

# Token counting

> Estimate cost before routing.

Use token preflight to estimate prompt size before a paid call.

```bash theme={null}
curl https://api.meshrouter.app/v1/tokens/count \
  -H "Authorization: Bearer $MESH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "model": "auto", "input": [{ "role": "user", "content": "Count this." }] }'
```

The response returns `total_tokens` and the selected routed model.
