Tokenize

POST

This endpoint splits input text into smaller units called tokens using byte-pair encoding (BPE). To learn more about tokenization and byte pair encoding, see the tokens page.

Headers

X-Client-NamestringOptional

The name of the project that is making the request.

Request

This endpoint expects an object.
textstringRequired

The string to be tokenized, the minimum text length is 1 character, and the maximum text length is 65536 characters.

modelstringRequired

An optional parameter to provide the model name. This will ensure that the tokenization uses the tokenizer used by that model.

Response

This endpoint returns an object.
tokenslist of integers

An array of tokens, where each token is an integer.

token_stringslist of strings
metaobjectOptional