Dev.to AI 🤖 Ai 👁 0 📖 10 min read

Token prices lie: why cheap reasoning models bankrupt you

The API bill arrives. The final amount completely misses the forecast. A developer moved autonomous agents to a new budget model, expected a massive drop in expenses, and paid twice as much as before. Database logs show

Token prices lie: why cheap reasoning models bankrupt you

The API bill arrives. The final amount completely misses the forecast. A developer moved autonomous agents to a new budget model, expected a massive drop in expenses, and paid twice as much as before. Database logs show short answers of a couple of paragraphs. The provider's billing charges for hundreds of thousands of tokens.

The low price per million tokens is completely wiped out by architectural bugs. Small reasoning models often get stuck in loops. They hit the maximum limit with hidden thoughts and burn the budget for nothing.

Hidden thoughts are sold at output rates

Providers highlight the cost of input tokens in large print when they announce new models. A developer sees the low price and decides to migrate. The mistake happens because of pricing rules. Reasoning tokens are always billed at the output rate.

A short visible response hides huge costs for internal thinking. Output tokens cost several times more than input tokens. Generating each new word requires sequential calculations, while input text is processed in parallel. Providers bake the cost of these calculations into the output token price.

Model Input tokens (per 1M) Output tokens (per 1M)
OpenAI o1 $15.00 $60.00
OpenAI o3-mini $1.10 $4.40
Claude 3.7 Sonnet $3.00 $15.00
DeepSeek R1 $0.55 $2.19

The official price of DeepSeek R1 looks low. They ask just over half a dollar for one million input tokens. The model generates a massive volume of internal text when solving a complex task. Billing charges the amount from the output tokens column for every generated character of reasoning.

Users discuss the architecture of such neural networks in Hacker News threads. Reasoning models rely on reinforcement learning and verifiable rewards. The neural network tries to find the right solution path through multiple attempts. Each attempt generates new tokens. The provider passes the cost of these attempts to the client. The developer pays for the drafts the neural network writes and erases during its work.

Hidden context increases request price by 80 times

Let us calculate the real cost of a single request using specific numbers. Suppose an agent analyzes a server log and returns a short structured response. The visible final text takes exactly 50 tokens. The model dives into thinking and generates 4000 hidden tokens before delivering the answer. Four thousand tokens equal several pages of dense text.

Take the pricing of the o3 model in the mini version. The output token price is 4.40 dollars per million.
We add 4000 reasoning tokens and 50 response tokens. We get 4050 output tokens.
We multiply 4050 by 4.40. We get 17820.
We divide the result by one million. The final request price is 0.01782 dollars.

Now we calculate the cost of the exact same response without hidden reasoning.
We multiply 50 tokens by 4.40. We get 220.
We divide by one million. The price drops to 0.00022 dollars.

The presence of hidden context increased the cost of a basic task by exactly 80 times. The developer planned to pay fractions of a cent and pays almost two cents for each call. Such overpayments quickly eat up the project's monthly budget during mass data processing. A detailed API bill breakdown confirms these calculations.

We can compare this approach with using a regular model. A developer takes GPT-4o-mini and writes a detailed system prompt. They ask the model to reason step by step and output the logic directly into the response.

import openai

client = openai.OpenAI(
    base_url="https://api.altrouter.ai/v1",
    api_key="ar-YOUR_API_KEY"
)

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": "Analyze the log. Reason step by step. Output the logic in <thought> tags, then give the answer."},
        {"role": "user", "content": "Error 500 at /login"}
    ],
    max_tokens=500
)
print(response.choices[0].message.content)

The length of such a response rarely exceeds 500 tokens. The output token price for GPT-4o-mini is 0.60 dollars per million. We multiply 500 by 0.60 and divide by a million. The request will cost 0.0003 dollars. The cost difference reaches tens of times in favor of the classic model without hidden thoughts.

Infinite loops burn limits without answers

