Azure AI Foundry
Examples use Python. Beakpoint works with any language that OpenTelemetry supports.
Required Azure AI Foundry Attributes
The following cost calculation tags are required for traces originating from Azure AI Foundry API calls. Azure AI Foundry is a multi-model gateway that hosts models from various providers (OpenAI, Anthropic, Mistral, and others).
Always Required Fields
These fields are always required for Beakpoint to calculate Azure AI Foundry costs:
| Attribute Name | Example Value | Allowed Values |
|---|---|---|
gen_ai.system | azure.ai.inference | azure.ai.inference or az.ai.inference (case-insensitive) |
gen_ai.request.model | claude-sonnet-4 | Any model deployed in your Azure AI Foundry endpoint |
gen_ai.usage.input_tokens | 512 | Non-negative integer |
gen_ai.usage.output_tokens | 128 | Non-negative integer |
Provider Inference
Since gen_ai.system only identifies the gateway and not the underlying model provider, Beakpoint infers the real provider by examining the model name. This allows Beakpoint to apply the correct pricing for each model, which varies by provider:
| Model name pattern | Resolved provider |
|---|---|
Contains gpt, or starts with o1, o3, o4 | openai |
Starts with claude | anthropic |
Starts with mistral, codestral, ministral, pixtral | mistral |
Starts with meta-llama, llama | meta |
Starts with cohere, command | cohere |
Starts with jamba, ai21 | ai21 |
Starts with phi | microsoft |
| Anything else | azure.ai.inference (fallback) |
Once the provider is resolved, the same pricing applies as when calling that provider directly. For example, a claude-sonnet-4 model deployed in Azure AI Foundry is priced at the same rate as calling Anthropic's API directly.
Detection Paths
Beakpoint detects Azure AI Foundry spans through two paths:
| Path | Signal | Notes |
|---|---|---|
gen_ai.system | azure.ai.inference or az.ai.inference | Primary detection — set by the Azure AI Inference SDK |
server.address | Ending .models.ai.azure.com or .services.ai.azure.com | Secondary detection when gen_ai.system is absent or unrecognized |
Optional Enrichment Attributes
These fields are optional but improve cost accuracy when provided:
| Attribute Name | Example Value | Description |
|---|---|---|
gen_ai.response.model | claude-sonnet-4 | The exact model version returned in the response. Used as a fallback if gen_ai.request.model is absent. |
gen_ai.provider.name | az.ai.inference | OTel semconv v1.37.0+ replacement for gen_ai.system. Takes precedence when both are present. |
server.address | myendpoint.models.ai.azure.com | Used for secondary platform detection. |
cloud.provider | azure | Provider identification. |
Supported Models
Azure AI Foundry hosts models from multiple providers. Beakpoint prices each model according to the resolved provider's rates. See the individual provider reference pages for supported models and pricing:
- OpenAI models
- Anthropic Claude models
- AWS Bedrock models (Meta, Mistral, Cohere, Amazon)
Python Example
The Azure AI Inference SDK has built-in OpenTelemetry support. Install the SDK with the opentelemetry extra and the Azure Core tracing package:
pip install azure-ai-inference[opentelemetry] azure-core-tracing-opentelemetry
from azure.ai.inference import ChatCompletionsClient
from azure.ai.inference.tracing import AIInferenceInstrumentor
from azure.core.credentials import AzureKeyCredential
from azure.core.settings import settings
# Enable Azure SDK tracing with OpenTelemetry
settings.tracing_implementation = "opentelemetry"
# Instrument before creating the client (see the Track LLM Costs guide
# for the full TracerProvider setup)
AIInferenceInstrumentor().instrument()
client = ChatCompletionsClient(
endpoint="https://myendpoint.models.ai.azure.com",
credential=AzureKeyCredential("YOUR_KEY"),
)
response = client.complete(
model="claude-sonnet-4",
messages=[{"role": "user", "content": "Hello!"}],
)
Unlike other platforms, Azure AI Inference requires setting settings.tracing_implementation = "opentelemetry" to enable Azure SDK tracing. This is a one-time global configuration.
The instrumentation automatically sets gen_ai.system, gen_ai.request.model, gen_ai.usage.input_tokens, and gen_ai.usage.output_tokens on each span.
For full setup instructions, including how to configure the OpenTelemetry exporter for Beakpoint, see the Track LLM Costs guide.