AGENCYSCRIPT
CoursesEnterpriseBlog
👑FoundersSign inJoin Waitlist
AGENCYSCRIPT

Governed Certification Framework

The operating system for AI-enabled agency building. Certify judgment under constraint. Standards over scale. Governance over shortcuts.

Stay informed

Governance updates, certification insights, and industry standards.

Products

  • Platform
  • Certification
  • Launch Program
  • Vault
  • The Book

Certification

  • Foundation (AS-F)
  • Operator (AS-O)
  • Architect (AS-A)
  • Principal (AS-P)

Resources

  • Blog
  • Verify Credential
  • Enterprise
  • Partners
  • Pricing

Company

  • About
  • Contact
  • Careers
  • Press
© 2026 Agency Script, Inc.·
Privacy PolicyTerms of ServiceCertification AgreementSecurity

Standards over scale. Judgment over volume. Governance over shortcuts.

On This Page

What a Token Actually IsWhere the Rule of Thumb Breaks DownHow to Count Tokens Before You SendWhat a Context Window IsContext Windows Are Growing — But Constraints Still BindTokens, Costs, and Why They're InseparablePractical Context Window StrategiesFit What Matters, Cut What Doesn'tChunking for Long DocumentsChoosing a Model With Context In MindYour First Real ExperimentFrequently Asked QuestionsWhat's the difference between a token and a word?Does a larger context window always mean better results?Why do output tokens cost more than input tokens?What happens when I exceed the context window?Can I use retrieval to work around context limits?How often do context window limits change?Key Takeaways
Home/Blog/Truncated Replies and Spiking Costs Trace Back Here
General

Truncated Replies and Spiking Costs Trace Back Here

A

Agency Script Editorial

Editorial Team

·May 31, 2026·10 min read

If you've tried prompting an AI model and hit an unexpected error, gotten a weirdly truncated response, or watched costs spike in ways you couldn't explain, the cause was almost certainly tokens and context windows. These two concepts sit beneath nearly every practical decision you'll make when working with large language models — model selection, prompt design, cost control, and output quality. Understanding them isn't optional. It's the load-bearing foundation.

This article takes you from zero to a working mental model as fast as honestly possible. You'll learn what tokens actually are, how context windows work under the hood, where real-world constraints bite, and how to make smarter decisions about model choice and prompt architecture as a result. No prior technical background required — just the willingness to think carefully about what's actually happening when you send a message to an AI.

What a Token Actually Is

Most people assume AI models read words. They don't. They read tokens.

A token is a chunk of text — but not necessarily a word. Depending on the tokenizer a model uses, a token might be a full common word ("hello"), a word fragment ("un-" or "-able"), a punctuation mark, or even a space. For most English text, a useful rule of thumb is roughly 1 token per 0.75 words, or about 750 words per 1,000 tokens. That's an average, not a law.

Where the Rule of Thumb Breaks Down

The 750-words-per-1,000-tokens estimate holds reasonably well for plain English prose. It falls apart in several common situations:

  • Code: Dense syntax, variable names, and operators can be more or less token-efficient depending on structure. Python docstrings may tokenize differently than C++ headers.
  • Non-English languages: Languages that aren't well-represented in training data — many Asian, African, and Eastern European languages — often require more tokens per word because their characters or subwords are rarer in the model's vocabulary.
  • Specialized jargon: Medical, legal, or scientific terminology may be split into many fragments, inflating token counts.
  • Whitespace and formatting: Extra line breaks, markdown headers, JSON brackets — they all consume tokens. Formatting is never free.

The practical lesson: when you're estimating costs or context usage, price in a 20–30% buffer over your naive word-count estimate, especially if you're working with structured data, multilingual content, or heavily formatted prompts.

How to Count Tokens Before You Send

Every major model provider offers a tokenizer tool. OpenAI's Tokenizer (at platform.openai.com/tokenizer) lets you paste text and see the exact token count and breakdown. Anthropic provides similar tooling. For programmatic use, the tiktoken library handles GPT-series models, and Hugging Face's tokenizer classes cover most open-weight models. Building token counting into your workflow before prompt engineering becomes a habit will save you money and debugging time.

What a Context Window Is

The context window is the maximum amount of text — measured in tokens — that a model can "see" at once when generating a response. Think of it as the model's working memory for a single interaction. Everything that counts against that limit includes:

  • Your system prompt
  • The full conversation history
  • Any documents or data you've injected
  • The model's own response as it generates

