Why did Azure report more completion tokens than my max_completion_tokens setting

Hamza Bchiri 20 Reputation points
2025-09-02T11:21:14.61+00:00

Hello,

I’m using Azure OpenAI with the o4-mini reasoning model through the Chat Completions API (2025-01-01-preview). In my request I set:

{

"messages": [

{ "role": "user", "content": "example" }

],

"max_completion_tokens": 10000,

"model": "o4-mini"

}

However, when I check the response usage and the Azure portal, I notice that the completion tokens sometimes exceed this limit.

My concern is that:

  • I expected completion_tokens to be capped at the max_completion_tokens value I set.

Instead, billing includes thousands of reasoning tokens that are not visible in the output.

This makes it difficult to estimate and control costs, since hidden reasoning tokens are unpredictable.

Questions:

Why are reasoning tokens not constrained by the max_completion_tokens parameter?

Is there a way to cap or limit the number of reasoning tokens consumed by reasoning models like o4-mini?

What is the recommended practice for cost control and billing transparency when using reasoning models in production?

Thank you!My concern is that:

I expected completion_tokens to be capped at the max_completion_tokens value I set.

Instead, billing includes thousands of reasoning tokens that are not visible in the output.

This makes it difficult to estimate and control costs, since hidden reasoning tokens are unpredictable.

Questions:

Why are reasoning tokens not constrained by the max_completion_tokens parameter?

Is there a way to cap or limit the number of reasoning tokens consumed by reasoning models like o4-mini?

What is the recommended practice for cost control and billing transparency when using reasoning models in production?

Thank you!

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform


Answer accepted by question author
Anshika Varshney 15,535 Reputation points Microsoft External Staff Moderator
2025-09-04T08:56:49.7666667+00:00

Hello Hamza Bchiri,

Thank you for the response.

You’re correct in your understanding, completion_tokens includes both the visible output tokens and the hidden reasoning tokens, while max_completion_tokens only applies to the visible output. The hidden reasoning process isn’t capped, and the only way to influence its cost is through the reasoning_effort parameter, along with prompt design and model selection.

Right now, Azure doesn’t provide a separate breakdown of reasoning vs. output tokens in the usage or billing exports. This means that while you can see the total token usage, you can’t directly distinguish how many were consumed by hidden reasoning.

Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

Thankyou!

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Gowtham CP 8,120 Reputation points Volunteer Moderator
    2025-09-03T06:16:30.7433333+00:00

    Hello Hamza Bchiri,

    Thank you for reaching out on the Microsoft Q&A.

    There are a few important points regarding your observation with max_completion_tokens when using reasoning models such as o4-mini:

    Reasoning tokens are billed as part of completion usage – Reasoning models generate hidden reasoning_tokens during internal reasoning. These tokens do not appear in the response but are included in billing. Reference: Reasoning models in Azure OpenAI

    max_completion_tokens applies only to output tokens – The parameter caps the number of tokens in the visible model output, but reasoning tokens consumed internally are not constrained by this limit. Reference: Chat Completions API parameters

    Control reasoning cost with reasoning_effort – You can use the reasoning_effort setting (low, medium, or high) to influence how much internal reasoning the model performs, which impacts the number of hidden reasoning tokens. Reference: Reasoning models – control reasoning effort

    Monitor usage in Azure Portal – For billing transparency, rely on Azure portal metrics such as processed_prompt_tokens and generated_completion_tokens, and configure alerts through Azure Cost Management. Reference: Manage costs and usage in Azure OpenAI

    I hope this helps clarify the behavior and how you can better manage cost.

    If the information is useful, please accept the answer and upvote it to assist other community members.

    Was this answer helpful?

    1 person found this answer 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.