Complete reference for all tokenpak commands.
tokenpak statusCheck proxy health and session stats.
tokenpak status [--full]
| Flag | Description |
|---|---|
--full |
Include compression pipeline details and recent request log |
tokenpak healthFull system health check including DB, index, and proxy subsystems.
tokenpak health
tokenpak logsView proxy logs.
tokenpak logs [--errors] [--today] [--tail N]
| Flag | Description |
|---|---|
--errors |
Show only error-level entries |
--today |
Filter to today’s logs |
--tail N |
Show last N lines (default: 50) |
tokenpak doctorComprehensive diagnostics — checks config, proxy, DB, compression pipeline, and connectivity.
tokenpak doctor
tokenpak serveStart the proxy server.
tokenpak serve [--port PORT] [--mode MODE] [--daemon]
| Flag | Default | Description |
|---|---|---|
--port |
8766 |
Port to listen on |
--mode |
hybrid |
Compression mode: strict, hybrid, aggressive |
--daemon |
off | Run in background |
Compression modes:
| Mode | Behavior |
|---|---|
strict |
Only compress if token count exceeds threshold |
hybrid |
Compress medium+ requests, pass through small ones |
aggressive |
Always compress |
tokenpak stopStop the background proxy daemon.
tokenpak stop
tokenpak costView cost breakdown.
tokenpak cost [--today] [--week] [--month] [--by-model] [--by-agent] [--export FORMAT]
| Flag | Description |
|---|---|
--today |
Today’s costs |
--week |
This week |
--month |
This month |
--by-model |
Break down by model |
--by-agent |
Break down by agent |
--export csv\|json |
Export to file |
tokenpak budgetManage spending limits.
tokenpak budget set --monthly AMOUNT
tokenpak budget alert --at PCT
tokenpak budget status
tokenpak budget reset
| Subcommand | Description |
|---|---|
set --monthly N |
Set monthly budget in USD |
alert --at PCT |
Alert when budget reaches PCT% (e.g. 80%) |
status |
Show current budget and spend |
reset |
Clear budget and spend history |
tokenpak savingsView cumulative token savings.
tokenpak savings [--lifetime] [--export csv]
tokenpak demoRun the compression pipeline on a sample and show what was removed.
tokenpak demo [--verbose] [--file PATH]
tokenpak compressDry-run compression on a file (no request sent).
tokenpak compress <file> [--diff] [--mode MODE]
| Flag | Description |
|---|---|
--diff |
Show a diff of what was removed |
--mode |
Override compression mode |
tokenpak traceInspect a pipeline execution trace.
tokenpak trace [--id ID] [--last]
tokenpak indexIndex a directory for semantic search.
tokenpak index [PATH] [--watch] [--status] [--auto-workers] [--max-workers N]
| Flag | Description |
|---|---|
PATH |
Directory to index (default: current dir) |
--watch |
Auto re-index when files change |
--status |
Show index health without re-indexing |
--auto-workers |
Use calibration profile to set parallelism |
--max-workers N |
Cap at N parallel workers |
tokenpak vault searchSemantic search over the indexed vault.
tokenpak vault search "query" [--top N] [--type TYPE]
| Flag | Description |
|---|---|
--top N |
Return top N results (default: 5) |
--type |
Filter by block type: code, text, config |
tokenpak vault blocksInspect indexed content blocks.
tokenpak vault blocks [--stale] [--type TYPE] [--path PATTERN]
tokenpak benchmarkMeasure compression performance and token savings.
tokenpak benchmark PATH [--iterations N] [--compare]
| Flag | Description |
|---|---|
--iterations N |
Runs per file (default: 3) |
--compare |
Show baseline vs optimized comparison |
tokenpak calibrateProfile your hardware to find optimal worker count.
tokenpak calibrate PATH [--max-workers N] [--rounds N]
| Flag | Description |
|---|---|
--max-workers N |
Maximum workers to test |
--rounds N |
Test rounds per worker count (default: 2) |
Saves profile to ~/.tokenpak/calibration.json.
tokenpak routeManage request routing rules.
tokenpak route set PATTERN MODEL
tokenpak route test "prompt text"
tokenpak route list
tokenpak route history
tokenpak route remove PATTERN
Examples:
# Route test/debug queries to a cheaper model
tokenpak route set ".*test.*" gpt-4o-mini
tokenpak route set ".*debug.*" claude-haiku-3-5
# Preview what model a prompt would be routed to
tokenpak route test "write unit tests for auth.py"
# → gpt-4o-mini (matched: .*test.*)
tokenpak agentManage registered agents.
tokenpak agent list
tokenpak agent register NAME [--metadata KEY=VALUE]
tokenpak agent unregister NAME
tokenpak agent tasks [--queue] [--agent NAME]
tokenpak agent lock FILE [--ttl SECONDS]
tokenpak triggerConfigure event-based automations.
tokenpak trigger list
tokenpak trigger add EVENT_TYPE CONDITION COMMAND
tokenpak trigger remove ID
tokenpak trigger log [--last N]
Event types:
| Type | Condition | Example |
|---|---|---|
file-change |
Glob pattern | "*.py" |
cost-alert |
Percentage | 80% |
model-change |
Model name | "gpt-4o" |
tokenpak trigger add file-change "*.py" "bash lint.sh"
tokenpak trigger add cost-alert 80% "notify --urgent"
tokenpak abRun controlled compression experiments.
tokenpak ab create NAME --variant-a DESC --variant-b DESC
tokenpak ab status NAME
tokenpak ab apply NAME
tokenpak ab presets
tokenpak ab list
tokenpak replayReplay a past request (useful for testing recipe changes).
tokenpak replay list [--last N]
tokenpak replay ID [--no-compress] [--model MODEL] [--diff]
| Flag | Description |
|---|---|
--no-compress |
Replay without compression (baseline) |
--model |
Override model for replay |
--diff |
Show diff vs original response |
tokenpak debugToggle detailed request logging.
tokenpak debug on [--requests N] # capture next N requests
tokenpak debug off
tokenpak debug status
tokenpak templateManage prompt templates.
tokenpak template list
tokenpak template create NAME
tokenpak template use NAME [--var KEY=VALUE]
tokenpak template export NAME [--output FILE]
tokenpak template delete NAME
tokenpak recipeManage compression recipes.
tokenpak recipe list
tokenpak recipe create NAME [--category CAT] [--domain-example EXAMPLE]
tokenpak recipe validate FILE
tokenpak recipe test FILE --input-file INPUT
tokenpak recipe benchmark FILE [--runs N]
tokenpak recipe install FILE
tokenpak recipe remove NAME
See Recipe Development for full details.
tokenpak auditView and export the audit log.
tokenpak audit list [--since DATE] [--user ID] [--model MODEL]
tokenpak audit export [--format json|csv] [--output FILE]
tokenpak audit prune [--older-than DAYS]
tokenpak complianceGenerate compliance reports.
tokenpak compliance report --standard soc2|gdpr|ccpa [--output FILE]
tokenpak compliance status
tokenpak configGet or set configuration values.
tokenpak config get KEY
tokenpak config set KEY VALUE
tokenpak config list
tokenpak config export [--output FILE]
tokenpak config reset
Common config keys:
| Key | Default | Description |
|---|---|---|
proxy.port |
8766 |
Proxy listen port |
proxy.passthrough_url |
OpenAI | Default upstream URL |
compression.enabled |
true |
Master compression switch |
compression.level |
balanced |
minimal, balanced, aggressive |
budget.monthly_usd |
null |
Monthly spend limit |
budget.alert_at_pct |
80 |
Alert threshold (%) |
vault.watch |
false |
Auto re-index on changes |
tokenpak pruneRemove old data from the local database.
tokenpak prune [--older-than DURATION] [--dry-run]
| Flag | Description |
|---|---|
--older-than |
Duration string: 30d, 3m, 1y |
--dry-run |
Show what would be deleted without deleting |
These flags work with any command:
| Flag | Description |
|---|---|
--json |
Output as JSON |
--quiet |
Suppress non-essential output |
--verbose |
Extra debug output |
--config FILE |
Use alternate config file |
--db FILE |
Use alternate database file |
--version |
Show TokenPak version |
--help |
Show command help |