AI telemetry SDK / 01

Every token. Accounted for.

Instrument your AI applications with exact token, cost, latency, and feature attribution—without proxying traffic or surrendering provider credentials.

0prompts stored
<100msingestion target
6typed adapters
SDK setup / 02

From model response to cost insight in minutes.

One server-side SDK captures provider-reported usage and the business context that a machine-level command cannot reliably infer.

Create your account →
  1. 01

    Create an app key

    Create a Tokly workspace and app, then save the server-only write key shown once.

  2. 02

    Install the SDK

    Add the lightweight TypeScript package to the application that calls your model provider.

     npm install tokly-sdk
  3. 03

    Capture real usage

    Send provider usage through a typed adapter and attach the feature and environment that caused it.

    tokly.capture(fromOpenAIResponse({ model, usage }));
  4. 04

    Operate with context

    Inspect exact tokens, attributed cost, latency, pricing coverage, and budget thresholds in Tokly.

AdaptersVercel AIOpenAIAnthropicGeminiOpenRouterOllama
Ready-to-use code

Choose your provider example.

Copy the complete server-side example, add your app key as an environment variable, and capture the usage returned by your provider.

Pass the model and usage from an OpenAI Responses result.

import { createTokly } from "tokly-sdk";
import { fromOpenAIResponse } from "tokly-sdk/adapters";

const tokly = createTokly({
  apiKey: process.env.TOKLY_API_KEY!,
});

tokly.capture(fromOpenAIResponse({
  model: response.model,
  usage: response.usage,
  dimensions: {
    environment: "production",
    feature: "assistant",
  },
}));

await tokly.flush();

Run Tokly only on your server. Keep TOKLY_API_KEY in an environment variable and flush before a serverless request ends.

01 / Attribute

Know what caused the spend.

Break usage down by app, model, feature, environment, user, trace, and session.

02 / Reconcile

Price history, not guesswork.

Effective-dated model rates preserve the cost calculation that applied when each call ran.

03 / Respond

Budgets that speak up early.

Threshold alerts reach your team before a monthly AI bill becomes an incident.