Simon Willison · · 1 min read

ttok 0.4

Mirrored from Simon Willison for archival readability. Support the source by reading on the original site.

8th October 2026

Release ttok 0.4 — Count and truncate text based on tokens

ttok is my CLI tool for counting tokens, using OpenAI's open source tiktoken library.

It hasn't been in updated in a couple of years, but I finally fixed a Click warning, updated CI, and added a --list-models command to list available models.

It works with uvx, so you can count tokens in anything like this:

cat file.txt | uvx ttok
Posted 8th October 2026 at 11:34 pm

Recent articles

This is a beat by Simon Willison, posted on 8th October 2026.

projects ai openai generative-ai llms tokenization

Monthly briefing

Sponsor me for $10/month and get a curated email digest of the month's most important LLM developments.

Pay me to send you less!

Discussion (0)

Sign in to join the discussion. Free account, 30 seconds — email code or GitHub.

Sign in →

No comments yet. Sign in and be the first to say something.

More from Simon Willison