Skip to content
Glossary · LLM costs

Context window

Also called context length.

Definition

The most tokens a model can take in and produce in one request.

Last updated

What it is.

The context window covers everything the model sees in one call: the system prompt, tool definitions, any documents or chat history you send, and the reply it writes. It is measured in tokens. If a request does not fit, it fails or has to be cut down.

A bigger window allows longer inputs, such as whole contracts or long conversations. It does not make the model remember anything between calls; each request starts fresh with whatever you send.

Why it matters

Every input token is billed, so filling a large window on every call is expensive, and some providers charge a higher rate above a length threshold. Very long inputs can also make answers worse, because the important part is buried. Sending the right few passages, as in RAG, is often cheaper and better than sending everything.

Watch out

Common mistakes.

  1. 01

    Treating the window as memory. The app has to send the history again on every call.

  2. 02

    Sending everything because it fits. Fitting is not the same as being useful or cheap.

  3. 03

    Leaving no room for the reply. Output tokens share the same window.

Tools

Work it out with a tool.

Related

Related terms.

Building something with this? Ask an engineer.

OceanLab designs and builds production software. Tell us what you are planning and we will reply with how we would approach it.

OceanLab

Enterprise Software Engineering - Human + AI

Languages

Locations

Global Headquarters

21 Merchant Road, 3rd Floor, Singapore 058267

Main corporate office and leadership operations

North America Office

548 Market Street, PMB 12472, San Francisco, CA 94104

Client operations and business development

India Office

402 Shivalik Shilp II, SG Highway, Ahmedabad 380015

Engineering and delivery center

© 2026 - Copyright. All Rights reserved OceanLab