By NHI Mgmt Group Editorial TeamBased on KonaSense: “What is a token in AI, how it is counted, and why you pay for every one” (May 25, 2026)

TL;DR: LLMs do not process words or characters directly, but tokens, and request and response tokens are billed separately, with output often costing 2 to 6 times more than input, according to KonaSense. That makes tokenizer choice, multilingual prompts and context-window discipline operational cost controls, not implementation details.


At a glance

What this is: This is a practical explanation of how LLM tokenization, context windows and separate input-output pricing affect cost and model behaviour.

Why it matters: It matters because practitioners designing AI-enabled services need to budget for token volume, control prompt growth and understand why multilingual or reasoning-heavy workflows can change spend quickly.


Context

A token is the unit an LLM actually processes, and the model never sees raw text as text. It sees a sequence of integers produced by a tokenizer, which means cost, latency and context usage are all governed by how language is split before inference.

This becomes a governance issue as soon as teams move from demos to production. Different models use different tokenizers, so the same prompt can consume different budgets and different amounts of context across systems, including API key management and other AI service integrations.


Key questions

Q: How should teams control LLM costs when token counts vary by language?

A: Start by measuring representative prompts in the target model’s tokenizer, not by relying on rough word-to-token estimates. Multilingual text, code and symbol-heavy inputs can expand token usage sharply, so pricing and capacity plans should be based on observed counts. Then standardise prompt patterns, summarise long histories and use caching where the same content repeats.

Q: Why do output tokens usually cost more than input tokens?

A: Generating text is more expensive than reading it because the model must produce each new token sequentially while conditioning on everything that came before. Providers therefore price output higher than input, and reasoning modes can increase the bill further. Practitioners should assume response length is a real cost driver, not a minor detail.

Q: What are the signs that a prompt has outgrown the context window?

A: The main signs are truncation, degraded answer quality, higher latency and requests that stop early or fail outright when the payload becomes too large. Large histories, oversized attachments and verbose instructions usually cause the problem. The fix is to reduce state carried forward, summarise older context and retrieve only the material needed for the current task.

Q: Should organisations use longer context windows or tighter summarisation?

A: Longer windows help only when the model truly needs more working memory. Otherwise, tighter summarisation and retrieval usually produce better cost control and more predictable behaviour because they reduce unnecessary tokens. The right choice is usually task-specific: preserve only the context that changes the answer, and discard the rest before inference.


Technical breakdown

How byte pair encoding turns text into tokens

Most frontier LLMs use byte pair encoding or a close variant. The tokenizer begins with characters or bytes, counts adjacent pairs in training data, and repeatedly merges the most frequent pairs into subword units. Common patterns such as “the” or “tion” become single tokens, while rarer words are split into smaller pieces. That is why punctuation, whitespace and language structure all affect token counts. The key operational point is that tokenization is model-specific, so one model may compress a prompt far better than another even when the visible text is identical.

Practical implication: Measure token counts with the target model’s tokenizer before you price, size or optimise a production workload.

Why request and response are billed separately

LLM APIs count both input tokens and output tokens, but they usually price them differently. Input covers the prompt, history, instructions, tools and attached content. Output covers every generated token, including hidden reasoning tokens when a model uses extended thinking. Output costs more because each new token is generated sequentially and conditioned on the entire prior sequence. That means a short answer can still dominate spend if the output rate is high. In practice, the cost model rewards concise prompts, bounded outputs and careful use of reasoning modes.

Practical implication: Set output caps and review usage logs so response generation does not silently become the largest cost driver.

Why context windows are both capacity and governance limits

A context window is the maximum number of tokens a model can process in one request. It defines how much prompt history, documentation and generated output can fit at once, but it also creates control pressure because larger windows raise memory use, latency and sometimes pricing. If the input exceeds the effective limit, the model may reject the request or stop early. For production teams, the context window is not just a technical ceiling. It is a boundary that shapes caching strategy, document chunking and how much historical state a workflow can safely carry. See the AI Agent Memory Security Guide.

Practical implication: Design prompts and retrieval flows to stay well inside the model’s practical context limit rather than treating the maximum as usable capacity.


NHI Mgmt Group analysis

Token economics is now a governance problem, not just a billing line. When teams move from casual prompting to production workflows, token counts influence cost, latency and failure modes in the same way that API quotas do. The article’s central point is that the visible prompt is only part of the bill, because context history, tools and generated output all consume budget. Practitioner implication: treat token measurement as part of operational governance, not post-hoc finance review.

Model choice changes the economics of the same workflow. The same text can compress differently across tokenizers, which means a multilingual or code-heavy service may be materially more expensive on one model than another even before quality is considered. That makes tokenizer behaviour a procurement and architecture input, not a detail hidden under the hood. Practitioner implication: benchmark prompt families against the target model before standardising on a provider.

