GigaChat API icon

GigaChat API

Consume GigaChat API functions

Токены → Посчитать токены

AI-generated

Summary

Count tokens and characters in a given prompt text using a selected GigaChat model.

Inputs

  • modelId — Select the GigaChat model to use for token counting.
  • prompt (required) — The text prompt for which to count tokens and characters.

Output shape

a single JSON object containing the count of tokens and characters for the provided prompt.

The output JSON includes 'tokens' and 'characters' fields reflecting the analyzed prompt. The operation requires valid GigaChat API credentials and a selected model (optional). Errors during execution are handled according to node settings (fail or continue). No pagination or multi-item output is involved.

Examples

Example 1: Count tokens for a message to estimate usage.

Set resource to 'Tokens', operation to 'Посчитать токены', select a model, and provide the prompt text to analyze.

Links

Discussion