Azure OpenAI
Examples use Python. Beakpoint works with any language that OpenTelemetry supports.
Required Azure OpenAI Attributes
The following cost calculation tags are required for traces originating from Azure OpenAI API calls.
Always Required Fields
These fields are always required for Beakpoint to calculate Azure OpenAI costs:
| Attribute Name | Example Value | Allowed Values |
|---|---|---|
gen_ai.system | azure.ai.openai or openai | Either value works (see detection paths below) |
gen_ai.request.model | gpt-4.1 | Any valid OpenAI model name |
gen_ai.usage.input_tokens | 512 | Non-negative integer |
gen_ai.usage.output_tokens | 128 | Non-negative integer |
Detection Paths
Beakpoint detects Azure OpenAI spans through two paths:
| Path | gen_ai.system | server.address | How it works |
|---|---|---|---|
| Explicit | azure.ai.openai | Any or absent | Auto-instrumentation sets gen_ai.system = azure.ai.openai when using the AzureOpenAI client |
| Implicit | openai | Ends with .openai.azure.com | Auto-instrumentation sets gen_ai.system = openai, but the server address reveals it's Azure |
In both cases, Beakpoint calculates costs using OpenAI rates because Azure OpenAI charges the same per-token pricing as the direct OpenAI API.
Optional Enrichment Attributes
These fields are optional but improve cost accuracy when provided:
| Attribute Name | Example Value | Description |
|---|---|---|
gen_ai.response.model | gpt-4.1-2025-04-14 | The exact model version returned in the response. When present, this takes precedence over gen_ai.request.model for pricing lookups. |
gen_ai.usage.input_tokens.cached | 256 | Number of input tokens served from the prompt cache. Cached tokens are billed at a reduced rate. |
gen_ai.usage.output_tokens.reasoning | 64 | Number of tokens used for internal reasoning (o-series models). |
gen_ai.provider.name | azure.ai.openai | OTel semconv v1.37.0+ replacement for gen_ai.system. Takes precedence when both are present. |
server.address | mydeployment.openai.azure.com | Enables implicit detection when gen_ai.system = openai. Must end with .openai.azure.com for Azure identification. |
cloud.provider | azure | Cloud provider identifier. |
Supported Models
Azure OpenAI serves the same models as the direct OpenAI API. See the OpenAI cost tags reference for the full list of supported models and pricing.
Date suffixes on Azure OpenAI deployment names (e.g. gpt-5.4-mini-2026-01-15) are automatically stripped during model name normalization.
Python Example
Azure OpenAI uses the same opentelemetry-instrumentation-openai-v2 package as direct OpenAI — the OpenAIInstrumentor handles both OpenAI and AzureOpenAI clients:
pip install opentelemetry-instrumentation-openai-v2
from opentelemetry.instrumentation.openai_v2 import OpenAIInstrumentor
from openai import AzureOpenAI
# Instrument before creating the client
# See the Track LLM Costs guide for complete TracerProvider setup
OpenAIInstrumentor().instrument()
client = AzureOpenAI(
azure_endpoint="https://mydeployment.openai.azure.com",
api_version="2025-04-01-preview",
)
response = client.chat.completions.create(
model="gpt-4.1",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
],
)
The instrumentation automatically sets gen_ai.system, gen_ai.request.model, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, and the optional enrichment attributes from data the API response provides.
For full setup instructions, including how to configure the OpenTelemetry exporter for Beakpoint, see the Track LLM Costs guide.