Skip to main content

Azure AI Foundry

Language

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 NameExample ValueAllowed Values
gen_ai.systemazure.ai.inferenceazure.ai.inference or az.ai.inference (case-insensitive)
gen_ai.request.modelclaude-sonnet-4Any model deployed in your Azure AI Foundry endpoint
gen_ai.usage.input_tokens512Non-negative integer
gen_ai.usage.output_tokens128Non-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 patternResolved provider
Contains gpt, or starts with o1, o3, o4openai
Starts with claudeanthropic
Starts with mistral, codestral, ministral, pixtralmistral
Starts with meta-llama, llamameta
Starts with cohere, commandcohere
Starts with jamba, ai21ai21
Starts with phimicrosoft
Anything elseazure.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:

PathSignalNotes
gen_ai.systemazure.ai.inference or az.ai.inferencePrimary detection — set by the Azure AI Inference SDK
server.addressEnding .models.ai.azure.com or .services.ai.azure.comSecondary detection when gen_ai.system is absent or unrecognized

Optional Enrichment Attributes

These fields are optional but improve cost accuracy when provided:

Attribute NameExample ValueDescription
gen_ai.response.modelclaude-sonnet-4The exact model version returned in the response. Used as a fallback if gen_ai.request.model is absent.
gen_ai.provider.nameaz.ai.inferenceOTel semconv v1.37.0+ replacement for gen_ai.system. Takes precedence when both are present.
server.addressmyendpoint.models.ai.azure.comUsed for secondary platform detection.
cloud.providerazureProvider 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:

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!"}],
)
note

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.