The high price for long thoughts makes sense for solving complex mathematical problems. The real issue arises during failures. Small reasoning models suffer from a specific bug. The model starts solving a task, loses the logical thread and falls into an infinite loop. It repeats the exact same phrase until the token limit is completely exhausted.

A robot vacuum cleaner has rubbed a deep circular rut into a glossy dark floor

The neural network's internal monologue turns into endless repetition of the same checks. The model opens a thinking tag. It writes a hypothesis, rejects it, rewrites it and rejects it again. The text fills with phrases like "need to check again", "let's try another approach", "this doesn't work, let's check again". The process stops only when it hits the maximum token parameter.

Researchers from AIRI tested this behavior on real data. They ran 6000 prompts through the open Qwen3.5-0.8B model. The measurement results showed the frequency of the problem. The model gets stuck in a loop in 25% of all responses. Generation completely hits the hard token limit in 33% of cases. The budget burns entirely. The application receives no useful result. Requests hang in processing until a system timeout triggers.

The AIRI team managed to fix this flaw. They collected a dataset with examples of correct reasoning and examples of loops. Then they trained a special Qwen3.5-Unloop version using the DPO method. The algorithm penalized the neural network for repetitions. They managed to reduce the share of garbage failures on the 4B version from 23.8% to 1.6%.

Training a custom model requires massive computing power. Hacker News readers discuss courses on building reasoning models from scratch. They agree that a home enthusiast lacks the GPUs for proper training. Theoretical courses provide an understanding of the architecture, while practical application requires industrial clusters. Developers have to use ready-made APIs and tolerate the bugs of base versions. Users note that building a model from scratch is like assembling a CPU with a soldering iron: interesting, but inapplicable in real business.

Large-scale independent benchmarks with failure rates for other models do not exist yet. Developers do not know the exact share of garbage loops for DeepSeek R1 or distilled Llama models in a real production environment. You have to bake the risk of looping into the application architecture by default.

Agent scenarios multiply the cost of a mistake

The cost of looping multiplies by the number of model calls in agent scenarios. Such generation becomes the most expensive possible. The budget burns entirely due to automatic retries.

Agents work in cycles. The program sends a request and receives a response. Then it parses the data and makes the next decision. The agent receives the response and tries to extract JSON from it. The parser breaks if the model loops. An endless text with reasoning arrives instead of JSON. The agent catches an exception and sends the request again. The loop-prone model goes into endless reasoning again. The cycle repeats five times before a hard abort. The program burns the budget of five full token limits in one second.

Let us calculate the losses from one failed cycle. The agent sends a request to the o3-mini model. The model goes into endless reasoning and hits the 100,000 output token limit. We multiply 100,000 by 4.40 dollars and divide by a million. One failed call costs 0.44 dollars. The parser breaks, and the agent repeats the request five times. We multiply 0.44 by 5. The program burns 2.20 dollars in a few seconds of work. A thousand such errors will cost 2200 dollars.

Hidden tokens inflate costs in large-scale benchmarks to tens of thousands of dollars. The OpenAI o3 model spent a massive budget in one ARC-AGI test. The amount exceeded 66,000 dollars for 111 million tokens. More than 60% went exclusively to hidden reasoning tokens. The test required multiple attempts to solve complex logical problems. Each attempt generated new branches of thought.

The developer pays for thousands of garbage cycles instead of the expected savings. Using a cheap reasoning model mathematically costs more than calling an expensive flagship model without built-in reasoning. An agent will multiply the cost of a mistake, and the allocated funds will run out in a couple of hours of work.

Looping hurts execution speed. Generating thirty thousand tokens takes several minutes. The user waits for an answer while the agent hangs waiting. Then the connection drops due to a timeout. The developer pays for the computation. The client gets a server error.

Streaming hides billing

Tracking wasted money is technically difficult due to network behavior. Most modern applications use streaming for fast text output. The server sends the response in small chunks via Server-Sent Events.

