Getting Started · 4 min · Updated 2026-08-24

Installing the Python wrapper

Detailed installation guide for the Tokeven Python SDK

Requirements

  • Python 3.11+
  • An existing Anthropic, OpenAI, or Google AI SDK installation
  • A Tokeven ingest token (create one in Settings > Tokens)

Install via pip

pip install tokeven

Configuration

The wrapper reads your ingest token from the environment or accepts it directly:

# Option 1: Environment variables
export TOKEVEN_INGEST_TOKEN="tkv_ing_..."
export TOKEVEN_BASE_URL="https://api.tokeven.com"
# Option 2: Pass directly
tracked = TokevenAnthropic(client, ingest_token="tkv_ing_...", base_url="https://api.tokeven.com")

base_url matters: unset, it defaults to http://localhost:8000 and every event is queued locally forever with no error raised.

Supported providers

  • Anthropic SDK - full support (v0.1), via TokevenAnthropic
  • OpenAI SDK - full support (v0.1), via TokevenOpenAI
  • Google AI SDK - full support (v0.1), via TokevenGemini
  • xAI/Grok - full support (v0.1), via TokevenXAI (the OpenAI SDK pointed at api.x.ai)

wrap(client, ...) picks the right one for you by inspecting the client you pass.

Verifying the installation

After wrapping your client, make a test call and check the dashboard. You should see the call appear within seconds.

Track your real costs

Calculators estimate. The dashboard shows what you actually spend and where you can save.