Skip to main content

Token Count

Controlled node

Overview

This node is used to count the number of tokens of a given text input, for a given model. The token count is important for understanding how much text you are passing into the context window of the model you are using for text generation. If the sum of your token input and maximum output exceeds the context window size, the AI Write node will not generate any output.

The model you select should match the model you are using for text generation. For details on the models available, see the AI Write node documentation.

Inputs

InputTypeDescriptionDefault
ModelEnumThe model to use for token counting.standard
TextTextThe text to be counted-
RunEventFires when the node starts running-

Outputs

OutputTypeDescription
CountNumberContains the number of tokens in the text.
RemainingNumberThe number of tokens remaining in the context window for the chosen model
DoneEventFires when the node has finished