# Azure OpenAI and AI Foundry cost tracking

Azure OpenAI deployments are priced like OpenAI's models but billed by Azure. Veqen prices them at list and puts them on Azure's bill, so reconciliation compares them with your Azure invoice, not OpenAI's.

## Wrap the client

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

veqen.init()  # reads VEQEN_API_KEY, an ingest key
client = veqen.wrap(AzureOpenAI(azure_endpoint="https://acme-east.openai.azure.com", api_version="2024-10-21"),
                    feature="search")

with veqen.tags(customer=org.id):
    client.chat.completions.create(model="gpt-4o-mini", messages=messages)
```

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

const client = wrap(new AzureOpenAI({ endpoint: "https://acme-east.openai.azure.com", apiVersion: "2024-10-21" }), { feature: "search" });
```

The provider is read from the endpoint: `*.openai.azure.com` and AI Foundry's `*.services.ai.azure.com` are both Azure's. If your deployment names differ from the model names, Veqen uses the model the response reports. Through LiteLLM, `azure/` models are attributed to Azure too.

## Reconcile to the bill

Register an app in Entra ID with Cost Management Reader on the subscription or billing account your Azure OpenAI resources bill to. Add an Azure connection under Settings › Connections with its tenant id, client id, secret and that scope. Veqen imports AI cost per model each day. Name a resource tag to split the bill by it.

## Next

- [Reconciliation](/docs/reconciliation).
- [Azure AI Foundry model prices](/providers/azure-ai).
