Infinite context for LLMs: what it is, how to get it

No model has an infinite context window. What infinite context means in research (Infini-attention, EM-LLM) and how agents get it in practice today.

/guides/infinite-context.mdUpdated

Is there an LLM with infinite context? No. Every model you can call today has a finite context window, and every long conversation reaches the end of it. "Infinite context" means two different things depending on who says it:

  • In research, it is an architecture that lets a model process inputs of unbounded length with bounded memory: Infini-attention, StreamingLLM, EM-LLM, state space models.
  • In practice, it is what a conversation is like when it never hits the wall: the agent keeps what matters in view, keeps the facts of the rest, and recalls details when they come up.

Our position: the window is finite; the conversation isn't. Infinite context is not a bigger window. It is assembled, call by call, from a finite one. This page covers both meanings. For memory in general (types, lifecycle, evaluation, tools), see AI agent memory.

How big are context windows today?

Large, and finite. On 12 November 2026:

  • OpenAI lists a 1.05M-token context window for each of its current flagship models (models). GPT-5 lists 400,000, with 272,000 of input (GPT-5).
  • Google says "many Gemini models come with large context windows of 1 million or more tokens" (long context).

A million tokens is a lot of text, and a conversation that runs for months, with tool output, still passes it. The question is not whether a window is big enough today but what happens on the turn it isn't.

What does infinite context mean in research?

Several lines of work aim at inputs longer than any fixed window. None of them is a switch you can turn on in a hosted API.

ApproachIdeaWhat it gives up
Infini-attention (Google, 2024)Adds a compressive memory to attention, aiming at "infinitely long inputs with bounded memory and computation"; tested on 1M-token passkey retrieval and 500K-token book summarisation (arXiv)Older context survives only in compressed form
StreamingLLM (2023)Keeps the first tokens as "attention sinks" plus a sliding window, so models "generalize to infinite sequence lengths without any fine-tuning"; stable on 4M+ tokens (arXiv)The attention window is still finite; text that leaves it is not recalled
EM-LLM (ICLR 2025)Segments tokens into episodic events by surprise and retrieves them by similarity and time; retrieval across 10 million tokens (arXiv)Needs access to the model's attention; not available through an API
State space models (Mamba, 2023)Linear-time sequence models, with performance that "improves on real data up to million-length sequences" (arXiv)A fixed-size state summarises the past
Virtual context (MemGPT, 2023)Treats the window like an operating system treats RAM, moving data between fast and slow memory (arXiv)The model must manage its own memory with tool calls

Results do not always carry over. Hugging Face tried to reproduce Infini-attention and concluded that its "performance gets worse as we increase the number of times we compress the memory", recommending other methods for extending a pretrained model's context (Hugging Face).

The first four change the model. If you call OpenAI's API, you cannot use them; you use the window you are given. The fifth works at the system level, around the model, and that is the line Threadless AI works in.

Why is a longer window not the same thing?

Even when the window is long enough, sending everything has costs that grow with the conversation:

  • Cost per turn. Input tokens are billed on every call. A conversation of a million tokens pays for a million tokens each turn.
  • Latency. More input means a longer wait before the first token.
  • Attention. Models use long inputs unevenly. Performance "is often highest when relevant information occurs at the beginning or end of the input context" (Lost in the Middle), and in Chroma's test of 18 models, "performance grows increasingly unreliable as input length grows" (context rot).
  • No sense of what is current. A window holds last week and last minute side by side, with nothing to say which one matters now.

Infinite context as a system

Infinite context for an agent is the experience of the conversation: the user talks to the agent for months, the agent keeps track of what matters, and old things come back when they come up. Threadless AI assembles it and hands it to you as one service. Before each model call you send what is new; you get back the request, history and all, ready to submit to OpenAI.

No single feature gives a conversation infinite context. Six together do:

PartWhat it doesWithout it
Bounded sizeEvery request is sized for a 200k-token context window, with room for the reply; token use stays bounded as the conversation growsThe call fails, or the oldest turns are cut blindly
The latest messages, word for wordThe newest part of the conversation is sent as it happenedThe model loses the thread of what was just said
Facts keptBefore older messages stop being sent word for word, your model notes their key facts with a note tool; they stay in viewThe agent forgets what it learned along with the turns that taught it
Newer facts winA newer fact replaces the one it contradicts: "moved to Denver" replaces "lives in Austin"The agent acts on what used to be true
RecallWhen a message touches something older, the older messages and facts about it come back, with their dates, before the messageOld details are gone for good, or buried in every prompt
A local fallbackIf we cannot be reached, the SDK builds the request from recent turns and the call goes aheadMemory becomes a way for the agent to break

