centerpixel.com
← tools

tc

Like wc, but for tokens.

Counts tokens in files or stdin with the o200k_base encoding. Plain tc always means o200k_base — there is no configuration to get wrong.

tctc counting tokens in three files, then in a pipeline.tc$tc README.md main.go encoding.go2288 README.md1304 main.go389 encoding.go3981 total$printf 'Explain this diff.' | tc4$Counts tokens, not characters or words.Always o200k_base -- the encoding GPT-4oreads.One count per file, then a total. The sameshape wc has printed since 1971.With no files it reads stdin, so it dropsinto a pipeline without ceremony.
Hover to stop the playback and read the parts.
brew install omarish/tap/tc