使用
macOS arm64
brew install lancekrogers/tap/tcount
brew install lancekrogers/tap/tcount
確認能用
tcount /tmp/myfile.txt輸出應包含「o200k_base」。
先試試這個
cat > /tmp/myfile.txt <<'EOF'
Hello world! This is a test file for token counting.
The quick brown fox jumps over the lazy dog.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
EOF
cat /tmp/myfile.txttcount /tmp/myfile.txt執行 tcount <file> 查看檔案的 token 數。
Linux x86_64
透過 npm 候選安裝 tcount
npm install -g @obedience-corp/tcount
確認能用
tcount --version輸出應包含「tcount version 0.7.0」。
先試試這個
cat > myfile.txt <<'EOF'
Hello world. This is a test file for token counting with tcount.
It contains a few sentences to count tokens locally.
EOF
cat > prompt.md <<'EOF'
# Sample prompt
Write a haiku about token counting in LLM workflows.
EOF
cat > document.md <<'EOF'
# Document
This is a sample document for JSON output testing. Token counting should be local and fast.
EOF
mkdir -p src && printf 'Hello from a\n' > src/a.txt && printf 'Second file with more content for counting tokens.\n' > src/b.txt && ls -Rtcount myfile.txt執行 tcount <file> 查看檔案的 token 數。
它能做什麼
- 以 OpenAI tokenizer 精確計算 token已測試
怎麼使用
- 執行
tcount <file>查看精確的 o200k_base token 數。
- 執行
- 取得 Claude 與 Gemini 的概略 token 數已測試
怎麼使用
- 執行
tcount --model claude-sonnet-4.5 <file>取得 Claude 的概略數量。 - 執行
tcount --model gemini-2.5-pro <file>取得 Gemini 的概略數量。
- 執行
- 查看脈絡視窗的使用比例已測試
怎麼使用
- 執行
tcount --model gpt-5 <file>。 - 查看輸出表格中的 Context Usage 欄位。
- 執行
- 計算整個目錄樹的 token 數已測試
怎麼使用
- 執行
tcount -d <directory>,計算該目錄下(含子資料夾)所有檔案的 token 數。
- 執行
pickfit 測到哪一步
macOS arm64
- 可以安裝
- 可以啟動
- 4 項功能中 4 項可用
- 可離線使用
Linux x86_64
- 可以安裝
- 可以啟動
- 4 項功能中 4 項可用
- 可離線使用
其他系統
Windows:專案說支援,但 pickfit 還沒試過。
適合用來
- 計算檔案的 token 數
- 計算整個目錄樹的 token 數
- 檢查模型的上下文視窗使用量
- 為指令碼計算管線輸入的提示詞 token 數
- 以 JSON 輸出 token 數供指令碼使用
pickfit 怎麼測的
每次測試都從乾淨的機器開始,照上面的步驟執行。 pickfit 怎麼驗證
macOS arm64
主要功能可用
- 從頭重跑
- 可離線使用
- 檢查於 2026年11月1日
- 版本 0.7.0
Linux x86_64
主要功能可用
- 從頭重跑
- 可離線使用
- 檢查於 2026年10月30日
- 版本 0.7.0