The user does not see any of these. They see an agent that remembers a delivery date three weeks later, does not repeat a question they answered, and never says the conversation is too long.

Why it has to be assembled

Each familiar approach to long conversations does one of the six:

  • Truncation keeps requests under the window, and nothing else.
  • Summaries keep the gist, and drift.
  • Retrieval brings old messages back, without any sense of what is current.
  • Bigger windows delay the problem, cost more per call, and attend less well to what matters now.

Infinite context needs all of them working together, on every call, with one decision about what the model sees. That decision is the hard part, and it is the part Threadless AI owns. Context window management compares the approaches side by side.

Approaches compared

Where it livesAvailable todayCost per callWhat it loses
Bigger windowThe modelYes, up to about 1M tokensGrows with the conversationAttention to the middle; still has an end
Architectural "infinite" attentionThe modelResearchBounded, if you train or host the modelDetail of compressed or evicted context
CompactionOpenAI's server (compaction)Yes, Responses APIBoundedReadability; details do not come back on demand
Memory store plus your own prompt codeYour code and a vendorYesBounded if you cap itWhatever your prompt code does not handle
Assembled memory (Threadless AI)A service; you submit the requestYes, OpenAI formatsBoundedOlder messages, word for word, from the request; they come back when the conversation turns to them

What you change in your code

Three calls around the model call you already make:

TypeScript
const request = await memory.chat.decorate(memoryId, newMessages, { model, tools });
const reply = await openai.chat.completions.create(request);
memory.chat.report(memoryId, reply);
  1. decorate before the call: send only what is new since the last call.
  2. Submit the request to OpenAI with your own key.
  3. report the reply. It returns at once.

Add the note tool to your tools and answer its calls with noted. That is the whole integration. The quickstart has the loop in TypeScript and Python, for Chat Completions and Responses.

How this differs from a memory store

Most memory services are stores: you add messages, search them, and decide where the results go in your prompt. You still make the hard decision, what fits the window, on every call.

A memory storeThreadless AI
What you get backSearch results to place in a promptThe request, ready to submit
Who decides what fits the windowYouWe do, on every call
Who writes the factsUsually the store's own modelYour model, from the turns it was in
A sense of what is currentUsually none, or a ranking tweakNewer facts replace older ones; recalled messages carry their dates
When the service is downYour call fails or goes without memoryThe SDK builds the request from a local tail

When it is not what you need

  • One-shot calls with no conversation have nothing to remember.
  • Facts shared across a user's conversations. A Threadless AI memory is one conversation, and recall never crosses memories. See Memory per conversation, not per user.
  • Models outside OpenAI's formats. The request comes back as Chat Completions or Responses.

Questions people ask

Is there an LLM with infinite context?

No. Every model you can call has a finite window; the largest offered by OpenAI and Google are around a million tokens. Research architectures such as Infini-attention aim at unbounded input, but they are not something you can switch on in a hosted API.

What is Infini-attention?

A 2024 Google technique that adds a compressive memory to a Transformer's attention, so it can process very long inputs with bounded memory. The paper reports results on 1M-token passkey retrieval and 500K-token book summarisation; a Hugging Face reproduction found it degraded as memory was compressed more often.

Does Gemini have infinite context?

No. Google describes many Gemini models as having windows of 1 million or more tokens. That is large, but finite.

Will infinite context windows replace RAG?

Not on cost or reliability. Sending a whole corpus on every call pays for all of it each time, and models use very long inputs unevenly. Retrieving the passages a question needs remains cheaper, and usually better.

How do agents get infinite context in practice?

By managing a finite window: keeping recent and relevant history in view, writing down facts from what leaves, and recalling details when they come back up. That can be built from truncation, summaries and retrieval, or used as a service.

Is infinite context the same as long-term memory?

Closely related. Long-term memory is what the agent keeps across a conversation that outgrows the window; infinite context is the experience that memory gives the user. See AI agent memory.