Docs menu · Reference

Encodes text into the token id sequence a local model would see and returns the ids in order. Set add_special to include the model’s special tokens (such as beginning-of-sequence markers). Tokenization is a local-only operation: it requires a build with the local execution feature and returns inference.unsupported_operation for cloud provider specs.

Parameters

NameTypeRequiredDescription
add_specialbooleannoWhether to add special tokens.
modelstringyesModel spec.
textstringyesText to tokenize.

Returns

TokenIds.

Errors

Invocation

  • CLI: strata inference tokenize
  • Wire type: inference_tokenize

agents: this page as markdown → /docs/reference/inference/tokenize.md