Azure OpenAI Realtime API: Token usage vs Billing metrics

momotaimamura-5310 20 Reputation points
2025-07-22T09:49:24.2433333+00:00

I have a few questions regarding token usage and billing for the Azure OpenAI Realtime API.

  1. The Realtime API’s response.done message includes fields indicating the amount of tokens used such as usage.input_token_details.text_tokens and input_token_details.cached_tokens. On the other hand, the Azure portal shows usage metrics such as processed_prompt and generated_completion. Are these values directly related or equivalent?
  2. Which of these token counts (Realtime API usage vs Azure metrics) are used for billing? Or are there other ways to get more accurate or detailed information about token usage and associated costs? I’m trying to estimate billing based on token counts and pricing data from the official page: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
{count} votes

Answer accepted by question author
  1. Pavankumar Purilla 11,480 Reputation points Microsoft External Staff Moderator
    2025-07-23T02:18:19.78+00:00

    Hi momotaimamura-5310,

    When using the Azure OpenAI Realtime API, the response.done message provides detailed token usage information, such as usage.input_token_details.text_tokens (total input tokens) and cached_tokens (tokens served from cache), along with output_tokens (tokens generated in the response). These fields help you understand how the model processes each request.

    However, for billing purposes, Azure uses a different set of metrics that are visible in the Azure Portal under the Metrics section specifically, processed_prompt_tokens and generated_completion_tokens. These portal metrics represent the actual number of input and output tokens that are billed, excluding any tokens that were cached or otherwise not processed by the model. Therefore, while the Realtime API gives granular usage insights, only the metrics shown in the Azure portal are used to calculate costs. To estimate billing accurately, you should refer to these Azure metrics and apply the corresponding pricing from the official Azure OpenAI pricing page.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.