What Is a Token? The Unit Behind Every AI Bill
By Darus S Alfatah · 2025-09-23 · Edukasi · 7 menit
Author note: Our quick rule: one token is about four English characters, three to four for Indonesian.
Focus of this article
This article explains what a token is and how to count it. For its impact on per-project cost, see the companion article.
Read also: Prompt Tokens vs Completion Tokens: Why the Split Matters · How to Calculate AI Cost per Project (A Real Case Study)
Tokens Are Fragments
Models do not read words; they read tokens, which are pieces of words. A short common word may be one token, while a long or inflected word may split into two or three. Punctuation and spaces are usually attached to the neighbouring token.
Because billing counts tokens rather than words, two sentences of the same length can cost different amounts depending on vocabulary.
Why Indonesian Costs More
Indonesian uses prefixes, suffixes, and compound forms. A word like “memperbaikinya” may become several tokens, while an English equivalent might be two. Tokenizers are also optimised mostly for English text, which makes non-English content relatively more expensive.
Practical implication: estimate with a 1.5 to 2 tokens per word ratio for Indonesian, then measure real usage to correct the estimate.
Tokens and Context
The context window counts input plus output. If you send a hundred thousand tokens to a model with a 128 thousand limit, only twenty-eight thousand remain for the answer. Exceeding the limit either fails or truncates.
Long context is convenient but not free, and accuracy can degrade when irrelevant material fills the window.
Estimating Before Building
Measure fifty real examples with the tokenizer for your chosen model. Multiply by expected request volume. Add output tokens based on the length of answers you actually want, not on the maximum the model can produce.
Then add margin for retries, experiments, and future prompt growth.
Reducing Tokens
Remove filler, use bullet points, retrieve only relevant sections, and cap output length. These four changes usually cut usage by half without reducing quality, and they also improve latency.
Frequently Asked Questions
Is one token one word? Roughly for English, less so for Indonesian.
Do spaces count? They are part of tokens, not separate items.
Are tokens counted for the answer too? Yes, output is billed separately and often at a higher rate.
Does a long prompt always cost more? Yes, unless it is cached.
How do I see actual usage? The response includes usage data; log it per feature.
Conclusion
Tokens are the unit of both capacity and cost. Measure with the real tokenizer, budget for Indonesian’s higher ratio, and trim context before blaming the price.
Where Estimates Go Wrong
Most estimates ignore how much context grows over a conversation. Each new turn resends prior history, so the tenth message costs far more than the first. Trim history and summarise older turns to keep growth in check.
Second common error: assuming the maximum output length. Models stop when finished, but a loose limit invites verbose answers, and verbosity is billed.
A Simple Tracking Table
Log date, feature, input tokens, output tokens, and cost. After a week you can see which feature dominates and whether growth matches user growth. Without this table, cost discussions become guesswork.
Budgeting Rule of Thumb
Assume one and a half tokens per Indonesian word, two for technical text, and add thirty percent margin for retries and prompt growth. Then measure after a week and replace the estimate with real numbers.
A quick counting example: A paragraph of about four hundred characters is roughly one hundred tokens. For a rough estimate, divide characters by four.
Frequently Asked Questions
What is the core topic of this article?
This article explains the fundamentals of AI APIs and gateways in plain language for developers, with practical examples.
Do I need a technical background?
No. The material builds up from the basics, so beginners can follow while experienced developers can jump to the relevant section.
How do I get started with an AI API after reading this?
Create a BankAI account, get an API key, then change your Base URL to BankAI’s OpenAI-compatible endpoint.