Inspect 31 frontier AI models, estimate token usage, calculate prompt invocation costs, and simulate diurnal off-peak discounts directly from your terminal, Unix pipelines, or automated CI/CD guardrails.
Zero installation required with npx, or install globally for shorthand tokenmath execution.
npm install -g @tokenmath/tokenmathtokenmath binary in your PATHnpx @tokenmath/tokenmath calculate --model gpt-5-6-sol --input 10000 --output 2000cat prompt.txt | npx @tokenmath/tokenmath countnpx @tokenmath/tokenmath compare claude-sonnet-5 gpt-5-6-sol --input 10000 --output 2000npx @tokenmath/tokenmath prices --json > pricing-cache.jsonComputes total call and monthly run costs using first-party pricing equations.
claude-sonnet-5)Analyzes arbitrary text or files across Claude BPE, OpenAI o200k, Google Gemini, and DeepSeek tokenizers.
Provides side-by-side cost and technical capability comparisons between any two catalog models.
Dumps the canonical, human-verified price sheet for all 31 models.
Block pull requests that exceed your maximum prompt token or budget thresholds
# .github/workflows/llm-budget-check.yml
name: LLM Token Budget Guardrail
on: [pull_request]
jobs:
token-budget:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Verify System Prompt Size
run: |
TOKENS=$(cat prompts/system.md | npx @tokenmath/tokenmath count | grep "Anthropic Claude" | awk '{print $5}')
echo "System prompt contains $TOKENS tokens"
if [ "$TOKENS" -gt 4000 ]; then
echo "Error: System prompt exceeded 4,000 token limit! Found $TOKENS."
exit 1
fi