Truncate by Tokens

Cut text to an estimated token budget.

Truncates to about maxTokens × 4 characters. Unlike Context Window % this edits the text. Unlike Token Estimate this returns the shortened string. Local only.

Result: A long prompt that may need trimming for the context window.

Tokens (approx): 15

Characters: 60

Truncated (1 = yes): 0