# Moving cost tracking from Helicone to Veqen

Helicone tracks cost by routing requests through its proxy and reading custom headers. Veqen works in your process instead: there's no base URL to change and no extra hop for each request.

## 1. Remove the proxy

```python
# Before
client = OpenAI(base_url="https://oai.helicone.ai/v1",
                default_headers={"Helicone-Auth": f"Bearer {HELICONE_API_KEY}"})

# After
import veqen
veqen.init(api_key=VEQEN_API_KEY)  # or set VEQEN_API_KEY; without a key, set ledger_file= to keep a local ledger
client = veqen.wrap(OpenAI())
```

## 2. Map headers to tags

| Helicone | Veqen |
|---|---|
| `Helicone-User-Id: u_42` | `veqen.tags(user="u_42")` |
| `Helicone-Property-Customer: acme` | `veqen.tags(customer="acme")` |
| `Helicone-Property-Feature: search` | `veqen.wrap(client, feature="search")` or `veqen.tags(feature="search")` |
| `Helicone-Property-Project: evals` | `veqen.tags(project="evals")` |
| `Helicone-Property-Environment: prod` | `VEQEN_ENVIRONMENT=production` |
| Any other `Helicone-Property-X` | `veqen.tags(x=...)` (kept as a free-form tag) |

Headers are set per request; tags are set once per request context and apply to every call inside it, so most call sites need no change at all.

## 3. Keep what you rely on

- **Spend history.** Connect your OpenAI or Anthropic admin key: Veqen imports the last 30 days of billed cost by model, so dashboards aren't empty on day one.
- **Rate limits and caching** that ran in the proxy belong in your app or a gateway; Veqen doesn't sit in the request path.
- **Prompt logs** aren't part of Veqen, which never sees prompts or responses. Keep your tracing tool for that.

## What you gain

Exact prices with every billing rule, budgets the SDK enforces before a call is made, reconciliation against the invoice, margin per customer, and journal entries for finance.
