← Apps, keys and settings

What context size should I use for AI roleplay?

Updated

Set your app's context size a few thousand tokens below the model's limit, because the limit includes the reply. For UnsavedAI's Gemma 4 models, which allow 61,440 tokens, use 56,000. That fits a long evening of roleplay, leaves room for a full reply, and lets your app trim the oldest messages instead of failing when the story outgrows it.

Try it now, free, no account neededStart a story with The NarratorAny story you want, you choose

What context size actually controls

Context is everything the model reads at once: the system prompt, the character card, example dialogue, your persona, any lorebook entries that triggered, the recent history and your new message. The context size setting in your app is the budget it tries to stay under when building that bundle. When the chat gets longer than the budget, the app drops the oldest messages to make room.

The model also has a hard limit, and that limit covers the prompt plus the reply. So the app's budget has to sit below the limit by at least one reply's length.

Why 56,000 for Gemma 4

Both gemma-4-12b and gemma-4-31b allow 61,440 tokens on every plan. Subtract a full reply of about 700 to 800 tokens, then keep around 4,000 spare, because apps count tokens their own way and not exactly as the model does. That lands at 56,000.

If the prompt is too big anyway, the request fails with "Prompt must leave room for output within the ...-token context." Lowering the context setting fixes it. Lowering reply length does not, because we already shorten a reply that would not fit.

What eats your context

  • Character cards: a detailed card can be 1,000 to 3,000 tokens, and it is sent every message.
  • Example dialogue: valuable for voice, but long examples cost on every turn.
  • Lorebooks and World Info: each triggered entry adds up; broad keywords trigger constantly.
  • History: the rest. Roughly, a token is about three quarters of an English word, so 56,000 tokens holds something like 40,000 words of story.

Trimming a bloated card often gives you more usable memory than any setting.

Bigger is not always better

A huge context makes every reply read more text, so long chats get slower, and the model does not weigh distant details as strongly as recent ones. For stories that run for weeks, a short written summary of older events often keeps the plot sharper than raw history. Our guide to long-roleplay context covers summaries and the prompt-ordering trick that keeps replies fast.

Where to set it

  • SillyTavern: Context Size in AI Response Configuration (the sliders icon).
  • JanitorAI: Context size in the chat's generation settings.
  • Other apps: look for context length, context window or max context, and use the same 56,000.

Questions people ask

Does Priority get a bigger context?

Not today. Both Gemma models allow 61,440 tokens on Free and Priority, so 56,000 is right on either plan.

Will the Free context always be this size?

Free's roughly 60K context is a limited-time boost while the service is small. If it changes, the Pricing page will say so first.

My app has no context setting. What happens?

If the app sends more than fits, the request fails with the context error. Shorten the history the app sends, or use an app that trims for you, such as SillyTavern or JanitorAI.

Characters for this story