# Quickstart

## 1. Install the SDK

```bash [Python]
pip install veqen
```

```bash [TypeScript]
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.

```python [Python]
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?")
```

```ts [TypeScript]
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:

```bash
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](https://veqen-app.com/signup) (free for 60,000 tracked calls a month), create an **ingest** key under Settings › API keys, and set it where your app runs:

```bash
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:

```python [Python]
veqen.flush()
```

```ts [TypeScript]
await flush();
```

## 5. Connect a provider (optional, recommended)

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](/docs/reconciliation).

## Next

- [Tags](/docs/tags): what to tag and how tags flow through async code
- [Budgets](/docs/budgets): per-customer limits the SDK enforces
- [Framework integrations](/docs/integrations): Vercel AI SDK, LangChain, LiteLLM, OpenAI Agents SDK
