360 Secure SkillHub
360 安全技能中心

Tokencount

核心功能:提供字词行句段计数、阅读时长统计;三种方法估算LLM令牌用量及GPT-4类模型成本;词频分析、高频词排行;多文件指标对比与词汇差异分析。典型场景:文案长度管控、AI调用预算预估、文本复杂度分析、文稿版本对比。输入为本地文件或inline文本,输出终端可视化统计结果。

bytesagain
bytesagain
热度 36.44
最近更新 2026-03-19 18:56:47
分类:效率依赖:代码执行 / 读写文件应用场景:数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add tokencount
Metadata
name
TokenCount
description
Count words, characters, and estimate GPT tokens with readability. Use when tracking length, checking budgets, comparing complexity.
version
3.0.0
author
BytesAgain
homepage
https://bytesagain.com
source
https://github.com/bytesagain/ai-skills
tags
["token","word","count","text","nlp","ai","gpt"]
categories
["Developer Tools","Utility"]

TokenCount

A real text and token counter for the terminal. Count words, lines, characters, and sentences. Estimate LLM token usage with cost projections. Analyze word frequency and compare files side by side.

Commands

Command Description
tokencount count <file|text> Count words, lines, characters, sentences, paragraphs, avg word length, and reading time. Works with files or inline text
tokencount tokens <file> Estimate LLM token count using 3 methods (chars÷4, words×1.33, bytes÷3.5), shows cost estimates for GPT-4 class models and context window usage bars
tokencount freq <file> Full word frequency analysis — ranked table with counts, percentages, bar chart, and vocabulary richness score
tokencount top <file> [n] Show top N most common words (default: 20)
tokencount diff <file1> <file2> Compare two files — side-by-side word/line/char/token counts, unique words in each, common vocabulary

Requirements

  • Standard Unix tools: wc, awk, sort, tr, grep, comm

Examples

# Count everything in a file
tokencount count README.md

# Count inline text
tokencount count "Hello world, this is a test."

# Estimate tokens and costs
tokencount tokens article.txt

# Word frequency analysis
tokencount freq novel.txt

# Top 10 words
tokencount top essay.txt 10

# Compare two drafts
tokencount diff draft-v1.txt draft-v2.txt