If the total exceeds the context window, the model can't process it. Older API implementations would throw an error. Newer ones often silently truncate from the beginning of the conversation — which means the model may lose early context without telling you, producing subtly wrong or inconsistent outputs.

Context Windows Are Growing — But Constraints Still Bind

Context windows have expanded dramatically over the past few years. Models with windows of 128,000 to over 1,000,000 tokens are now commercially available. That sounds like the constraint has been solved. It hasn't.

Two problems persist. First, cost scales with context length — every token in and out is billed, so a 200,000-token context window used carelessly can run up surprising costs on high-volume workloads. Second, quality degrades in very long contexts. This is sometimes called the "lost in the middle" effect: models tend to weight information near the beginning and end of a prompt more heavily than content buried in the middle. If you're stuffing a 100,000-token document into context and expecting the model to reliably retrieve a fact from page 47, you may be disappointed.

Understanding this trade-off is central to choosing the right model for a given task. A smaller context window used carefully often outperforms a larger one used recklessly.

Tokens, Costs, and Why They're Inseparable

Providers price most API usage per 1,000 or 1,000,000 tokens, split between input tokens (what you send) and output tokens (what the model returns). Output tokens typically cost 3–5× more per unit than input tokens, which matters for task design.

A few cost dynamics worth knowing:

  • Summarization and extraction tasks are input-heavy and relatively cheap per useful unit of work.
  • Generation tasks (drafting, ideating, writing) are output-heavy and cost more.
  • Multi-turn conversations accumulate tokens fast — the full conversation history resends with every message.
  • System prompts are often long and repeat on every call; a 500-token system prompt sent 10,000 times costs as much as sending a short novel.

When building the business case for AI at scale, token economics are usually one of the first things finance teams want to model. Rough per-task estimates — tokens in, tokens out, expected call volume — give you a working cost floor to defend.

Practical Context Window Strategies

Fit What Matters, Cut What Doesn't

The goal isn't to maximize context — it's to maximize the signal-to-noise ratio within the context. Strategies that consistently deliver results:

  • Trim system prompts ruthlessly. Every instruction that isn't actually shaping behavior is wasted tokens. Run periodic audits.
  • Compress conversational history. For long sessions, summarize earlier turns rather than passing the full raw transcript.
  • Use retrieval instead of injection. Retrieval-Augmented Generation (RAG) pulls only the relevant chunks of a knowledge base into context at call time, instead of loading entire documents. This keeps the context focused and costs manageable.
  • Order your context deliberately. Given the "lost in the middle" effect, put critical instructions at the top of your prompt and key constraints near the bottom.

Chunking for Long Documents

When a document exceeds what you want to push into a single context, chunking — splitting it into overlapping segments — is the standard approach. A typical pattern uses chunks of 500–1,000 tokens with a 50–100 token overlap at the edges so meaning doesn't get cut off at arbitrary boundaries. The right chunk size depends on the task: narrow factual retrieval tolerates smaller chunks; complex synthesis may need larger ones.

Choosing a Model With Context In Mind

Context window size is a first-order filter when selecting a model, not an afterthought. A short task requiring only a few hundred tokens of context has access to nearly every capable model. A task requiring you to hold a 50-page contract in working memory while answering detailed questions narrows the field quickly.

Beyond window size, consider the quality-cost curve. How to Measure Large Language Models: Metrics That Matter covers the benchmarks in depth, but for context-specific performance, the practical test is your own eval: does the model reliably retrieve and reason about content placed in the middle of a long prompt? Run that test on representative samples before committing to a model at scale.

Also worth noting: context window sizes are evolving fast. What's a frontier number today may be table stakes next year. The trends heading into 2026 suggest continued expansion alongside architectural innovations aimed at making long-context performance more reliable, not just technically possible.

Your First Real Experiment

If you've never worked with tokens and context windows hands-on, here's a concrete path to your first result:

  1. Open a tokenizer tool (OpenAI's or Anthropic's) and paste something you'd realistically use as a system prompt. Count the tokens. You'll probably find it's higher than expected.
  2. Estimate your input/output split for a task you want to automate. Multiply by a realistic call volume. Look at what that costs at current API rates.
  3. Design a short prompt with a deliberate structure: system instructions at top, key data in the middle, specific task instruction at the bottom.
  4. Run the same task with a shorter and a longer context — for example, the full document versus a summary. Compare quality and cost.
  5. Check whether truncation is happening by adding a line to your system prompt asking the model to confirm it has read the full document. If it says yes when you know the document was truncated, you've found a reliability gap worth addressing.

