Token counter
Skill navveenb/lean-agentic-ai/lean-agentic-ai-claude-implementation/.claude/skills/token-counter
Lean Agentic AI
npx -y skills add navveenb/lean-agentic-ai --skill token-counterAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 9 stars9 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Estimate token usage for LLM API calls found in code
SKILL.md
1.3 KB, 339 tokens by cl100k_base, as published. Nobody here has run it
Token Counter Skill
When you find an LLM API call in code, estimate its token usage using these rules:
Estimation Rules
Input Tokens
- System prompt: Look for system message content. Estimate 1 token per 4 characters.
- User message: Look for user/human message content. If it includes variable interpolation, estimate based on typical content size.
- Few-shot examples: Count examples in the messages array. Each example ≈ 200-500 tokens.
- Tool descriptions: Count tool/function definitions. Each tool ≈ 100-500 tokens.
Output Tokens
- max_tokens parameter: If set, use that as the upper bound.
- If not set: Estimate by task type:
- Classification/routing: ~10-50 tokens
- Extraction: ~50-200 tokens
- Summarization: ~100-500 tokens
- Code generation: ~200-2000 tokens
- Creative writing: ~500-4000 tokens
Cost Rates (per 1M tokens)
| Model | Input | Output |
|---|---|---|
| Haiku / GPT-4o-mini | $0.25 | $1.25 |
| Sonnet / GPT-4o | $3.00 | $15.00 |
| Opus / GPT-4 / o1 | $15.00 | $75.00 |
Per Call Output
- Estimated input tokens: ____
- Estimated output tokens: ____
- Current model cost per call: $____
- Right-sized model cost per call: $____
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.