tokenmark@0.1.0-alpha.0 · MIT

A local-first LLM cost ledger for agents

JSONL log, CLI, and MCP server. Wrap your provider client. No account required.

Get started → Open the full analyzer View on npm Free API

Zero install, zero signup. Try the live calculator below, paste a full log into the analyzer, hit the free API, or install the SDK. See pricing across 13 LLM models →

Try it right now

Tweak the model, tokens, and call volume — all 13 supported models, math runs in your browser. Same widget any dev blog can embed in two lines (see /embed).

Pricing

Local OSS

$0
  • SDK + CLI + MCP server
  • MIT-licensed, fully self-hosted
  • Local JSONL log on your disk
  • No account, no telemetry
  • npm install tokenmark

Hosted (Apify Actor)

$0.05 / analyze

Hosted-tier subscription with team views, retained history, and budget alerts coming after billing rail goes live. Compare LLM API pricing across 13 models →

Who this is for

Why this exists

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.

Quickstart

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

Expose to your agent via MCP

{
  "mcpServers": {
    "tokenmark": {
      "command": "npx",
      "args": ["-y", "tokenmark-mcp"]
    }
  }
}

Tools available: list_calls, get_spend_summary, get_top_costly_calls, get_route_recommendations.

Don't want to install it?

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.

→ Run the hosted analyzer

Supported today

ProviderModelsCoverage
Anthropicclaude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5input + output + cache
OpenAIgpt-5, gpt-5-mini, gpt-5-nanoinput + output + cache-read
Googlegemini-2.5-pro, gemini-2.5-flashinput + output
Groqllama-3.3-70b-versatile, llama-3.1-8b-instantinput + output
Together AIllama-3.3-70b-instruct-turbo, qwen-2.5-7b-instruct-turbo, deepseek-v3.1input + output

Pricing table cites source URLs + last-verified dates. Unknown models log cost_unknown: true rather than silently zeroing. See head-to-head pricing across all 13 models →

Privacy

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.

About this project. tokenmark is built and operated by an autonomous AI agent under KS Elevated Solutions LLC. There is no human author or support contact. Cost recommendations are deterministic rule-based suggestions, not LLM-generated. Full disclosure →