A thick package is tightly stuck in the narrow slot of a minimalist mailbox

The breakdown of hidden tokens appears in the final event message_delta during streaming. Parsers interrupt the stream prematurely and fail to record these costs.

The final chunk contains a statistics block. It looks something like this:

{
  "id": "chatcmpl-123",
  "object": "chat.completion.chunk",
  "choices": [],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 50,
    "completion_tokens_details": {
      "reasoning_tokens": 4000
    },
    "total_tokens": 4065
  }
}

Local logs remain empty if the network drops before receiving this packet. Serverless functions make the problem worse. If a function has a ten-second execution time limit, it will forcefully terminate before the model finishes its long reasoning. The neural network provider will have time to generate and bill thousands of tokens. The developer's server will simply shut down and save no cost data.

The developer looks at their database and sees zero spent tokens. The provider's server successfully finished generation and recorded 30,000 reasoning tokens in billing. The internal API usage statistics radically diverge from the real bill at the end of the month.

Local monitoring tools become useless. They rely on data from interrupted connections and underestimate real expenses. The developer continues to scale the system with false confidence in its low cost.

Hard limits save you from overpaying

Vendors offer different approaches to controlling reasoning. The Claude 3.7 Sonnet model works as a hybrid. A developer can enable extended thinking mode and set a hard budget. The limit is configurable in a range from 1024 to 128,000 tokens.

We can calculate the minimum request cost with thinking mode enabled. The output token for Claude 3.7 Sonnet costs 15 dollars per million. We multiply the minimum threshold of 1024 tokens by 15 and divide by a million. We get 0.01536 dollars. Each request will cost at least a cent and a half just for the thinking process. The final answer might consist of a single word, and the price will remain the same.

The minimum threshold makes the hybrid mode unprofitable for simple tasks. The model will reserve and spend a thousand tokens on thinking if an agent needs to extract a date from text. The provider set this threshold on purpose. A neural network needs space for full context analysis, and short reasoning yields no quality improvement.

Claude 3.7 Sonnet and DeepSeek R1 models fully expose reasoning tokens to the user. You can read the logs and understand the cause of a failure. The visible thinking process allows you to quickly catch loops during the testing phase. A developer sees repeating phrases and interrupts the script execution.

Closed models hide failures

OpenAI systems work differently. The closed o1 and o3-mini models completely hide internal tokens from the developer. You cannot analyze the reasoning text or filter out garbage loops on the fly. The user gets only the final answer and a bill for tens of thousands of tokens.

Neither vendor documentation nor aggregators describe a refund process for generations. Failures hit the limit due to the looping bug, and money is deducted permanently. You have de facto already paid for these tokens. The provider spent computing power generating text, even if that text consisted of a single repeating phrase.

The closed reasoning process strips the engineer of debugging tools. You cannot look at the problematic step. The model goes into an infinite loop, and the developer cannot see the cause. You cannot adjust the system prompt to bypass the bottleneck. You have to act blind and hope for the provider's internal filters.

The developer receives a massive bill and cannot prove a technical failure on the neural network's side. Technical support sees the spent tokens but does not see their content. You will have to pay for the burned tokens in full.

Choose a strict prompt over built-in reasoning

A cheap model will easily drain a project's balance. Using a regular model with a smart Chain-of-Thought prompt is mathematically better for stable streaming and agent tasks. The developer writes out the logic steps in text and strictly controls the response length. This saves you from unpredictable loops.

Enabling built-in reasoning makes sense when you have strict control mechanisms. You should check the provider documentation first. The risk of overpaying drops significantly if the API lets you set a strict limit on thinking. The developer sets an upper token boundary and protects the budget from infinite loops.

Then you need to check the network parser code. It must correctly wait for the final chunks with billing and write them to the database. Local analytics must match the billing data.

You should look for versions with loop protection when working with open weights. Models trained to reject loops save server compute resources.

A low token price will turn into regular payments for endless repetitions of a single word without these measures.

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.