A fully managed platform in Microsoft Foundry for hosting, scaling, and securing AI agents built with any supported framework or model
Use the 6,576 deployment tokens—5,169 input and 1,407 output—to estimate this run’s GPT-4o inference charge, while using Azure Cost Management meter records as the final billing authority; the 19,876 trace total is observability data and should not be treated as an additional GPT-4o charge.
An agent run is not inherently billed as one request. It is a unit of work that can contain multiple model turns and tool operations, each billed through the applicable meter. Tool calls can cause additional model turns, while MCP servers and dependent resources can generate separate charges through their own resources.^1^
What your figures indicate
| Figure | Interpretation |
|---|---|
| Playground: 5,169 in / 1,407 out | Usage returned for the model response |
AzureOpenAIRequestUsage: 5,169 / 1,407 |
Recorded deployment usage for that model request |
| Deployment metric: approximately 6.58K | Consistent with 5,169 + 1,407 = 6,576 |
| Trace: 19,377 in / 499 out | Trace-level observability figure requiring span-level inspection |
| Trace estimated cost | An estimate, not the final billed amount |
The agreement between the Playground, deployment metric, and one AzureOpenAIRequestUsage record strongly indicates one recorded GPT-4o deployment call in that interval. It proves a one-call run only if the trace’s model span and deployment log also share the corresponding request/response ID—not merely a similar timestamp.
Azure OpenAI exposes processed prompt and generated-completion metrics for model usage.^2^ For billing reconciliation, Microsoft specifically directs customers to the meter data in Azure Cost Management and states that invoice and meter records are the source of truth.^1^
Why the trace can differ
A Foundry trace represents the full execution journey. It can contain nested spans for the agent invocation, planning, model calls, MCP/tool execution, retries, and other operations.^3^
Token usage is attached to model-related spans through OpenTelemetry attributes such as gen_ai.usage.input_tokens and gen_ai.usage.output_tokens. Tool and agent spans are separate operations.^4^ These attribute names document the OpenTelemetry trace structure; the managed prompt-agent UI can present them differently.
The documentation does not define the aggregation algorithm for the specific token columns shown in your trace-list screenshot. Therefore, do not assume that 19,876 is either:
- an extra billable request, or
- definitely the sum of unique model tokens.
It could reflect aggregation across nested spans, retries, or another instrumentation difference, but that must be verified from the trace tree rather than inferred from the summary.
Reconcile the run
- In the Foundry project, open Agents → Traces, select the trace, and expand its complete waterfall. In the fleet experience, use Manage → Fleet → Agents → select the agent → Traces.^5^
- Count only model-inference spans such as
chatortext_completion; do not countinvoke_agentorexecute_toolas separate GPT-4o requests. - For every model span, record:
- input and output tokens;
- model and deployment;
- request or response ID;
- retry status and timestamp.
- Correlate those IDs with
AzureOpenAIRequestUsage. If there is one matching model span and one matching deployment record, use 5,169 input + 1,407 output for that model call. - In Azure Cost Management → Cost Analysis, select the relevant scope and time range, then group first by Meter and then by Operation name. Check both the GPT-4o deployment meters and any MCP/tool or dependent-resource meters. Billing data can arrive later and might not isolate one run exactly.
If the trace still cannot be reconciled
If the detailed trace contains only one model span but its summary still reports 19,876 tokens, open an Azure technical support request for Microsoft Foundry/Azure OpenAI tracing. Include:
- subscription and resource IDs;
- region, deployment name, model name, and model version;
- trace ID and request/response ID;
- exact UTC timestamp;
- screenshots of the trace detail and deployment metrics;
- the corresponding
AzureOpenAIRequestUsagerecords.
That condition requires service-side inspection of the trace aggregation.
If the invoice or Cost Management meters charge more model tokens than the deployment records support, open an Azure Cost Management + Billing support request instead and attach the meter-level cost/usage export. Keep MCP and other resource charges separate: an agent run can incur those even when GPT-4o itself made only one recorded request.^1^
References
- Billing concepts for Microsoft Foundry - Microsoft Foundry | Microsoft Learn
- Azure OpenAI monitoring data reference
- Agent tracing overview - Microsoft Foundry | Microsoft Learn
- Trace LangChain and LangGraph apps with Microsoft Foundry and Azure Monitor
- Manage agents at scale in Microsoft Foundry Control Plane