SDK & Integration · 2 min · Updated 2026-10-20

TypeScript SDK

Track Claude, OpenAI, Gemini and Grok calls from Node and edge runtimes

Setup

npm install @tokeven/sdk
export TOKEVEN_INGEST_TOKEN=tkv_ing_...
import Anthropic from "@anthropic-ai/sdk";
import { wrap } from "@tokeven/sdk";

const client = wrap(new Anthropic()); // same client, same return values

wrap() also takes an OpenAI client, an OpenAI client pointed at https://api.x.ai/v1 for Grok, or a Google GenAI client.

What it captures

Input, output and cache tokens, modality, tool name and latency for each call, streaming included. Cost is computed by the Tokeven server. Prompt content never reaches Tokeven.

Serverless and edge

Runs on Node 20.16+, Vercel and Cloudflare edge, Deno and Bun. Call await flush() before a serverless or edge handler returns, since background timers do not outlive the request there.

Track your real costs

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