Long prompts, slow replies and when to stop stuffing tokens

APIFreeGemini · Updated 2026-11-22 · 8 min read

Long paper scroll with a lamp lighting one part
A context window is how much of the scroll the model can see at once.

Gemini models are known for very large context windows in AI Studio and the API, far larger than many consumer chat apps expose. People who push those limits notice two things. Responses get noticeably slower once a conversation holds hundreds of thousands of tokens, and the consumer app seems to work with a much smaller window, which makes some wonder whether that is a deliberate user experience choice rather than a technical one.

This article explains what a context window is in practical terms, why bigger is not automatically better, and which techniques give good answers over large material without making every request slow and expensive. It also covers how to work inside the 32,000-token window of the keyless free-ai model on this site.

Frequently asked questions

What is a context window?

It is the total amount of text, measured in tokens, that a model can consider in one request: system prompt, conversation history, pasted documents and the answer it writes. Anything beyond the window is simply not seen.

Why do responses slow down with very long context?

The model has to process every input token before it can start writing. More input means more computation before the first output token, and providers may also route very long requests differently. The delay grows with the size of what you send.

Why would an app use a smaller window than the API offers?

Speed, cost and consistency. A consumer app serves many people at once and wants replies to start quickly. Capping history keeps latency predictable. Users sometimes suspect this is a deliberate trade-off, and it is a reasonable explanation, though only the provider knows the exact reasons.

Do models use all of a long context equally well?

Not always. Models can miss details buried in the middle of very long inputs, or blend similar passages together. Placing the most important material near the question and repeating key constraints helps.

What is retrieval, and how is it different from long context?

Retrieval means searching your material first and sending only the relevant passages. Long context means sending everything and letting the model find what matters. Retrieval is faster and cheaper per request; long context is simpler to build.

Why does a URL sometimes get summarised badly?

Some interfaces fetch and parse the page itself, while others only run a search for the link and answer from snippets. Users often notice that a developer tool reads the actual page while a consumer app seems to skim. When accuracy matters, fetch the page yourself and paste the relevant text.

How large is the free-ai context?

32,000 tokens for input and output combined, with answers up to 16,000 tokens. That is enough for a long article or a mid-sized source file, not for whole books or large repositories.

Which is better for summarising long transcripts?

For a single very long transcript, a large-context hosted model is simplest. For many transcripts or a free setup, chunk-and-merge summarisation with a smaller window works well and is easy to automate.

Tokens, not pages

Context is counted in tokens, fragments of words. In English a token is roughly three quarters of a word on average, but code, numbers and many non-English languages use more tokens per word. A window that sounds enormous in tokens can be smaller than expected in pages of your actual material.

Remember that the answer also lives in the window. If you send 30,000 tokens to a model with a 32,000-token limit, only 2,000 tokens remain for the reply. Budget both sides.

Context limits also interact with output limits. Some models cap the answer length separately from the total window, so even a huge window does not guarantee a long reply. When you need long output, check both numbers in the documentation of the model you use.

Estimate before you send

A quick rule of thumb is four characters per token for English prose. For precise numbers, use the token counts returned in the API's usage field on a sample request.

Languages cost differently

Some scripts are tokenised less efficiently than English, so the same content costs more tokens. The article on the language token tax covers why and what to do about it.

Why huge contexts feel slow

Before writing its first word, a model processes the entire input. With a short prompt this takes a fraction of a second. With a very long conversation, users describe waits that make the chat feel stuck, especially once history reaches the hundreds of thousands of tokens.

Long chat sessions grow silently. Every turn resends the whole history, so a conversation that started small becomes a giant request without anyone pasting a document. That is one reason apps trim or summarise old turns.

A simple remedy for long chats is to start a new conversation with a short summary of the old one. You lose nothing important and gain fast replies again.

Time to first token is the pain point

Users tolerate slow generation once text is flowing, but they abandon a blank screen. Long inputs hurt time to first token most.

Costs scale with every turn

On metered APIs, each turn bills the full history again. A long session can cost far more than the sum of its visible messages suggests.

Long queue at a station ticket window
More input means more waiting before the first word appears.

Why apps and APIs expose different windows

Developer tools such as AI Studio tend to expose the model's full window because developers ask for it and accept the latency. Consumer apps serve many people at once and want predictable speed. Capping the active history, summarising older turns or retrieving only relevant memory are common ways to keep replies fast.

If you need the full window, use the developer surface. If you need fast everyday chat, the smaller effective window is often a feature, not a bug.

Memory features are a kind of retrieval

When an app remembers facts about you across chats, it usually stores short notes and inserts the relevant ones into the prompt. That is retrieval in disguise: a small, selected context instead of the whole history. It keeps requests fast, at the cost of occasionally choosing the wrong note.

Pick the surface for the job

