Quickstart

Wrap your AI client, tag calls with a customer and feature, and see the cost in under five minutes.

1. Install the SDK

pip install veqen
npm install @veqen/sdk

The SDKs have no dependencies and support Python 3.10+ and Node.js 20+.

2. Wrap your client and tag calls

wrap() returns the same client with the same methods. Each call is priced the moment its response (or the end of its stream) arrives.

import veqen
from openai import OpenAI

veqen.init(ledger_file=".veqen/ledger.jsonl")   # no key yet: price locally, write a local ledger
client = veqen.wrap(OpenAI(), feature="support-bot")

with veqen.tags(customer="acme", user="u_42"):
    client.responses.create(model="gpt-5-mini", input="Where is my order?")
import OpenAI from "openai";
import { init, wrap, withTags } from "@veqen/sdk";

init({ ledgerFile: ".veqen/ledger.jsonl" }); // no key yet: price locally, write a local ledger
const client = wrap(new OpenAI(), { feature: "support-bot" });

await withTags({ customer: "acme", user: "u_42" }, () =>
  client.responses.create({ model: "gpt-5-mini", input: "Where is my order?" }));

Anthropic (messages.create, messages.stream) and Google GenAI (models.generate_content) clients wrap the same way.

3. See the cost

Run your app, then:

npx @veqen/sdk report

You'll see calls and cost per customer, feature and model from the local ledger. Nothing has left your machine.

4. Send it to the cloud ledger

Sign up (free for 60,000 tracked calls a month), create an ingest key under Settings › API keys, and set it where your app runs:

export VEQEN_API_KEY=vq_live_...

veqen.init() (or init() in JavaScript) reads it. Calls are sent in the background in gzip batches; your requests never wait on Veqen. In a serverless function, flush before returning:

veqen.flush()
await flush();

Under Settings › Connections, add an OpenAI or Anthropic admin key. Veqen imports the last 30 days of what you were actually billed, before any of your code changes, and from then on reconciles it with the calls you track. See Reconciliation.

Next

  • Tags: what to tag and how tags flow through async code
  • Budgets: per-customer limits the SDK enforces
  • Framework integrations: Vercel AI SDK, LangChain, LiteLLM, OpenAI Agents SDK