This process takes about an hour and gives you grounded intuition that no amount of theory can substitute for. If you're newer to LLM work broadly, Getting Started with Large Language Models offers the wider orientation that pairs well with this deeper dive.

Frequently Asked Questions

What's the difference between a token and a word?

A token is the unit a language model actually processes, which may be a full word, a fragment of a word, punctuation, or whitespace. English text averages roughly 0.75 words per token, but the ratio varies depending on language, jargon density, and formatting. Always count tokens directly using a tokenizer tool rather than estimating from word count alone.

Does a larger context window always mean better results?

Not automatically. While a larger window lets you pass more information in a single call, quality can degrade for content buried in the middle of very long contexts, and costs scale linearly with every token. A focused, well-structured prompt in a smaller window often outperforms a bloated prompt in a larger one.

Why do output tokens cost more than input tokens?

Generating tokens requires the model to run its full forward pass for each token it produces, which is computationally more expensive than processing input in batch. Providers typically charge 3–5× more per output token than per input token, which is why generation-heavy tasks cost more than retrieval or classification tasks.

What happens when I exceed the context window?

Behavior depends on the implementation. In direct API calls, you'll typically receive an error. In chat interfaces and some frameworks, earlier parts of the conversation history are silently truncated. Silent truncation is the more dangerous failure mode because the model continues to respond — just without access to context it needed — and may not flag the problem.

Can I use retrieval to work around context limits?

Yes, and for most production use cases involving large knowledge bases, retrieval-augmented generation is the right architecture. Instead of loading an entire document into context, a retrieval system fetches only the chunks most relevant to the current query. This keeps context focused, controls costs, and often improves accuracy by reducing noise.

How often do context window limits change?

Frequently. Leading providers have expanded limits multiple times per year in recent cycles, and the competitive pressure to increase window size continues. Build your architecture to be configurable rather than hard-coded to a specific limit, so you can take advantage of increases without a full redesign.

Key Takeaways

  • Tokens are the actual unit of processing — roughly 0.75 words each for English, but variable by language, code, and formatting.
  • The context window is the model's working memory per call; everything — system prompt, history, injected data, and response — counts against it.
  • "Lost in the middle" is a real quality degradation in very long contexts; critical information should go at the top or bottom of your prompt.
  • Output tokens cost 3–5× more than input tokens; know your task's input/output ratio before estimating costs.
  • Retrieval-augmented generation is the standard solution for large knowledge bases; don't inject what you can retrieve.
  • Token counting tools exist and are free — use them before you build, not after costs surprise you.
  • Larger context windows are expanding but don't eliminate the need for prompt discipline; focused context consistently beats stuffed context.

Search Articles

Categories

OperationsSalesDeliveryGovernance

Popular Tags

prompt engineeringai fundamentalsai toolsthe difference between AIMLagency operationsagency growthenterprise sales

Share Article

A

Agency Script Editorial

Editorial Team

The Agency Script editorial team delivers operational insights on AI delivery, certification, and governance for modern agency operators.

Related Articles

General

Prompt Quality Decides Whether AI Earns Its Keep

Prompt quality is the single biggest variable in whether AI delivers real work or expensive noise. The model matters, the platform matters — but the prompt you write determines whether you get a first

A
Agency Script Editorial
June 1, 2026·10 min read
General

Counting the Real Cost of Every Token You Send

Tokens and context windows sit at the intersection of AI capability and operational cost—yet most business cases treat them as technical footnotes. That's a mistake that costs real money. Every time y

A
Agency Script Editorial
June 1, 2026·10 min read
General

Rolling Out AI Hallucinations Across a Team

Most teams discover AI hallucinations the hard way — a confident-sounding wrong answer makes it into a client deliverable, a legal brief, or a published report. The damage isn't just to the output; it

A
Agency Script Editorial
June 1, 2026·11 min read

Ready to certify your AI capability?

Join the professionals building governed, repeatable AI delivery systems.

Explore Certification