Skip to main content

Privacy first cost visibility for Claude, ChatGPT, and Gemini API calls. Metrics only, and your provider keys and prompts stay on your machine.

Project description

tokeven

Per prompt cost visibility for the Claude, OpenAI, and Google SDKs, without Tokeven ever holding a provider key or seeing a prompt.

tokeven wraps the official provider SDKs. Your call goes to the provider exactly as before, and the wrapper reads the usage block off the response and pushes a small metrics event to your Tokeven dashboard. It also answers the question that saves the most money, which is what a call is about to cost before you send it.

What it does

  • Estimates cost and confidence across all three providers before you send a call, so model choice is an informed decision rather than a default.
  • Records what each call actually cost, with cache aware pricing recomputed server side.
  • Runs as an MCP server, so Claude Code can ask for an estimate directly.
  • Ships a live cost widget for your shell prompt or status line, and a self hosted sidecar for capturing usage without an SDK wrapper.
  • Suggests cheaper models and prompt level efficiency improvements, and always leaves the decision to you. Nothing is rerouted silently.

Privacy

  • Tokeven receives token counts and metadata such as model, latency, and a character count computed locally. Prompt and completion content never reaches Tokeven through this pipeline.
  • Every outgoing event passes a strict key allowlist, so content cannot be transmitted by accident.
  • Authentication to Tokeven uses a write only ingest token, which cannot read your data or manage your account. It is not a provider key, and Tokeven never asks for one.
  • Two features are opt in exceptions that do send prompt text you explicitly hand them, because rewriting a prompt requires reading it: the prompt revision tool on the website and advisor.improve(). Both are disclosed at the point of use. Details at https://tokeven.com/privacy
  • If any part of the instrumentation fails, your provider call is returned unchanged. Tokeven is designed not to break your application.

Install

pip install tokeven                  # wrapper, advisor, CLI, widget
pip install "tokeven[anthropic]"     # with the Anthropic SDK
pip install "tokeven[openai]"        # with the OpenAI SDK
pip install "tokeven[google-genai]"  # with the Google SDK
pip install "tokeven[mcp]"           # with the MCP server
pip install "tokeven[proxy]"         # with the self hosted sidecar
pip install "tokeven[all]"           # everything

For the command line tools on their own, without touching a project environment:

pipx install tokeven

Quickstart

Wrap your existing provider client. Configuration is read from the environment: TOKEVEN_INGEST_TOKEN, TOKEVEN_BASE_URL, TOKEVEN_PROJECT, TOKEVEN_MODE.

from anthropic import Anthropic
from tokeven import TokevenAnthropic

client = TokevenAnthropic(Anthropic(), project="billing-agent")

resp = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=512,
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.content)   # unchanged Anthropic response

client.flush()   # optional: force-push buffered events before exit

TokevenOpenAI and TokevenGemini wrap the OpenAI and Google SDKs the same way.

First run

Set your write only ingest token:

export TOKEVEN_INGEST_TOKEN="tkv_ing_..."
export TOKEVEN_BASE_URL="https://api.tokeven.com"

Create a token at https://tokeven.com/settings

Estimate the cost of a call before you send it:

tokeven estimate --model claude-opus-4-8 "your prompt here"

The estimate runs entirely on your machine and needs no account at all.

The sidecar (optional)

If you would rather not wrap an SDK, run the self hosted sidecar and point your provider base URL at it. It forwards every request to the provider verbatim and captures usage on a fail open side channel. Provider keys and prompt content never reach Tokeven.

pip install "tokeven[proxy]"
tokeven-proxy

A container image and an example docker-compose.yml ship alongside this package.

The live cost widget (optional)

A one line spend gauge for your shell prompt, tmux, or editor status line. It reuses your dashboard login, never an ingest token or a provider key.

tokeven-widget            # print one status line and exit
tokeven-widget watch      # poll and reprint on an interval

What is and is not tracked

Tokeven sees the traffic you instrument. Calls made through the provider consoles, through the Anthropic Workbench, or from applications you have not wrapped will not appear on the dashboard.

Free and paid

Everything this package does on your machine is free, and there is no trial clock on it. That includes pre send cost estimates, the model picker, efficiency suggestions, the MCP server, the sidecar, and the live cost widget. A free Tokeven account adds a dashboard covering 1,000 tracked calls per month.

The paid tier is priced as gainshare. Tokeven earns 10 percent of verified savings, measured per call against live token prices rather than a frozen baseline, and you keep the other 90 percent. If you save nothing, you pay nothing, and the fee falls automatically when model prices fall. There is no per seat charge.

Paid adds:

  • Unlimited tracked calls
  • Prompt revision suggestions
  • Organization wide savings dashboard and per person savings tracking
  • Analytics across all three providers
  • Embeddable widgets
  • n8n and webhook integrations
  • CSV, JSON, and API export

Enterprise terms, including capped arrangements for teams that budget fixed line items, SSO, and custom retention, are handled case by case.

If you are weighing the paid tier or want a hand sizing what you would actually save, email team@tokeven.com. We are happy to look at your numbers with you, and there is no obligation attached to asking. Full pricing detail is at https://tokeven.com/pricing

License

Proprietary. The full terms ship in the LICENSE file bundled with this package. Questions: team@tokeven.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tokeven-0.1.0.tar.gz (128.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tokeven-0.1.0-py3-none-any.whl (101.6 kB view details)

Uploaded Python 3

File details

Details for the file tokeven-0.1.0.tar.gz.

File metadata

  • Download URL: tokeven-0.1.0.tar.gz
  • Upload date:
  • Size: 128.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tokeven-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ac73d35006a4b5648a7a63a8dec499c5ae11ea21c31671e6e0975ecac570b2ff
MD5 830ac16fbbded454473fb646382e0895
BLAKE2b-256 52665154ddbc098dfddb9e6672032299539c68ba7dc6e8c1dc547f9ddc7b3e2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokeven-0.1.0.tar.gz:

Publisher: release-pypi.yml on harrhall/tokeven

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tokeven-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tokeven-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 101.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for tokeven-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4859933fb3fbff9789c694824bce2f2ae9c308d1320119134b1326d4fbc6e5c
MD5 422f8d33da163421f0eaa0ab273dcaf9
BLAKE2b-256 47ac5b64f153257bb3c88adea1e6c3b9f747724fc3526ef4079222de78b64742

See more details on using hashes here.

Provenance

The following attestation bundles were made for tokeven-0.1.0-py3-none-any.whl:

Publisher: release-pypi.yml on harrhall/tokeven

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page