Actions24
- Agent Chat
- Generate
- Image Edit
- Virtual Try-On
- Chat Completions (OpenAI-Compatible)
- Messages (Anthropic-Compatible)
- Count Tokens (Anthropic-Compatible)
- List Models
- Conversations: Delete
- Conversations: List or Get
- Conversations: Save
- Knowledge Graph: Delete Node
- Knowledge Graph: List Graphs
- Knowledge Graph: Process
- Knowledge Graph: Query
- Knowledge Graph: Update Node
- Leads: Discover and Analyze
- Live Token: Mint Ephemeral Token
- SEO: Analyze Topic
- SEO: Generate Output
- SEO: Generate Subtopics
- SEO: Refine Output
- Video: Get Status
- Video: List
Count Tokens (Anthropic-Compatible)
AI-generatedSummary
Sends raw Anthropic-compatible messages to the AI Hub token-count endpoint and returns the token-count response. Use it to estimate the tokens in a conversation before sending it to a model.
Inputs
- Model Name or ID (required) — Select or provide a Gemini, Claude, or Amazon Nova model ID.
- Messages (required) — A JSON array of message objects in the endpoint’s raw wire format; expressions can pass messages from other nodes.
- Options → System — Optional JSON system prompt, provided as a string or an array of system content blocks.
- Options → Tools — Optional JSON array of tool definitions to include in the token count.
- Simplify Output — Defaults to true; controls whether the response is simplified or returned in its full form.
Output shape
A single response object per input item.
The endpoint is POST /v1/messages/count_tokens. The response fields depend on the API; the source pack does not specify their exact shape.
Examples
Example 1: Count tokens for a conversation before sending it to Claude, Gemini, or Nova.
Choose the target model and provide the raw messages array. Optionally include system content and tool definitions to account for them in the count.
