# OpenAI cost tracking

Wrap the OpenAI client once and every call is priced at OpenAI's list rates: cached input, Batch, Flex and Priority processing, long-context tiers, images by size and quality, speech, transcription and embeddings.

## Wrap the client

```python [Python]
import veqen
from openai import OpenAI

veqen.init()  # reads VEQEN_API_KEY, an ingest key
client = veqen.wrap(OpenAI(), feature="chat")

with veqen.tags(customer=org.id):
    client.responses.create(model="gpt-5-mini", input=question)
```

```ts [TypeScript]
import OpenAI from "openai";
import { wrap, withTags } from "@veqen/sdk";

const client = wrap(new OpenAI(), { feature: "chat" });

await withTags({ customer: org.id }, () => client.responses.create({ model: "gpt-5-mini", input: question }));
```

Prompts and responses never leave your process: the wrapper reads only the usage OpenAI returns.

## Reconcile to the bill

Under Settings › Connections, add an OpenAI admin key with read access to usage. Veqen imports billed cost per model from OpenAI's Costs API every few hours and compares it with what you tracked, so you see the capture rate and any gap by model.

## Next

- [Python](/docs/python) and [JavaScript](/docs/javascript) SDKs.
- [Reconciliation](/docs/reconciliation): reading the capture rate.
- [OpenAI model prices](/providers/openai).
