Orlop AI Hub icon

Orlop AI Hub

Interact with the Orlop AI Hub API

Count Tokens (Anthropic-Compatible)

AI-generated

Summary

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.

Links

Discussion