Skip to content
ActionAnthropicUpdated May 2026

How do I count tokens before sending a Claude message?

Short answer: Drop the "AnthropicCount Tokens" action anywhere in your workflow, map the inputs from upstream nodes, and publish.

Inputs

The fields this action accepts.

Every field can be mapped from an upstream trigger, AI step, table row, or hard-coded literal.

FieldTypeRequiredDescription
Model
model
optionsRequiredModel. Options: Claude Opus 4, Claude Sonnet 4, Claude Haiku 3.5
Message Content
content
stringRequiredMessage Content. e.g. "The text to count tokens for"
Sample request
{
"model": "{{trigger.model}}",
"content": "The text to count tokens for"
}
Returns
{
"input_tokens": 42
}

Use these fields in downstream nodes for routing, logging, or error handling.

Triggered by

Apps that pair well as the trigger for Count Tokens.

Any of these apps can fire this action as part of a workflow.

FAQ

Questions about Count Tokens.

What does the Count Tokens action do in Anthropic?
Counts the number of tokens a Messages API call would consume without actually sending the message. Useful for cost estimation and to stay under context-window limits.
What inputs does Count Tokens require?
Required: Model, Message Content. Every input accepts a static value or a variable from any upstream node in your workflow.
Can I use dynamic inputs from earlier workflow nodes?
Yes. Any field on this action can pull values from upstream nodes, whether that's a form response, a trigger payload, an AI output, or a lookup result.
What happens if Anthropic returns an error?
The workflow pauses on the failed node, the error message is captured in the run log, and you can retry the run with one click. Auto-retry policies are configurable per workflow with exponential backoff up to 5 attempts.
Does Count Tokens support batch operations?
Yes. Run Count Tokens inside a Loop node to process arrays. Tiny Command handles Anthropic's rate limits automatically so you don't have to throttle manually.
More actions

Other Anthropic actions.

Send count tokens from your workflows.

Triggered by anything in the catalog. Free tier available. No credit card.