Context

A model's context is how much text it can hold at once, counted in tokens. Your prompt and the reply have to fit in it together.

Pendra sets it for you. Each model gets a context sized to the worker it runs on, so you rarely need to think about it.

Pendra sizes it for you

When a model loads, the worker works out the largest context its memory can run reliably, up to the most the model was trained for.

  • A smaller model gets more context than a large one on the same GPU.
  • If a worker serves several models, each one leaves room for the others to load.
  • If memory turns out to be tighter than expected, the model keeps serving with a smaller context and tries the full size again later. The console shows when.

As a rough guide:

MemoryTypical context
Under 6 GB4,096 tokens
6 to 12 GB8,192 tokens
12 to 24 GB16,384 tokens
24 to 48 GB32,768 tokens
48 GB or more65,536 tokens or more

Many models go well beyond this. Gemma 4 and gpt-oss, for example, need much less memory for context, so they reach far longer ones. A very long prompt can take minutes to read before the reply starts.

See a model's context

  • The worker's page in the console shows each model's context, and a memory map of what each model is using.
  • The Playground shows it next to the worker picker, for example Context 8,192 tok, so you can check a long paste will fit. A ~ in front means the model isn't loaded, so the number is an estimate.
  • From code, GET /api/v1/models returns it as context_window. When several workers serve a model, both show the smallest of their contexts, because a request can go to any of them.

Set it yourself

In the console, open Workers, choose the worker, and expand the model under Models & context. Switch it to Custom and choose a context. Switch back to Auto to let Pendra set it again. The change applies on the model's next request.

A context larger than the model was trained for, or than your worker's memory can hold, is reduced to what fits. The console marks it VRAM-limited and shows the context in use.

You can also set it from code, with an API key that has the workers:write permission. Send 0 to switch back to Auto. See Managing workers.

bash
curl -X PATCH https://api.pendra.ai/api/v1/workers/wrk-3f9b8a2d9e104c1a/models/qwen3.6:27b/config \
  -H "Authorization: Bearer pdr_sk_..." \
  -H "Content-Type: application/json" \
  -d '{"context_size": 32768}'

When to change it

  • Raise it for long documents, agents that build up a long history of tool calls, or large system prompts.
  • Lower it to free memory for a bigger model or more requests at once, or when your prompts are always short.

Good to know

  • On Gemma, gpt-oss and Flint models, each request running at the same time needs some memory of its own. A high Requests at once limit can shorten their context, and a very long reply may stop early with a truncated_memory_full notice. If you see that, lower the worker's Requests at once limit.
  • A model using speculative decoding gives up a little of its context for it. A context you set yourself is never reduced for this. The model runs without speculative decoding instead.
  • Embedding models set their own context, and this setting doesn't apply to them.
  • Context is set per model. There's no setting for the whole worker.