Back to home

How Tokeven works

A privacy-first AI cost optimization platform that tracks every token across Claude, ChatGPT, and Gemini - without ever receiving your API keys or seeing your prompts. Here's exactly how it works, end to end.

The data flow

From API call to dashboard - four hops, zero prompts transmitted.

1 of 4

Your machine

SDK wrapper captures response.usage after each call. Computes token counts, model, latency, cost. Prompt content never reaches Tokeven.

2 of 4

Batched push

Events flush to /ingest asynchronously (default: every 5s or 50 events). Authenticated by write-only ingest token.

3 of 4

Tokeven backend

Server recomputes cost_usd (cache-aware, authoritative). Idempotent on (org_id, event_id) - duplicates are silently dropped.

4 of 4

Dashboards

Five pre-built views query usage_events and usage_summaries. Sub-2-second load. Export to CSV/JSON anytime.

Step 1

Install the SDK wrapper

Tokeven ships as a lightweight Python wrapper around the Anthropic SDK. You wrap your existing client in a single function call - no code changes to your prompts, no new dependencies in your hot path.

After each API call, the wrapper reads response.usage and captures: input/output tokens, cache read/write tokens, model name, latency, and a local character count of the prompt. It never reads or transmits the prompt content itself.

What gets captured

  • Token counts (input, output, cache_read, cache_creation)
  • Model name (e.g. claude-sonnet-4-6)
  • Latency in milliseconds
  • Local prompt_length (character count, not content)
  • session_id and project tags (optional)
  • tool_used (detected from tool_use blocks)

What the wrapper never sends to Tokeven

  • Prompt and completion content
  • Your Anthropic / OpenAI / Google API key
  • Any personally identifiable information
settings.json
1// Claude Code → settings.json
2// pip install "tokeven[mcp]"
3{
4 "mcpServers": {
5 "tokeven": {
6 "command": "tokeven-mcp",
7 "env": { "TOKEVEN_PROJECT": "my-app" }
8 }
9 }
10}
Your Weekly Spend Digest
· tokeven
Mon 9:00 AM
3 optimizations found - save $1,520/mo
Total calls
312
Total cost
$1,847
Avg cost/call
$5.92
Cache hit rate
34%
42% of Opus calls could use Sonnet
$890/mo

You made 63 calls to claude-opus-4-8 with avg prompt length under 200 chars. Sonnet handles these at 40% lower cost with comparable quality.

Enable cache_control on your system prompt
$520/mo

Your 4,200-token system prompt repeats 8x/day across sessions. Adding cache_control would cut 90% off cached input tokens.

Trim repeated context in 3 workflows
$110/mo

3 workflows re-send full conversation history on every call. Summarizing prior turns before re-sending would cut input tokens by ~60%.

View full report in dashboard
Step 2

Receive personalized coaching

Every Monday, each developer receives a digest built from their actual usage patterns. Not generic best practices - specific, actionable optimizations with exact dollar amounts attached.

Efficiency quick wins (shipped with wrapper)

  • Model-tier nudges: 'This task used Opus but Haiku handles it at 80% less'
  • Cache hints: 'Your 4,200-token system prompt repeats 8x/day - add cache_control'
  • Context trimming: 'This workflow re-sends full history -summarize prior turns to cut 60%'
  • Prompt-length flags: 'Reference files instead of pasting - 12K chars is expensive'
  • Auto-compaction: Summarize long conversations to cut input token growth
Step 3

Track everything in five dashboards

Purpose-built for AI cost visibility. Each dashboard loads in under 2 seconds and answers a specific question your CFO, CTO, or engineering lead is asking.

Cost Overview

Total cost, YTD trend, cost by model, daily/weekly bar charts. Your landing page.

Model Usage

Distribution across Opus/Sonnet/Haiku. Cost per call by model. Top 10 most expensive calls.

Token Metrics

Input vs output split. Avg prompt length over time. Tokens per day. Cache efficiency donut.

Usage Patterns

Calls per day. Tool usage breakdown. Peak usage heatmap (day x hour). Prompt length histogram.

Summary & Export

Period comparison, 30-day forecast, CSV/JSON export. The board-ready view.

Coming: Per-Person

Individual contributor breakdowns. Team rollups. The view that turns cost data into coaching.

app.tokeven.com/dashboard/cost
Cost Overview
7 days
30 days
90 days
Total Cost (7d)
$4,200
+12% vs prev
Avg Cost / Call
$0.14
1,847 calls
Cache Hit Rate
34%
↑ from 28%
Daily Cost
MonTueWedThuFriSatSun
Cost by Model
claude-opus-4-8$1,840
gpt-5.6-sol$1,520
claude-sonnet-4-6$920
gemini-3.1-pro$780
gpt-5.5$540
gemini-3.5-flash$220
claude-haiku-4-5$180
Most Expensive Calls
gpt-5.6-sol
$0.48
claude-opus-4-8
$0.42
gemini-3.1-pro
$0.34
claude-sonnet-4-6
$0.28

Product roadmap

Each phase earns the right to the next. We ship what we can prove works.

MVP 1Building now

Land individual developers

  • Python SDK wrapper (drop-in around Anthropic SDK)
  • Local-only metadata logging - the wrapper sends metrics to Tokeven, never prompt content
  • Weekly analysis digest with model-tier, caching, and prompt-length tips
  • Free tier with capped monthly throughput
  • 5 pre-built dashboards: cost, models, tokens, patterns, exports
  • Write-only ingest tokens (SHA256 hashed, revocable)
MVP 2Next

Convert to org-wide visibility

  • REST API into your existing BI dashboards
  • Per-person and per-team cost rollup
  • Gainshare savings calculation - live token pricing, fully auditable
  • Multi-user org management with role-based access
  • Spend alerts and budget thresholds
V2Planned

Right-size models in real time

  • Silent model routing chosen per task complexity
  • Auto-detect tasks that can drop from Opus to Sonnet or Haiku
  • User always has final say - never a silent downgrade
  • TypeScript wrapper + language-agnostic sidecar proxy
V3Planned

Forecast before you commit budget

  • Size token usage before a team commits real spend
  • Project-level cost projections based on historical patterns
  • What-if scenarios: 'If we move 50% of Opus to Sonnet, we save...'
V4Future

Capability layer - train your team

  • Training resources matched to each person's skill gaps
  • Prompt pattern library built from your team's best practices
  • AI proficiency scoring for L&D and performance reviews

Ready to see where your AI budget actually goes?

The free developer tool is available now. Install in 2 minutes, get your first insights by Monday.

Get Early Access