LLM API Pay-as-You-Go Pricing Explained: How Token Costs Are Calculated
This article explains how pay-as-you-go billing works for large language model APIs. It covers how tokens are defined and counted, how input and output are billed, typical cost ranges for common usage patterns, practical ways to reduce spending, and a simple formula for estimating monthly costs.
1. Why Pay-as-You-Go Has Become the Mainstream Billing Model
Among the many ways to access large language model capabilities, pay-as-you-go billing has become the most common pricing model in the industry. Its core logic is simple: you pay for the tokens you use, and you pay nothing if you use none.
This model contrasts sharply with traditional monthly subscriptions:
- Subscription: A fixed fee grants a set quota or unlimited usage. It suits users whose usage is steady and predictable.
- Pay-as-you-go: Charges match actual consumption. It suits developers whose usage fluctuates, who use the service occasionally, or who are still validating a technical approach.
For developers, the main advantage of pay-as-you-go is low-risk experimentation. During integration, you can spend a small amount to check whether a model meets your business needs, then decide whether to scale up. This “try before you commit” approach lowers the cost of technology selection decisions.
2. What a Token Actually Is
To understand pay-as-you-go billing, you first need to understand the token, the unit of measurement. A token is the smallest unit an AI model uses to process text. It is not the same as a Chinese character, and it is not always the same as a word:
- For Chinese text, one character usually corresponds to one or more tokens, depending on the tokenizer implemented by the model.
- For English text, a common short word usually corresponds to one token, while longer words may be split into several tokens.
- A short Chinese text of about 500 characters may consume roughly 700 to 1,000 tokens.
An important detail is that billing usually covers both input and output. The prompt you send to the model consumes input tokens, and the response the model generates consumes output tokens. These are usually priced separately, and output tokens typically cost more per unit. In addition, if your application uses multi-turn conversations and carries over the conversation history, each request counts the previous messages as input tokens again. Many developers overlook this, and it is a common source of unexpected cost growth.
3. Cost Estimates for Typical Scenarios
The table below gives a simplified estimate of cost magnitudes at different usage levels. Check the official pricing page of your cloud platform for actual unit prices. The figures below are for orientation only.
| Usage Scenario | Approximate Token Usage | Approximate Cost (RMB) |
|---|---|---|
| Asking a simple question (e.g., “What’s the weather like today?”) | About 50–100 tokens | Almost zero |
| Writing a short article of about 500 Chinese characters | About 1,000–2,000 tokens | Under 0.1 |
| Analyzing a long article of about 5,000 Chinese characters | About 8,000–12,000 tokens | Under 1 |
| Heavy daily use (writing, analysis, and conversation) | About 50,000–100,000 tokens | 1–3 |
The table leads to three conclusions:
- Light personal use costs very little. Everyday Q&A and occasional writing assistance may cost less per month than a cup of coffee.
- Cost scales roughly linearly with usage. Doubling token consumption roughly doubles the bill, so controlling usage has a direct effect on cost.
- Cost matters most at scale. When an application makes tens of thousands of calls per day, even a few cents per call adds up to a substantial bill.
4. Practical Tips for Controlling Costs
Teams preparing to bring large model capabilities into production should consider the following practices:
1. Trim prompts and remove unnecessary context. Every word in a prompt consumes input tokens. Review system prompts regularly and remove duplicate instructions and unhelpful examples. This often reduces input costs by 10% to 30%.
2. Limit how much conversation history you carry. Do not send the entire history with every turn. Summarize older messages, or keep only the most recent N turns.
3. Set an upper limit on output length. Most model APIs support a parameter that caps the number of tokens generated. Setting this limit controls cost and prevents overly verbose responses.
4. Set up usage monitoring and alerts. Reputable cloud platforms typically offer call statistics, token usage reports, and cost alerts. Configure usage alert thresholds before launch, and respond promptly to abnormal call volumes. These can indicate runaway loops or malicious traffic.
5. Cache results and reuse them. For highly repetitive requests, such as generating text from a fixed template, cache results at the application layer. Identical inputs can return cached results, which avoids repeated charges.
6. Choose model tiers based on the task. Many cloud providers offer models at different capability levels. Use lightweight models for simple tasks and reserve flagship models for complex reasoning. This tiered approach can significantly improve overall cost efficiency.
5. A Simple Usage Estimation Example
Before integration, you can estimate monthly costs with the following pseudocode:
# Illustrative estimation logicdaily_calls = 1000 # Average daily call volumeavg_input_tokens = 800 # Average input tokens per callavg_output_tokens = 300 # Average output tokens per callmonthly_tokens = daily_calls * (avg_input_tokens + avg_output_tokens) * 30# Assume a blended unit price of p (RMB per 1,000 tokens), then:monthly_cost = monthly_tokens / 1000 * p
Use this formula with the unit prices published by your cloud platform to get a budget estimate of the right order of magnitude before launch. Multiply the result by a safety factor of 1.2 to 1.5 to set aside a buffer.
6. Summary
Pay-as-you-go billing ties the cost of AI capabilities directly to actual consumption. It lets individual developers experiment at low cost, and it lets enterprises control budgets precisely. Three foundations support stable, controllable use of large model capabilities: understanding how tokens are counted, tracking input and output consumption in both directions, and setting up usage monitoring. Once you understand the cost model, concern about costs rising with usage turns into a simpler question: how much you use determines how much you pay.
