Tiktoken.Cli.linux-x64 3.1.5

dotnet add package Tiktoken.Cli.linux-x64 --version 3.1.5
                    
NuGet\Install-Package Tiktoken.Cli.linux-x64 -Version 3.1.5
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Tiktoken.Cli.linux-x64" Version="3.1.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Tiktoken.Cli.linux-x64" Version="3.1.5" />
                    
Directory.Packages.props
<PackageReference Include="Tiktoken.Cli.linux-x64" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Tiktoken.Cli.linux-x64 --version 3.1.5
                    
#r "nuget: Tiktoken.Cli.linux-x64, 3.1.5"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Tiktoken.Cli.linux-x64@3.1.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Tiktoken.Cli.linux-x64&version=3.1.5
                    
Install as a Cake Addin
#tool nuget:?package=Tiktoken.Cli.linux-x64&version=3.1.5
                    
Install as a Cake Tool

ttok — Token Counter CLI

The fastest .NET CLI tool for counting, encoding, decoding, and exploring BPE tokens. Powered by Tiktoken (618 MiB/s).

Install

# Homebrew (macOS — always installs latest release)
brew install tryAGI/tap/ttok

# Shell script (macOS/Linux — auto-detects OS/arch)
curl -fsSL https://raw.githubusercontent.com/tryAGI/Tiktoken/main/install.sh | sh
# Recommended for Linux — Homebrew cask is macOS-only

# PowerShell (Windows — auto-detects arch)
irm https://raw.githubusercontent.com/tryAGI/Tiktoken/main/install.ps1 | iex

# .NET global tool (NativeAOT on .NET 10+)
dotnet tool install -g Tiktoken.Cli

# Or run without installing (.NET 10+)
dnx Tiktoken.Cli "Hello world"

Standalone binary (no .NET required)

Download a pre-built native binary from GitHub Releases:

Platform Download
Linux x64 ttok-linux-x64.tar.gz
Linux x64 (Alpine/musl) ttok-linux-musl-x64.tar.gz
Linux ARM64 ttok-linux-arm64.tar.gz
Linux ARM64 (Alpine/musl) ttok-linux-musl-arm64.tar.gz
macOS Apple Silicon ttok-osx-arm64.tar.gz
macOS Intel ttok-osx-x64.tar.gz
Windows x64 ttok-win-x64.zip
Windows ARM64 ttok-win-arm64.zip

Docker

# Use the Alpine/musl binary in a container
docker run --rm -v "$(pwd):/src" -w /src alpine sh -c '
  wget -qO- https://github.com/tryAGI/Tiktoken/releases/latest/download/ttok-linux-musl-x64.tar.gz | tar xz
  echo "Hello world" | ./ttok
'

Usage

Count tokens (default: gpt-4o / o200k_base)

echo "Hello world" | ttok
# 3

cat prompt.md | ttok --model gpt-4
# 1847

Encode / Decode / Explore

# Show token IDs
echo "Hello world" | ttok --encode
# 13225 2375

# Decode token IDs back to text
echo "13225 2375" | ttok --decode
# Hello world

# Show token boundaries
echo "Hello world" | ttok --explore
# |Hello| world|

# Truncate to N tokens
cat long_doc.md | ttok --truncate 4000

Count files

ttok prompt.md system.md
# prompt.md    1,847
# system.md      423
# ─────────────────────
# 2 files      2,270 tokens

Scan directories (respects .gitignore)

ttok src/ --include "*.cs"

# JSON output for CI
ttok . --format json

# Sort by token count
ttok . --sort tokens --top 10

# Group by extension
ttok . --group-by ext

# Compare against model context window
ttok . --context-check

# Fail if over limit (CI gate, exit code 2)
ttok . --max-tokens 50000

Options

Option Description
-m, --model Model name (default: gpt-4o)
-e, --encoding Encoding name (cl100k_base, o200k_base, etc.)
--encode Output token IDs
--decode Decode token IDs to text
--explore Show token boundaries
-t, --truncate N Truncate to N tokens
--include Include file patterns (e.g. *.cs)
--exclude Exclude file patterns
--max-file-size Skip files over size (default: 50mb)
-f, --format Output format: table or json
--sort Sort: tokens or name
--top N Show only top N files
--group-by ext Group by file extension
--context-check Show % of model context window
--max-tokens N Exit code 2 if exceeded
-q, --quiet Suppress summary footer
--no-default-excludes Include bin/, obj/, node_modules/, etc.
--no-gitignore Disable .gitignore processing
--follow-symlinks Follow symbolic link directories (skipped by default)
--progress Show progress to stderr
--stats Show scan statistics to stderr
--version Show version information

Supported models

All OpenAI models are supported via prefix matching: gpt-4o, gpt-4.1, gpt-4, gpt-3.5-turbo, o1, o3, o4-mini, and more.

Direct encoding names: o200k_base, cl100k_base, p50k_base, p50k_edit, r50k_base.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.1.5 127 4/30/2026
3.1.5-alpha.0.6 111 4/8/2026
3.1.4 173 3/24/2026
3.1.3 162 3/24/2026
3.1.2 162 3/24/2026
3.1.2-alpha.0.1 122 3/24/2026
3.1.1 162 3/24/2026
3.1.1-alpha.0.1 115 3/24/2026
3.1.0 160 3/23/2026
3.1.0-rc.1.4 119 3/23/2026
3.1.0-rc.1.3 121 3/23/2026
3.1.0-rc.1.2 121 3/23/2026
3.1.0-rc.1.1 119 3/23/2026
3.1.0-rc.1 119 3/23/2026