A Token is the basic measurement unit used by large models to process text and is also the billing basis for many large model APIs. This article explains the difference between Tokens and character counts, how input and output Tokens are billed, the role of Cache Tokens, and uses concrete examples to show how to calculate and optimize large model API call costs.

Definition
A Token is the basic unit used by large language models when processing text.
When using large model APIs such as DeepSeek, Tongyi Qianwen, and Doubao, developers often see pricing descriptions like this:
Input: charged per million Tokens
Output: charged per million Tokens
Cached input: charged at a different tier price
Why do input and output prices differ for the same API call? How much text is equivalent to 1 million Tokens? How much cost can be saved after enabling caching?
To understand large model API costs, you first need to understand how Tokens work.
1. What Is a Token? Why Do Large Models Not Bill Directly by Character Count?
A Token is the basic unit used by large language models when processing text. Models do not simply treat every Chinese character or English word as an independent unit; instead, they use a tokenizer (Tokenizer) to convert text into a sequence of Tokens before computation.
A Token may correspond to a Chinese character, a complete English word, part of a word, or punctuation.
For example, common English words may be encoded as one Token, while longer or less common words may be split into multiple Tokens.
There is no fixed conversion between Tokens and character counts.
For common English text, you can roughly refer to:
Text volume | Estimated number of Tokens |
About 75 English words | 100 Tokens |
About 750 English words | 1,000 Tokens |
About 7,500 English words | 10,000 Tokens |
The above are only rule-of-thumb estimates for English text. The number of Tokens for Chinese text, code, numbers, and special symbols may differ significantly.
In particular, different models may use different tokenizers, so the same text may produce different numbers of Tokens in different models.
Therefore, when estimating large model API costs, do not simply use “Chinese character count × fixed ratio” instead of actual Token counts.
2. Why Do Large Model APIs Distinguish Between Input Tokens and Output Tokens?
A request to a large model API usually includes two main processes: the model reads the input content and generates a response.
These two processes correspond to different Token consumption.
1. Input Tokens
Input Tokens refer to the input content sent to and processed by the model.
For example:
The user asks: “Please summarize the following product description.”
Then attaches a product document containing 5,000 characters.
The model needs to process not only the user's question, but also the document body, system prompts, and other content in the request that participates in context computation.
Together, these form the main sources of Input Tokens.
In multi-turn conversations, if the application resends previous chat history every time, historical messages may continuously increase Input Token consumption.
2. Output Tokens
Output Tokens refer to the Tokens used by the model during response generation.
For example, if a user asks the model to generate a detailed market analysis report, the output may reach thousands of Tokens.
Generally, the longer the output, the more Tokens are consumed.
For some reasoning models, you also need to consider internal reasoning Tokens. They may not appear in the final response, but may be counted as output usage.
3. Why Do Input and Output Have Different Prices?
Input processing and step-by-step output generation involve different computation processes, so model providers usually set separate prices for input and output.
For many models, the unit price of output tokens is higher than that of input tokens, but this is not a fixed rule that applies to all models.
Actual API call costs should be calculated separately for input and output, rather than multiplying all token counts by the same price.
III. What Are Cached Tokens? Why May Cached Prices Be Lower?
Cached tokens usually refer to parts of previously processed input content that a model can reuse, thereby reducing repeated computation.
Taking an enterprise intelligent customer service system as an example:
Each request may contain the same system prompt, customer service rules, product background, and response guidelines.
If this content remains consistent across consecutive requests and the model service supports the corresponding caching mechanism, some input computation results may be reused.
This type of reused input is usually called Cached Input Tokens, i.e., input tokens that hit the cache.
What scenarios are suitable for caching?
Application scenario | Repeated input content | Caching value |
AI intelligent customer service | System prompts, service rules | Reduces repeated input processing costs |
RAG knowledge base | Fixed instructions, some shared context | Depends on cache hit conditions |
AI Agent | Tool definitions, role instructions | Favors reuse across repeated requests |
Batch document analysis | Identical analysis specifications | Reduces repeated prompt processing |
Code assistant | Fixed development standards | May reduce long prompt costs |
However, caching does not mean that all repeated text automatically receives a discount.
Different providers may set a minimum cache length, cache expiration period, cache write fees, and hit rules.
Some services also charge separately for cache writes.
Therefore, to determine whether caching is cost-effective, you need to consider the cache hit rate, write cost, and read price at the same time.
IV. How Are Token Costs Calculated for Large Model APIs?
Large model API prices are usually displayed per million tokens (1M Tokens).
Where:
1M Tokens = 1,000,000 Tokens
Assume a model has the following billing rules:
Token type | Assumed unit price |
Regular input | ¥2 / 1M Tokens |
Cached input | ¥0.5 / 1M Tokens |
Output | ¥8 / 1M Tokens |
The above prices are only for demonstrating the calculation method and do not represent a quote for any actual model or AGTCloud.
Case 1: How much does one API request cost?
Assume one request consumes:
Regular input: 3,000 Tokens
Output: 1,000 Tokens
Cached input: 0 Tokens
Calculation method:
Regular input cost:
3,000 ÷ 1,000,000 × 2 = ¥0.006
Output cost:
1,000 ÷ 1,000,000 × 8 = ¥0.008
Finally:
Total cost per request = ¥0.014
In other words, under this set of assumed prices and usage, one request costs about 1.4 fen.
Case 2: How much does it cost to call the API 100,000 times per day?
Assume the token consumption per request is the same as in the previous example, with 100,000 calls per day.
Daily cost:
100,000 × ¥0.014 = ¥1,400
Calculated over 30 days:
The monthly cost is approximately ¥42,000.
This shows that even if the cost of a single API call is low, accumulated costs may become a significant operational expense in high-frequency business.
Case 3: How much can caching save?
Assume each request includes:
Regular input: 1,000 Tokens
Cache-hit input: 2,000 Tokens
Output: 1,000 Tokens
According to the assumed prices above:
Regular input cost: ¥0.002
Cached input cost: ¥0.001
Output cost: ¥0.008
Total cost per request:
¥0.011
Compared with ¥0.014 when all input is calculated at the regular input price, this saves about 21.4% per request.
Note that this result only calculates requests after a cache hit and does not include possible cache write fees, so it cannot be directly treated as the final savings rate for actual business.
V. Why Do Different Models Have Very Different Costs for the Same 1 Million Tokens?
When choosing large model APIs, developers often directly compare the unit price per million tokens.
However, a lower model price does not necessarily mean a lower cost to complete the same task.
The main reasons include the following aspects.
1. Different models use different tokenizers
The same text may be split into different numbers of tokens by different models.
Therefore, even if the input content is identical, the final billable quantity may differ.
2. Output lengths may differ
For example, when asked to generate the same product analysis report:
Model A outputs 1,500 Tokens.
Model B outputs 3,000 Tokens.
Even if Model B has a lower output unit price, the actual total cost may not be lower.
3. Reasoning models may generate additional consumption
Some reasoning models perform internal reasoning before generating the final answer.
These tokens may be counted as output usage, so costs cannot be estimated solely from the length of the final displayed text.
4. Caching strategies affect actual costs
For applications with a high proportion of repeated input, the cache hit rate can significantly affect the final cost.
Therefore, when selecting models, it is recommended to record the input tokens, output tokens, cache hit volume, and task completion quality of real business requests.
6. How to Reduce Token Consumption in Large Model APIs?
Reducing token costs is not just about shortening prompts; more importantly, it is about reducing unnecessary computation.
1. Streamline Repetitive Prompts
System prompts should be clear and complete, but there is no need to repeatedly explain the same rules.
For longer fixed prompts, you can evaluate whether caching is suitable.
2. Control the Length of Conversation History
Multi-turn chat applications tend to continuously accumulate context.
Depending on business needs, you can use historical message summaries, window truncation, or hierarchical memory to reduce unnecessary repeated input.
However, compressing context may cause information loss, so answer quality should be verified.
3. Optimize RAG Retrieval Content
RAG systems should not send all retrieved documents directly to the model.
Retrieval ranking, chunk deduplication, and relevance filtering can reduce low-value context.
4. Choose Models Based on Tasks
Simple classification, information extraction, and complex reasoning tasks have different requirements for model capabilities.
You can choose a suitable model based on task difficulty instead of using the same high-cost model for all requests.
5. Control Unnecessary Output
If the business only needs JSON fields, classification labels, or a brief summary, there is no need to ask the model to generate long explanations.
Specifying the output format and length can reduce unnecessary output consumption.
6. Establish Token Usage Monitoring
Development teams are advised to continuously record:
Daily API request volume
Average input and output tokens
Cache hit volume and hit rate
Average cost per task
Task completion rates for different models
Additional costs caused by failed retries
Using this data, you can determine whether cost growth comes from call volume, input length, model switching, or abnormal retries.
7. How to Choose the Right Large Model API on AGTCloud?
For development teams that need to integrate multiple large models, model selection should not focus only on unit price.
It is recommended to first clarify the business scenario, then compare models in terms of model capability, input/output costs, caching mechanisms, response speed, and interface compatibility.
Through the AGTCloud model library, you can learn about the model services currently offered by the platform and related information.
Before formal integration, it is recommended to estimate costs based on actual model pricing and business test data, and make a selection by considering request success rate, output quality, and stability.
View model services: https://agtcloud.cn/models
Summary
Tokens are the basis for understanding large model API costs.
In actual use, developers need to distinguish regular input, cached input, and output tokens, and calculate costs separately according to the prices of different categories.
For enterprises, what truly matters is not a model's listed price per million tokens, butthe cost required to complete one effective business task.
Only by combining token consumption, model output quality, response speed, and business completion rate can a more reasonable large model API cost evaluation system be established.
Frequently asked questions
There is no fixed answer. The number of Tokens depends on the model's tokenizer and the specific text content, so a Chinese character cannot simply be assumed to equal one Token.
Zhou Jingxing
AI Industry Research
AGTCloud AI industry observation columnist, focusing on the global large model ecosystem, MaaS platform development, model commercialization, and enterprise AI infrastructure. Provides structured analysis and market observation around the model service market, API pricing, platform selection, and industry application trends.