BroadRouter

max_tokens calculator for reasoning models

Updated

In short: Reasoning models write hidden reasoning before the answer, and both count toward max_tokens, so set max_tokens = (answer tokens + reasoning tokens) × (1 + safety margin). BroadNet's docs say to allow 1,000 tokens or more on DeepSeek V4.1 Flash, GLM 5.3 and Qwen3.8 27B, or set reasoning_effort to low. A smaller limit can return an empty reply.

Free, no sign-up, runs in your browser: nothing you type is sent anywhere.

Answer, reasoning and margin

Suggested max_tokens—
Answer, tokens—
Answer + reasoning—

Python (OpenAI SDK)

Cost on BroadNet reasoning models

ModelFits contextTypical per requestWorst case (all of max_tokens)Typical per month

Get started

The reasoning budget is your input, not a measurement: reasoning length varies by model, prompt and effort. Prices are BroadNet's pay-as-you-go rates, synced 2026-11-14, before tax; "typical" assumes the model uses your answer + reasoning estimate, with no cache hits.

Report a wrong price or number (email to info@broadnet.ai, with this page's link and your inputs filled in).

How it works

  1. Enter the expected length of the visible answer in tokens, or in English or Arabic words.
  2. Enter the reasoning budget. BroadNet's docs say to leave 1,000 tokens or more; replace it with the high end of reasoning_tokens you see in your own responses.
  3. Choose a safety margin and whether you will send reasoning_effort low. Add your prompt size and monthly requests for the context check and cost.
  4. Copy the suggested max_tokens and the code. Read the cost per request, worst case and per month on each reasoning model.

Why reasoning empties the reply

A reasoning model writes its reasoning first and the visible answer second, and both come out of one max_tokens budget. With max_tokens: 200, a model that reasons for 600 tokens stops before the answer starts: the request succeeds, choices[0].message.content is empty and finish_reason is length. The full walk-through is in why a reasoning model returns an empty answer.

The formula

answer tokens   = answer words × tokens per word   (or tokens directly)
max_tokens      = round_up_100( (answer + reasoning) × (1 + margin) )
                  and at least answer + 1,000 on reasoning models
context check   = prompt tokens + max_tokens ≤ context window
typical cost    = prompt × input_price + (answer + reasoning) × output_price
worst case      = prompt × input_price + max_tokens × output_price

Worked example

A 300-token answer with a 1,000-token reasoning budget and a 20% margin gives max_tokens = 1,600. On GLM 5.3 with a 2,000-token prompt, a typical request costs about $0.00606 and the worst case, if the model uses the whole limit, $0.0071.

Reasoning models on BroadNet Inference

ModelIDOutput per 1MContext
DeepSeek V4.1 Flashbroadnet/deepseek-v4.1-flash$0.521,048,576
GLM 5.3broadnet/glm-5.3$3.461,048,576
Qwen3.8 27Bbroadnet/qwen3.8-27b$2.17262,144

BroadNet's docs list reasoning for these three models, not for BroadNet Gemma 4 VL 26B. Read usage.completion_tokens_details.reasoning_tokens when the model reports it; in a stream, send stream_options: {"include_usage": true} to get usage in the last chunk.

Questions

Why does a reasoning model return an empty reply?

It spent the whole max_tokens budget on reasoning before the visible answer began. BroadNet's docs say DeepSeek V4.1 Flash, GLM 5.3, Qwen3.8 27B reason before they answer and the reasoning counts toward max_tokens. The response then has empty content and finish_reason "length". Fixes and code.

What max_tokens should I set for a reasoning model?

Enough for the reasoning plus the answer, with a margin: (answer + reasoning) × (1 + margin). BroadNet's docs say to leave 1,000 tokens or more for reasoning. Measure your own reasoning tokens from usage.completion_tokens_details.reasoning_tokens and size for the long tail, not the average.

Does a higher max_tokens cost more?

No, not by itself. You pay for tokens the model actually generates, not for the limit. A higher limit only lets a long reasoning run finish, so the worst-case cost per request rises while the typical cost stays the same.

Are reasoning tokens billed?

Yes, on pay-as-you-go they are part of the completion tokens and billed at the output price. On the Full Moon, Orbit, Meteor plans for DeepSeek V4.1 Flash there is no token meter, so they add time, not charges.

What does reasoning_effort do?

It asks the model to reason less (low) before answering. BroadNet's docs suggest low as the alternative to a larger max_tokens for simple tasks. How many tokens it saves depends on the model and the prompt, so measure it on your own requests.

Does BroadNet Gemma 4 VL 26B reason?

BroadNet's docs list reasoning for DeepSeek V4.1 Flash, GLM 5.3, Qwen3.8 27B only, so BroadNet Gemma 4 VL 26B is not priced here; for it, max_tokens only needs to cover the answer.

Go deeper

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity