# OpenRouter cost tracking

Point the OpenAI client at OpenRouter and wrap it. Each call is priced at the underlying lab's list price and counted toward OpenRouter's bill, so reconciliation compares it with what OpenRouter charged, fees included.

## Wrap the client

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

veqen.init()  # reads VEQEN_API_KEY, an ingest key
client = veqen.wrap(OpenAI(base_url="https://openrouter.ai/api/v1", api_key=OPENROUTER_KEY), feature="chat")

with veqen.tags(customer=org.id):
    client.chat.completions.create(model="anthropic/claude-sonnet-4.5", messages=messages)
```

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

const client = wrap(new OpenAI({ baseURL: "https://openrouter.ai/api/v1", apiKey: process.env.OPENROUTER_KEY }), { feature: "chat" });
```

## Without code changes

OpenRouter's Broadcast can send every request's usage to Veqen over OpenTelemetry, with customer and feature from the request's trace metadata: see [Track OpenRouter costs with Broadcast](/guides/openrouter-cost-tracking).

## Reconcile to the bill

Add an OpenRouter connection under Settings › Connections with a management key. Veqen imports spend per model from OpenRouter's activity API (the last 30 days) and compares it with what you tracked. The difference is mostly OpenRouter's fees and any provider price differences.

## Next

- [Reconciliation](/docs/reconciliation).
