
Security News
npm Tooling Bug Incorrectly Marks One-Character Packages as Security Holders
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.
@tokenometer/core
Advanced tools
Empirical token-cost benchmarking for LLM prompts — core library (tokenizers, format converters, rate matrix, empirical countTokens dispatch).
Core library powering tokenometer: tokenizer dispatch, format converters, versioned cost rate matrix, and an empirical-mode
countTokensadapter for Anthropic, OpenAI, and Google.
Live playground · Source · MIT
If you just want a CLI, npm install -g tokenometer. This package is for programmatic use.
import {
tokenize,
tokenizeMatrix,
tokenizeEmpirical,
tokenizeMatrixEmpirical,
countTokens,
toFormat,
isFormat,
allFormats,
KNOWN_MODELS,
RATES,
RATES_VERSION,
getModel,
getRate,
} from '@tokenometer/core';
const result = tokenize({
prompt: '{"hello": "world"}',
format: 'yaml',
modelId: 'claude-opus-4-7',
});
// {
// model: 'claude-opus-4-7',
// provider: 'anthropic',
// format: 'yaml',
// tokenizer: 'cl100k_base',
// inputTokens: 12,
// inputCost: 0.00018,
// approximate: true // ← Anthropic does not publish a public Claude 3+ tokenizer
// }
const result = await tokenizeEmpirical({
prompt: '{"hello": "world"}',
format: 'yaml',
modelId: 'claude-opus-4-7',
env: { anthropicApiKey: process.env.ANTHROPIC_API_KEY! },
});
// approximate: false ← uses Anthropic's messages.countTokens
RATES is a Record<modelId, { inputPer1k, outputPer1k, cachedInputPer1k? }>. RATES_VERSION ships as a date string so consumers can pin or audit.
MIT
FAQs
Tokenometer core library — multi-provider LLM token cost, latency, and vision-token estimation with empirical countTokens fallback (Anthropic, OpenAI, Google, Mistral, Cohere).
The npm package @tokenometer/core receives a total of 104 weekly downloads. As such, @tokenometer/core popularity was classified as not popular.
We found that @tokenometer/core 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.

Security News
npm confirmed a tooling bug incorrectly marked several one-character packages as security holders and said it was working on a rollback.

Research
/Security News
Newer packages in this compromise use native extensions and .pth loaders to execute JavaScript stealers in developer environments.

Research
Socket found 37 malicious PyPI wheels that abuse Python startup hooks to launch a Bun-powered credential stealer tied to Mini Shai-Hulud/Miasma.