Output-heavy workloads deserve the same attention as access-heavy systems. The article shows that response tokens are priced more aggressively than input, so concise answers, capped generations and restrained reasoning modes have direct cost value. That matters for agentic AI designs too, because autonomous or semi-autonomous systems can multiply output volume without obvious user visibility. Practitioner implication: instrument response length and reasoning usage as first-class controls in AI operations.

Context-window discipline is the named control concept teams keep underestimating. A large window is not free capacity, it is a governance boundary that determines how much state a model can safely and economically carry. The article shows why prompt inflation, long histories and oversized attachments can distort both price and reliability. Practitioner implication: manage context as a bounded resource and apply retrieval or summarisation before the window becomes the bottleneck.

What this signals

Prompt economics will become an identity-adjacent control surface for AI programmes. As organisations embed LLMs into workflows that touch access decisions, support operations or developer tooling, token discipline starts to affect not only spend but also governance. Teams that already monitor privileged API usage should extend that discipline to prompt size, response limits and model selection.

Context-window pressure is a quiet source of operational drift. Once teams rely on chat history, documents and tool payloads to carry state, they create hidden accumulation that changes both cost and reliability. The practical response is to design AI flows around bounded state, not unlimited memory.


For practitioners

  • Measure token counts with the target tokenizer Benchmark representative prompts in the exact model and encoding you plan to use, then compare English and non-English workloads separately so budgeting reflects real consumption.
  • Cap output tokens by default Set max generation limits for common use cases and require explicit exceptions for longer responses, code generation or reasoning-heavy flows.
  • Treat context history as billable payload Review system prompts, chat memory, tool definitions and attached documents as part of the request payload, then trim or summarise anything that does not change the answer. See the AI Agent Memory Security Guide.
  • Use prompt caching for repeated content Cache stable instructions and repeated documents where the provider supports it so reused context does not need to be paid for on every call.
  • Monitor reasoning-token usage Track hidden reasoning consumption alongside visible output so autonomous or deep-reasoning workflows do not create unexpected spend spikes.

Key takeaways

  • LLM tokenisation turns visible text into model-readable units, and that conversion changes cost, latency and context usage in ways many teams underestimate.
  • Input and output are priced separately, so response length, reasoning modes and repeated context can dominate spend even when the prompt seems modest.
  • Production teams should measure prompts against the target tokenizer, cap generation by default and design around the true limits of the context window.

Related NHI Mgmt Group resources: API Key Management Guide · AI Agent Memory Security Guide · Ultimate Guide to NHIs: Static vs Dynamic Secrets


Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST AI RMF and NIST AI 600-1 set the technical controls, while ISO/IEC 42001:2023 defines the regulatory obligations.

FrameworkControl / ReferenceRelevance
NIST AI RMFMAP — MapToken cost, context limits and model behaviour are mapping concerns for AI systems.
MANAGE — ManageResponse limits and prompt discipline are operational controls for AI spend and reliability.
Recommendation — Map token usage, context limits and workload characteristics before deploying LLMs into production. Manage prompt growth, output caps and model selection as part of ongoing AI risk controls.
NIST AI 600-1Model usage and operational considerationsThe article is about practical model usage, pricing and context boundaries.
Recommendation — Apply usage controls that keep prompts, outputs and hidden reasoning within expected operational bounds.
ISO/IEC 42001:2023AI management systemToken governance affects AI operating procedures and resource control.
Recommendation — Include token cost and context management in the organisation’s AI management system procedures.

Key terms

  • Setup Token: A setup token is a temporary credential or session artifact used during initial application configuration. If it remains valid after deployment, it can become a security weakness because attackers may reuse it to reach internal setup functions that were never meant to stay exposed.
  • Tokenizer: A tokenizer is the component that breaks human-readable text into machine-readable tokens for an LLM. It determines how text is represented before the model assigns meaning, so its behaviour directly affects prompt interpretation, classifier verdicts, and the success or failure of input-based attacks.
  • Context Window: The context window is the text a model receives at one time, including prompts, retrieved documents, and conversation history. Security teams care about it because it becomes the practical boundary between trusted instructions and untrusted content, especially when the application assembles that text automatically.
  • Prompt Caching: Prompt caching stores reusable parts of an AI prompt so they do not need to be resent or recomputed each time. In agentic AI and MCP-based workflows, this can reduce latency and cost, but it also creates governance risk if cached context contains sensitive data, stale instructions, or unauthorized access paths.

Deepen your knowledge

Build practical skills in NHI governance, workload identity and secrets management with the NHI Foundation Level course, the industry's only accredited NHI security programme. It is designed for practitioners who need to connect identity controls to AI and cloud operations.
NHIMG Editorial Note
Published by the NHIMG editorial team on October 22, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org