Skip to content
AI-powered appsNewChat, vision, voice, generationBookings & schedulingAppointments that book themselvesShops & sellingA storefront in every pocketClient & businessRun the operation from one placeCommunities & clubsA home that is not a group chat
Health & wellnessHabits, tracking and calmGames2D, 3D and multiplayerPersonal & toolsThe tool you wish existedInternal toolsThe tool ops never had time for
See all use cases
ArcadeNewPricingSecurity
EngineThe game engine and World EditorHow it worksFrom one sentence to a live productDocsGuides for building and publishingBlogStories, guides and newsChangelogWhat shipped latelyStatusUptime of every serviceSupportGet help from the team
AI-powered appsBookings & schedulingShops & sellingClient & businessCommunities & clubsHealth & wellnessGamesPersonal & toolsInternal tools
See all use cases
ArcadeNewPricingSecurity
EngineHow it worksDocsBlogChangelogStatusSupport
Language
Blog
GlossaryNovember 22, 20263 min read

What are tokens and the context window?

AI models do not read words, they read tokens, and they can only hold so many at once. Knowing both explains AI bills, forgotten instructions and why shorter prompts often work better.

Startbase Team
Editorial ink illustration of a sliding window frame resting on a long paper scroll on a desk, the window frame in ember orange

Key takeaways

  • A token is a chunk of text, often part of a word; in English a rough rule is about four characters per token.
  • The context window is the maximum number of tokens a model can take in, prompt and reply together, in one request.
  • AI usage is metered in tokens in and tokens out, so long histories and pasted documents cost more on every call.

Tokens are the small chunks of text, often whole short words or pieces of longer ones, that a language model actually reads and writes, and the context window is the maximum number of tokens the model can work with in a single request, counting your instructions, any documents or chat history you include, and its own reply.

An everyday comparison: a desk. Tokens are the sheets of paper; the context window is the size of the desk. Everything the model should consider has to fit on the desk at the same time. Anything that does not fit is, for that request, as if it did not exist.

What a token is

Models split text with a tokenizer that learned common chunks. "Book" is likely one token; "unbookable" might be three ("un", "book", "able"). Spaces and punctuation are part of tokens too. Rough rules for English, useful for estimates only: about four characters or three-quarters of a word per token, so 1,000 words is in the region of 1,300 tokens. Code, numbers and many non-English languages use more tokens per word, so the same message can cost noticeably more in another language.

The context window

Each model has a fixed limit. Current models range from tens of thousands of tokens to over a million. Three things share that space in every request:

  1. 01Instructions: the system prompt that sets the role and rules.
  2. 02Context: chat history, retrieved documents, file contents, tool results.
  3. 03The reply: output tokens count against the window too, and models also have a separate cap on how long one reply can be.

A bigger window does not mean perfect attention. Models can miss details buried in the middle of very long inputs, so including only what is relevant often gives better answers than including everything. That is the idea behind RAG: fetch the few passages that matter instead of pasting the whole manual.

Why it matters when you build with Startbase

On the building side, context is why focused requests work. Startbase credits track the work the agent does and vary with context and work performed, and the docs advise sending only the context and attachments a task needs. Project Knowledge (up to 8,000 characters) is added to every turn, so keep it to the rules that really apply everywhere (custom knowledge docs). When a long thread drifts, planning before you build and small steps beat one giant prompt.

On the app side, if your app calls AI through the Startbase Cloud gateway, the Backend tab shows calls, tokens in and out, and cost, and you can cap runtime spend per app (AI features docs). Design with tokens in mind:

  • For chat features, send the last 10 to 20 messages plus a short running summary, not the entire history, as a starting point to tune.
  • Trim documents to the relevant sections before sending them.
  • Ask for concise, structured replies when you only need a few fields; output tokens usually cost more than input tokens.

The cost of building an AI app puts these per-call costs into a monthly budget.

Common confusions

  • Tokens vs words vs characters. Limits and prices are in tokens. Word counts are only an approximation.
  • "The model forgot." In a long chat, early messages may have been dropped or summarized to fit the window. Restate key constraints when it matters.
  • Context window vs training data. The window is short-term working space for one request. The model's general knowledge comes from training and does not grow with what you paste in.

Frequently asked questions

How can I count the tokens in my text?

Many model providers publish free tokenizer tools that show exactly how text is split. For quick planning, divide the character count by four for English.

What happens if my request exceeds the context window?

The request fails or the app has to cut something, usually the oldest messages. Well-built apps summarize or retrieve only relevant parts before that happens.

On this page

  • What a token is
  • The context window
  • Why it matters when you build with Startbase
  • Common confusions

Keep reading

More in Glossary
Editorial ink illustration of a hand-cranked music box drum plucking a metal comb, the crank handle in ember orange
GlossaryNovember 22, 2026

What is a game loop?

Every real-time game runs one repeating cycle: read input, update the world, draw it. Here is what that cycle looks like and why it decides how your game feels.

3 min read
Editorial ink illustration of a brass stopwatch beside a small wind-up toy car, the second hand in ember orange
GlossaryNovember 22, 2026

What is delta time?

Delta time is the number that keeps your game the same speed on every screen. Here is how to use it, where it breaks, and how to spot a game that forgot it.

3 min read

Read less. Ship more.

Everything in this post is one prompt away. Describe your app and watch it build.

Start building

Apps, games, backends and publishing from one conversation.

Product

  • Features
  • Use cases
  • Pricing
  • Changelog

Resources

  • Blog
  • Docs
  • Support
  • Status
  • Security

Contact

  • w@startbase.ai
  • X / Twitter
  • LinkedIn
  • Instagram

Legal

  • Terms
  • Privacy

© 2026 Startbase. All rights reserved.