
Research
/Security News
Mini Shai-Hulud Campaign Hits Red Hat Cloud Services npm Packages
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.
tiktokenman
Advanced tools
File-based token counter CLI powered by tiktoken.
Count tokens in any file before sending to an LLM API — know the cost before you pay.
npm i -g tiktokenman
Or run directly:
npx tiktokenman count ./file.txt
$ tiktokenman count ./README.md
README.md 342 tokens (gpt-4o)
$ tiktokenman count "src/**/*.ts"
src/cli.ts 83 tokens
src/commands/count.ts 559 tokens
src/index.ts 176 tokens
────────────────────────────────────
Total 818 tokens (gpt-4o)
$ tiktokenman count ./file.txt --model gpt-4o-mini
Supported models: gpt-4o (default), gpt-4o-mini, gpt-4, gpt-3.5-turbo
$ tiktokenman count "src/**/*.ts" --json
{
"model": "gpt-4o",
"files": [
{ "file": "src/cli.ts", "tokens": 83 },
{ "file": "src/commands/count.ts", "tokens": 559 },
{ "file": "src/index.ts", "tokens": 176 }
],
"total": 818
}
| Option | Alias | Description | Default |
|---|---|---|---|
--model | -m | Tokenizer model | gpt-4o |
--json | Output as JSON | false | |
--help | -h | Show help | |
--version | -v | Show version |
import { countTokens, countFileTokens } from "tiktokenman";
// Count tokens from text
const tokens = countTokens("Hello, world!", "gpt-4o");
console.log(tokens); // 4
// Count tokens from a file
const result = countFileTokens("./README.md");
console.log(result); // { file: "./README.md", tokens: 342, model: "gpt-4o" }
MIT
FAQs
File-based token counter CLI powered by tiktoken
The npm package tiktokenman receives a total of 5 weekly downloads. As such, tiktokenman popularity was classified as not popular.
We found that tiktokenman demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
A mini Shai-Hulud campaign compromised Red Hat Cloud Services npm packages to steal developer and CI/CD secrets during installation.

Research
/Security News
The North Korean malware loader hides in a Packagist-listed package and its GitHub branch to fetch and execute remote code in a likely Contagious Interview-style lure.

Security News
The Rust project is moving toward formal rules on LLM use in contributions after months of internal debate over maintainer burden, code quality, and contributor experience.