For a one-off analysis of a huge document, the developer surface with the full window is worth the wait. For daily chat, the trimmed window of a consumer app gives faster replies. Using each where it fits avoids most frustration about context size.

Chunk, summarise, merge

The most dependable technique for long material on any model is map and reduce. Split the text into chunks that fit comfortably, summarise or extract from each chunk, then combine the partial results in a final request. It works with small windows, parallelises well and makes failures local to one chunk.

Developers who replaced a paid summarisation subscription with a small local script often describe exactly this pipeline: transcribe, split, summarise per chunk, then write a final digest.

Overlap chunks slightly

Repeat a few sentences between neighbouring chunks so that ideas spanning a boundary are not cut in half.

Ask for structured partial results

Request bullet points or JSON from each chunk. Structured partials are easier to merge than free prose.

from openai import OpenAI

client = OpenAI(base_url="https://api.apifreegemini.com/v1", api_key="unused")

def ask(prompt, max_tokens=600):
    r = client.chat.completions.create(
        model="free-ai", max_tokens=max_tokens, temperature=0.3,
        messages=[{"role": "user", "content": prompt}],
    )
    return r.choices[0].message.content

def chunks(text, size=40000, overlap=1500):
    i = 0
    while i < len(text):
        yield text[i:i + size]
        i += size - overlap

transcript = open("transcript.txt", encoding="utf-8").read()
notes = [ask(f"List the key points of this transcript part as bullets:\n\n{c}") for c in chunks(transcript)]
print(ask("Merge these notes into one summary with headings:\n\n" + "\n\n".join(notes), max_tokens=1500))
Baguette cut into slightly overlapping slices
Split long material into overlapping chunks, then merge the results.

Retrieval instead of stuffing

When you ask many questions over the same large material, retrieval beats resending everything. Index the material once, then for each question find the most relevant passages and send only those. Each request stays small and fast, and you can cite which passage the answer came from.

Retrieval does add moving parts: an index, an embedding or keyword search, and a ranking step. For a handful of documents, simple keyword search over paragraphs is often good enough to start.

Start with keyword search

Before reaching for vector databases, try splitting documents into paragraphs and ranking them by shared keywords with the question. It is crude, transparent and surprisingly effective.

Send sources with labels

Prefix each passage with an identifier and ask the model to cite identifiers. You can then show users where an answer came from.

Cache what does not change

If many questions share the same large background text, look at whether your provider supports caching of repeated prompt prefixes, and check its current documentation for how that is billed. Even without provider support, caching retrieved passages in your own app saves repeated work.

Reading web pages reliably

A recurring complaint is that a consumer app answers about a link without really reading it, while a developer tool with a URL context feature parses the page properly. Behaviour differs between surfaces and changes over time, so do not rely on any interface to fetch pages the same way.

For dependable results, fetch the page yourself, strip navigation and scripts, and paste the main text into the prompt. That works with every model, including ones that cannot browse at all. The keyless model on this site cannot fetch URLs, so this is the way to use it with web content.

Clean text costs fewer tokens

Raw HTML contains menus, scripts and markup that inflate token counts without adding meaning. Converting a page to plain text before sending it often cuts the size by more than half, which matters a lot inside a smaller window.

  • Download the page with your HTTP client of choice and a normal User-Agent
  • Extract the main text and drop menus, footers and scripts
  • Trim to what fits the window with room left for the answer
  • Ask the question after the text, not before it
Hand picking a card from an open catalogue drawer
Retrieval sends only the passages that matter for the question.

Placement and repetition inside long prompts

How you arrange a long prompt matters. Put stable instructions first, the material in the middle, and the specific question at the end, close to where the model starts writing. Repeat the one or two constraints that matter most right before the question.

If a model ignores a detail from deep inside a long input, try moving that passage closer to the question or quoting it explicitly. This is often more effective than switching to a larger model.

Name the sections

Headings such as SOURCE A or CONTRACT CLAUSES help the model refer back to parts of a long input and help you debug which part it used.

Working within 32,000 tokens on the free endpoint

The free-ai model behind https://api.apifreegemini.com/v1 has a 32,000-token context and answers of up to 16,000 tokens. It is an independent open-weight model of about 35B parameters, and the site is not affiliated with Google. For truly huge single inputs, a large-context Gemini model is the better tool, and it is fair to say so.

For most practical jobs, though, the techniques above make the smaller window workable: chunked summaries, retrieval and careful trimming. Because the API is stateless, you control exactly what history is sent, which keeps requests small. If you also move conversations between tools, the guide to portable chat context shows how to carry a compact summary instead of a full transcript.

Suitcase packed with rolled clothes and items left aside
Packing a smaller window well beats overstuffing a big one.
Try the free API

Send a test prompt to the keyless free-ai endpoint from the home page, no sign-up or key required.

Read also