Report-only by design
We never see, store or proxy your provider API keys. The SDK reads token usage from responses you already receive.
AI cost tracking for OpenAI, Anthropic, Gemini & 7 more
Change one line of code and see your spend by day, model and feature — with budget alerts before it spikes. Report-only: your API keys never leave your app.
Free while in early access · No credit card · Keys never leave your app
Quickstart
npm install @tokli/node
import Anthropic from "@anthropic-ai/sdk";
import { wrapAnthropic } from "@tokli/node";
const anthropic = wrapAnthropic(new Anthropic()).withFeature("checkout");
// Use it exactly like before — usage reports itself, fire-and-forget.
const reply = await anthropic.messages.create({
model: "claude-sonnet-5",
max_tokens: 300,
messages: [{ role: "user", content: "Hello" }],
});
import OpenAI from "openai";
import { wrapOpenAI } from "@tokli/node";
const openai = wrapOpenAI(new OpenAI()).withFeature("checkout");
// Use it exactly like before — usage reports itself, fire-and-forget.
const reply = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello" }],
});
import { GoogleGenAI } from "@google/genai";
import { wrapGemini } from "@tokli/node";
const gemini = wrapGemini(new GoogleGenAI({})).withFeature("checkout");
// Use it exactly like before — usage reports itself, fire-and-forget.
const reply = await gemini.models.generateContent({
model: "gemini-3.5-flash",
contents: "Hello",
});
import OpenAI from "openai";
import { wrapDeepSeek } from "@tokli/node";
const client = new OpenAI({ baseURL: "https://api.deepseek.com" });
const deepseek = wrapDeepSeek(client).withFeature("checkout");
// xAI, Mistral, Qwen, GLM, Kimi and OpenRouter work the same way —
// same OpenAI SDK, different baseURL and wrapper.
const reply = await deepseek.chat.completions.create({
model: "deepseek-v4-flash",
messages: [{ role: "user", content: "Hello" }],
});
Set TOKLI_INGEST_KEY in your environment — that's the
whole setup. Without it the wrapper is a silent no-op: your app never breaks.
Every call shows up in your dashboard — by day, model and feature, priced to the micro-cent. Create your project and paste the ingest key. Here's what you get:
Why tokli
We never see, store or proxy your provider API keys. The SDK reads token usage from responses you already receive.
Tag calls with .withFeature() and learn which part of
your product actually burns the budget.
Wraps your existing client. Fire-and-forget, zero added latency, fails open — it can never take your app down.
Costs computed server-side from versioned prices, tracked to the micro-cent. Get warned before the spike, not after the invoice.
Works with the LLM APIs you already use — ten providers, streaming included.
FAQ
No. tokli is report-only: your code calls the provider with your own key, and the SDK reads token usage from responses you already receive. Your keys never leave your app.
No. Usage is reported fire-and-forget after your call completes — tokli never sits in the request path.
Nothing happens to your app. The wrapper fails open: if the ingest key is missing or reporting fails, it's a silent no-op and your calls work exactly as before.
Yes. Every supported provider reports token usage in the final stream event, and the
SDK captures it without touching your stream. A few providers need
stream_options: { include_usage: true } on
streaming calls — each wrapper's docs say whether yours does.
OpenAI, Anthropic, Gemini, DeepSeek, xAI, Mistral, Qwen, GLM, Kimi and OpenRouter, with costs computed server-side from a versioned price table. Calls to unknown models are still recorded and flagged — never dropped.
tokli is free while in early access. No credit card required.
No credit card. Uninstall = delete one line.
Start tracking — it's free