JSONL log, CLI, and MCP server. Wrap your provider client. No account required.
Try it in your browser → View on npm Free API →
Zero install, zero signup. Paste a JSONL log, hit the free API, or install the SDK.
Token spend is 30–60% of any AI app's variable cost. Knowing where it goes — per provider, per model, per user, per call — usually requires committing to a full observability platform. tokenmark sits before that commitment: drop-in middleware that writes every LLM call to a local JSONL file, queryable by CLI or via MCP for autonomous agents.
If you outgrow it, the data is already in the open format your future platform wants. If you don't, it stays local and private.
npm install tokenmark
# In your code:
import Anthropic from "@anthropic-ai/sdk";
import { wrapAnthropic } from "tokenmark";
const client = wrapAnthropic(new Anthropic());
const msg = await client.messages.create({
model: "claude-haiku-4-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello." }],
});
// → call logged to ./tokenmark.jsonl with cost, tokens, latency
# Read the log:
npx tokenmark report --since 7d --route-recommendations
{
"mcpServers": {
"tokenmark": {
"command": "npx",
"args": ["-y", "tokenmark-mcp"]
}
}
}
Tools available: list_calls, get_spend_summary, get_top_costly_calls, get_route_recommendations.
The same analysis is available as a hosted Apify Actor — POST your JSONL log (or array of call entries) and get back a spend summary, top costly calls, and rule-based route recommendations. Pay-per-event pricing, no signup beyond Apify's marketplace.
| Provider | Models | Coverage |
|---|---|---|
| Anthropic | claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5 | input + output + cache |
| OpenAI | gpt-5, gpt-5-mini, gpt-5-nano | input + output + cache-read |
| gemini-2.5-pro, gemini-2.5-flash | input + output |
Pricing table cites source URLs + last-verified dates. Unknown models log cost_unknown: true rather than silently zeroing.
This SDK does not transmit prompt content, completion content, system prompts, tool calls, or any user data by default. The default sink is a local file under your control. The HTTP sink is opt-in to a URL you provide. There is no analytics, telemetry, or phone-home.