AI roleplay settings explained: tokens, context, temperature
Updated
Generation settings control how an AI roleplay app asks the model for each reply. Everything in them is counted in tokens, small pieces of text that average about three-quarters of an English word. Max tokens, also called max new tokens or response length, caps how long one reply can be, and a reply that reaches the cap stops where it is, often mid-sentence. Context size is how much text the model reads before it replies: the character definition, your persona, memory notes, and as much of the recent chat as fits. Temperature sets how often the model picks a less likely word. No single temperature is best for roleplay, because each model has its own default, providers recommend different values, and several newer models ignore or reject the setting. Start from your app’s defaults and change one setting at a time.
This guide explains each setting in general, then what Janitor AI, SillyTavern, Chub, NovelAI, AI Dungeon, and Character.AI document about it. App and provider details come from their documentation as of December 2026. Settings pages change often, so the labels in your app may differ.
What tokens are, and why apps count everything in them
Language models read and write text in tokens. A token can be a whole word, part of a word, a punctuation mark, or a word together with the space before it. Each model splits text its own way, so the same message can have a different token count in two models. OpenAI’s help center gives rules of thumb for English: a token is about four characters or three-quarters of a word, and “100 tokens are approximately 75 words.” Google’s figure for Gemini is 60 to 80 English words per 100 tokens, and Janitor AI’s help center says roughly 1,000 tokens equal 750 words.
Apps count everything in tokens because the model’s limits are set in tokens. A model can read only so many tokens at once and write only so many in one reply, and paid APIs charge by the token. So the character definition, your messages, and the replies are all measured the same way. As a rough guide, a 300-word reply is about 400 tokens, and a context of 9,000 tokens holds about 6,750 words in total. Janitor AI’s help center warns that online token counters are only estimates, and that creating a character on Janitor AI shows the accurate count for JLLM, its own model.
Max tokens: the longest reply the model may write
This setting caps the length of a single reply, counted in tokens. Apps call it max tokens, max new tokens, response length, Response (tokens) in SillyTavern, or Response Length in AI Dungeon. NovelAI’s equivalent, Output Length, counts characters instead, from 4 to 600 depending on the subscription.
The number is a ceiling. Anthropic’s API documentation says its models “may stop before reaching this maximum” and
that the setting “only specifies the absolute maximum number of tokens to generate.” The limit matters only when the
model is still writing as it reaches it. The reply then stops at that token, wherever it is in the sentence, and the
API records why: OpenAI’s API marks the reply length, and Anthropic’s marks it max_tokens.
Why replies get cut off mid-sentence
A reply that stops in the middle of a sentence has usually hit the max tokens limit. Raise the limit and
regenerate. If the reply was good apart from the ending, some apps can extend it: SillyTavern has a Continue button,
and Anthropic’s documentation suggests that you “Raise max_tokens or continue the response.”
Models that reason before they answer need extra room, because their hidden reasoning counts toward the same limit. OpenAI’s API reference describes its limit as covering “visible output tokens and reasoning tokens,” and Anthropic’s says “Thinking tokens count toward your max_tokens limit.” With a low limit, the reasoning can use up much of the budget before the visible reply begins. If you connect a thinking model through a proxy and its replies come back short or cut off, raise the limit first.
How to get shorter replies
Lowering max tokens is a poor way to shorten replies, because the model writes as it normally would and is stopped when the count runs out. Use a length control if your app has one. For its own models, Janitor AI has a Response length setting with Standard and Shorter replies, which replaced an older “short responses” toggle in July 2026. Character.AI added response length options in 2025. In any app, the opening message and your own turns set the length the model copies, which our guide to making AI replies longer or shorter covers.
A very high limit has costs too. In SillyTavern, the response length is set aside from the context, so a large allowance leaves less room for chat history. Long replies also give the AI room to write your character’s actions after it has finished its own. Our guide to stopping an AI character from speaking for you covers that problem.
Context size: how much the model reads before each reply
Before every reply, the app builds one long text and sends it to the model. That text holds the app’s instructions, the character definition, your persona, any memory notes or lorebook entries that apply, and the chat history. Context size is the most tokens the app will send. SillyTavern describes its Context (tokens) setting as “The maximum number of tokens that SillyTavern will send to the API as the prompt, minus the response length,” made up of “character information, system prompts, chat history, etc.” AI Dungeon’s help center lists Memory, triggered Story Cards, and Author’s Note among the parts, and says “Any remaining space in the set Context Length is filled by Adventure text.”
The fixed parts are always included, and recent chat fills whatever space is left. Once the chat is longer than that space, the oldest messages are left out. SillyTavern marks the point with a dotted line in the chat: “Messages above that line are not sent to the AI.” The model has no record of anything above that line unless it was saved in a memory note or the definition. That is the main reason AI characters forget, and our guide to why AI characters forget explains it in detail.
The context size you set is separate from the model’s context window, which is the most the model can handle at once. Anthropic’s documentation describes the window as “all the text a language model can reference when generating a response, including the response itself,” so the context you send and the reply allowance have to fit inside it together.
Permanent tokens and context in Janitor AI
Janitor AI’s help center splits the context into two kinds of tokens. Permanent tokens “show up every single time the AI processes a message, no matter how long the chat gets.” They include the bot’s personality and scenario, Advanced Prompts, chat memory, and your persona. Temporary tokens are the chat messages, which “get pushed out as new messages come in.”
JLLM, Janitor AI’s own model, reads “Around 8k-9k tokens, give or take,” according to the help center. Its subscription FAQ lists a “Context limit of around 9k tokens” on the free tier and “5x more context” with janitor+. Permanent tokens take their share of that budget on every reply, and the help center gives two guidelines for them. Its token guide says “Most well-made bots perform best with under 1,500 tokens of permanent info,” and its character creation page recommends staying “under 2500 permanent tokens.”
To see what that leaves, take about 9,000 tokens in total and 1,500 permanent tokens. About 7,500 tokens remain for the chat, roughly 5,600 words by OpenAI’s rule of thumb. If your turns and the bot’s replies average 150 words each, the bot sees roughly the last 35 to 40 messages. These figures are estimates, since JLLM counts tokens its own way, but they show how a long definition shortens the part of the chat the bot can see. Our guide to writing an AI character that stays in character covers how to keep a definition short without losing the character.
Is a bigger context better?
A larger context lets the model see more of the story, and it has three costs. First, models use long inputs less reliably. Anthropic’s documentation says “more context isn’t automatically better. As token count grows, accuracy and recall degrade, a phenomenon known as context rot,” and Janitor AI’s help center uses the same term for an overloaded JLLM context. Second, on a paid API you pay for the input tokens of every request, and every reply resends the whole context. Once a chat is long enough to fill it, doubling the context size roughly doubles the input cost of each message, unless the provider discounts repeated text through caching. Third, the context and the reply allowance have to fit inside the model’s window.
AI Dungeon’s help center advises the opposite for its own plans: “It’s typically best to set this to the highest value so the AI always receives as much context about your Adventure as possible.” There, the limit comes with your membership tier, from about 4,000 tokens on the free plan to about 64,000 on the top plan.
Where you choose the size yourself, use one your model supports, keep the permanent parts lean, and save the facts your story depends on in memory notes, which are sent with every reply.
Temperature: how predictable the wording is
At each step of writing a reply, the model gives every possible next token a probability, and the app picks one at random, weighted by those probabilities. Temperature reshapes the probabilities before the pick. NovelAI, which calls the setting Randomness, describes both directions: below 1, “likely tokens become even likelier and unlikely tokens become rarer,” and above 1, “the probability of generating every token becomes more equal.” At 1, the probabilities stay as the model produced them, which SillyTavern’s documentation calls “the original probabilities.”
Janitor AI’s help center illustrates this with the sentence “The cat sat on the…”. At a low temperature the model usually ends it with “mat.” At higher temperatures, less likely endings such as “keyboard” come up more often. “No option completely disappears,” the help center notes, so temperature changes how often each ending is picked.
Both extremes cause problems in a story. NovelAI warns that with Randomness too low, “the generated text can become stuck in repetition,” and that higher values increase “mistakes in the output, such as logical errors and grammar errors.” AI Dungeon says too high a temperature “can lead to the AI picking outlandish or even gibberish tokens.” Temperature is often called the creativity setting, and a 2024 study by Max Peeperkorn and colleagues tested that claim on story generation. It found temperature “weakly correlated with novelty, and unsurprisingly, moderately correlated with incoherence.” In their tests, higher temperatures made stories slightly more novel and more often incoherent.
What temperature is best for roleplay?
No single temperature is best for roleplay. Each app and provider recommends values for its own models, and the numbers don’t carry over from one model to another:
- Janitor AI’s help center suggests starting at 0.6, adding 0.1 if replies are bland, lowering it if replies turn into “word salad,” and keeping it “below 1.0.” It also says “There’s no magic number,” because the same value behaves differently from one model to the next.
- AI Dungeon says “The default temperature is often times 0.8,” with 0.6 if the AI strays too far and 0.95 or 1.2 for “really uncommon text.”
- NovelAI’s default Randomness of 1 is “the recommended choice if you don’t know what to pick.”
- DeepSeek’s API documentation sets the default at 1.0 and recommends 1.3 for “General Conversation” and 1.5 for “Creative Writing / Poetry.”
- OpenAI’s API defaults to 1 on a scale of 0 to 2. Its reference says “Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.”
- Google says it “strongly” recommends keeping Gemini 3 Pro at its default temperature of 1.0.
Janitor AI’s 0.6 and DeepSeek’s 1.5 are advice for different models, so neither tells you what to use on the other. AI Dungeon’s help center says it directly: “There aren’t agreed-upon ‘best values’ for these settings.” Start at your app’s or provider’s default. Raise it in small steps if replies feel flat and repetitive, and lower it if they lose track of the scene or stop making sense.
Some newer models don’t use temperature
Many recent models reason before they answer, and several providers have dropped sampling settings for them. As of December 2026:
- OpenAI’s guide to its GPT-6 models says to remove temperature and top-p whenever the model’s reasoning effort is set to anything other than “none.”
- Anthropic’s API version of October 21, 2026 removed temperature, top-p, and top-k. A request that sends them “returns a 400 error, even at the parameter’s default value,” and Anthropic names Claude 4.7 and later among the models that “already accept only the defaults.”
- Google’s API ignores temperature, top-p, and top-k starting with Gemini 3.6 Flash and 3.5 Flash-Lite, and Google says future models will return an error.
- DeepSeek’s thinking mode, which is on by default, “does not support the
temperature,presence_penalty, orfrequency_penaltyparameters.” Setting them “will not trigger an error but will also have no effect.”
If you connect one of these models to Janitor AI, SillyTavern, or Chub, the temperature slider may do nothing, or the request may fail. Check the documentation for the exact model you use. On these models, the prompt, the character definition, and the opening message are what shape the writing.
Top-p, top-k, and min-p
These settings cut unlikely tokens out of the pick, so that a few improbable words can’t derail a reply. They differ in where they draw the line. Ari Holtzman and colleagues, who introduced top-p in 2020, found that always choosing the most likely words produced text “that is bland, incoherent, or gets stuck in repetitive loops,” while sampling from every option let in gibberish. Trimming “the unreliable tail of the probability distribution” kept the variety and dropped the worst picks.
- Top-k keeps a fixed number of the most likely tokens. SillyTavern’s example: “if Top K is 20, this means only the 20 highest ranking tokens will be kept.” In a 2018 story-generation study, Angela Fan and colleagues sampled from “the k = 10 most likely candidates,” because “Completely random sampling can introduce very unlikely words.”
- Top-p, also called nucleus sampling, keeps the most likely tokens until their probabilities add up to the set value. In OpenAI’s words, “0.1 means only the tokens comprising the top 10% probability mass are considered.” A value of 1 turns it off.
- Min-p removes every token less likely than a set fraction of the top token’s probability. NovelAI’s example: “if the top probability is 0.6, and you choose Min-P 0.1, then token probabilities below 0.06 will be set to 0.” Its authors, Nguyen Nhat Minh and colleagues, reported better quality and variety at high temperatures (ICLR 2025). A 2025 reanalysis by Rylan Schaeffer and colleagues concluded that the evidence “fails to support claims that min-p improves quality, diversity, or a trade-off between quality and diversity.”
Which of these you see depends on the model. OpenAI’s API has top-p and no top-k or min-p setting, SillyTavern and NovelAI list all three, and SillyTavern notes that some samplers work only with certain backends. The documented starting values are light: AI Dungeon says “A Top-P of 0.90 to 0.95 is best for most players,” NovelAI suggests values near 1, “like 0.95,” for nucleus sampling, and SillyTavern says min-p “Works best at low values such as 0.1-0.01.” OpenAI and Chub both advise changing temperature or top-p, but not both at once.
Repetition, frequency, and presence penalties
Penalties lower the chance of tokens that already appear in the chat, to keep the model from looping on the same words. They count tokens, so they also push against words the story needs, such as character names. Apps offer three kinds, on two different scales:
- Repetition penalty goes back to the 2019 CTRL paper by Nitish Shirish Keskar and colleagues, which penalized repetition “by discounting the scores of previously generated tokens” and found that a value of about 1.2 worked well with near-greedy sampling. In SillyTavern, a value of 1 turns it off.
- Frequency penalty grows each time a token appears again. OpenAI’s API reference says positive values decrease “the model’s likelihood to repeat the same line verbatim.”
- Presence penalty applies once to any token that has appeared at all, “increasing the model’s likelihood to talk about new topics.”
In OpenAI’s API, frequency and presence penalties run from -2.0 to 2.0, and 0, the default, turns them off. Repetition penalty is off at 1, so a value copied from one kind to another means something different. Set too high, any of them makes the writing worse. AI Dungeon’s help center warns that a high presence penalty “can occasionally do the opposite of the intended effect, and cause more repetition,” and that a frequency penalty much above 1 pushes the AI toward “strange outputs,” because names and common words get “penalized heavily.” SillyTavern notes that a long penalty range hits common words like “the, a, and” hardest. DeepSeek’s thinking mode ignores frequency and presence penalties. Our guide to fixing repetitive AI replies covers what to do about a loop that has already started, including SillyTavern’s DRY setting.
Where standing instructions go
Chub, SillyTavern, Janitor AI, and NovelAI all have a field for standing instructions about style and format, under names such as system prompt, main prompt, or custom prompt. It is sent with every reply, so it uses context space like the character definition, and where it sits in the text affects how much weight it gets. Chub’s documentation says its System Prompt “is the very first thing sent to the AI.” Its Post History Instructions are “the very last thing sent to the AI,” and Chub notes that “due to the AI’s natural bias towards text that comes near the end this can have major effects.” SillyTavern’s Prompt Manager lets you reorder the parts: “Prompts placed closer to the top of the interface are sent earlier.” Janitor AI groups custom prompts, prefills, and forbidden words under Instructions in its API settings, and its help center counts Advanced Prompts among permanent tokens.
Janitor AI’s settings also include a proxy, which its help center describes as a way to “use external models (like Claude or GPT) inside Janitor,” with the proxy acting as “the middleman between your chat and the model provider.” With a proxy connected, which settings work and what they cost depend on that provider.
Start from the defaults and change one setting at a time
Apps that run their own models tune the defaults for them. Chub says its “Default settings are set based on our own testing,” AI Dungeon says its defaults tested well in its own experiments, and NovelAI ships default presets for each model, “with the majority tuned for creative writing.” If you use an app’s own model and the replies are fine, leave the settings alone. A preset copied from someone else was tuned for their model and their taste, and its numbers may behave differently on yours.
When something does go wrong, test one change at a time. A single reply varies on its own, and settings affect each other, so changing several things after one bad reply tells you little.
- Pick a reply you want to improve, in a chat you don’t mind changing.
- Regenerate it several times at the current settings, to see how much it varies on its own.
- Change one setting by a small step, such as 0.1 for temperature.
- Regenerate the same reply the same number of times and compare.
- Keep the change only if the difference shows up across most of the new replies, and note what you changed.
In Janitor AI, changes apply when you press Save, and the settings page has a button that restores the default values. If a problem stays the same whatever you change, look at the chat and the character definition instead. A stalled scene or a vague definition causes problems that settings don’t fix.
Which settings each app has
Apps expose different settings, and the same app can show different ones depending on the model behind it. As of December 2026, their documentation describes these:
- Janitor AI’s settings for its own models have a Response length choice (Standard or Shorter) and Generation controls with temperature and max tokens. JLLM’s context is set by your plan. With a proxy, Janitor AI says it leaves “more of the advanced stuff (temperature, max tokens, etc) exposed right on the page.”
- SillyTavern documents the longest list: response length, context size, temperature, top-k, top-p, min-p, repetition penalty, and less common samplers such as DRY, XTC, and Mirostat, some of which work only with certain backends.
- Chub lists temperature, presence and frequency penalties, top-k, and top-p for connected models, plus a system prompt and post-history instructions.
- NovelAI has Randomness, Output Length, and Repetition Penalty, samplers including Min-P, Nucleus, and Top-K, default presets for each model, and a Max Context Size slider limited by your subscription.
- AI Dungeon’s Model Settings, open to all players, include Context Length, Response Length, Temperature, Top-K, Top-P, Presence Penalty, and Frequency Penalty. The context length available depends on the membership tier.
- Character.AI lets you pick a Chat Style, which it describes as a way to “choose the best model for your conversations,” and added response length options in 2025. Its help center doesn’t document temperature, context size, or sampler settings.
The same settings under other names
Apps and APIs use different labels for the same few settings. Our glossary of AI roleplay terms covers terms beyond settings.
- Max tokens: Also called max new tokens, response length, Response (tokens) in SillyTavern, and Response Length in AI Dungeon. APIs call it
max_tokensormax_completion_tokens. NovelAI’s Output Length is the same idea measured in characters. - Context size: Also called context length, Context (tokens) in SillyTavern, Context Length in AI Dungeon, and Max Context Size in NovelAI. The model’s own upper limit is its context window.
- Permanent tokens: Janitor AI’s term for the parts sent with every reply, such as the bot’s personality and scenario, chat memory, and your persona.
- Temperature: Called Randomness in NovelAI. A value of 1 leaves the model’s probabilities unchanged.
- Top-p: Also called nucleus sampling. A value of 1 turns it off.
- Repetition penalty: Often shortened to rep pen. A value of 1 turns it off.
- Frequency penalty and presence penalty:
frequency_penaltyandpresence_penaltyin APIs. A value of 0 turns them off. - Preset: A saved set of generation settings.
- System prompt: Standing instructions sent near the start of the context. Chub also calls it pre-history instructions.
- Proxy: In Janitor AI, a connection that sends your chat to another model provider.
Common questions
What is the best temperature for Janitor AI?
Janitor AI’s help center suggests starting at 0.6, raising it by 0.1 if replies feel bland, lowering it if they turn into “word salad,” and keeping it below 1.0. If you connect another model through a proxy, use that provider’s guidance instead, and check whether the model uses temperature at all.
Why does Janitor AI keep cutting off messages?
A reply that stops mid-sentence has usually hit the max tokens limit. Raise it and regenerate. For shorter replies, choose Shorter under Response length instead of lowering max tokens. With a thinking model connected through a proxy, the model’s reasoning also counts toward the limit.
What is a good context size for Janitor AI?
On JLLM your plan sets it: “around 9k tokens” on the free tier and “5x more context” with janitor+. Keeping permanent tokens under the help center’s guideline of about 1,500 leaves more room for the chat. For proxy connections, Janitor AI’s help center doesn’t recommend a number. Use a size the model supports, and keep in mind that on a paid model a larger context costs more per message and isn’t automatically better.
What are tokens in Janitor AI?
Tokens are the small pieces of text the model reads and writes, about three-quarters of a word each. Janitor AI’s help center counts everything in them: permanent tokens for the character’s definition, chat memory, and persona, and temporary tokens for the chat messages.
What temperature should I use with DeepSeek?
DeepSeek’s API documentation sets the default at 1.0 and recommends 1.3 for general conversation and 1.5 for creative writing. Its thinking mode, which is on by default, ignores temperature. If you reach DeepSeek models through another provider, check that provider’s documentation.
What does frequency_penalty do in SillyTavern?
frequency_penalty is the API name for frequency penalty. OpenAI’s API reference says positive values penalize each
token “based on their existing frequency in the text so far,” which lowers the chance of repeating the same line. It
runs from -2.0 to 2.0, and 0 turns it off. presence_penalty is similar but applies once to any token that has
appeared. Raise either in small steps, since high values make the model avoid words it needs, such as names.
Does a higher temperature make the AI more creative?
Only a little. A 2024 study of story generation found temperature “weakly correlated with novelty” and “moderately correlated with incoherence.” Higher values make replies more varied and also more error-prone.
What’s the difference between max tokens and context size?
Max tokens limits how much the model writes in one reply, and context size limits how much text it reads before replying. Both are counted in tokens, and the reply has to fit in the model’s window along with the context.
Memory features exist because of the context limit described above. Long-term memory is one of Lunelle AI’s three focus areas: characters remember events, choices, and how their relationship with you has changed, across sessions. See long-term memory in Lunelle AI.
Related guides
- Why do AI characters forget? (And how to fix it)
- Why AI replies get repetitive or short (and how to fix it)
- How to stop an AI character from speaking for you
- How to write an AI character that stays in character
- AI roleplay terms explained
- All guides
Sources
- OpenAI Help Center, Understanding and counting tokens
- OpenAI API reference, Create chat completion (temperature, top_p, max_completion_tokens, frequency_penalty, presence_penalty, finish_reason), and OpenAI, Using GPT-6
- Anthropic, Claude Platform documentation: Create a Message, Stop reasons and fallback, Context windows, and Migrating to API version 2026-10-21, October 21, 2026
- Google, Gemini API documentation, Understand and count tokens and What’s new in Gemini 3.6 Flash and 3.5 Flash-Lite; Google Developers Blog, New Gemini API updates for Gemini 3, November 25, 2025
- DeepSeek API Docs, The Temperature Parameter and Thinking Mode
- Janitor AI Help Center, Understanding Temperature, Tokens: Your AI’s Memory Budget, Chat Memory & Context Management, The Basics: The Character Creation Page Overview, What is JLLM? And what do all those pesky abbreviations mean?, and FAQ: Subscription - Janitorai+
- Janitor AI, we redesigned the api settings page, July 19, 2026
- SillyTavern documentation, Common Settings, Prompt Manager, and User Settings
- Chub documentation, API Connections
- NovelAI documentation, Slider Settings and Advanced Settings
- AI Dungeon Help, What are AI Model Settings? and What are tokens?
- Character.AI Help Center, Community Update, February 2025 (Chat Styles) and Community Update, March 2025 (response length)
- Holtzman et al., The Curious Case of Neural Text Degeneration, ICLR 2020
- Fan, Lewis, and Dauphin, Hierarchical Neural Story Generation, ACL 2018
- Keskar et al., CTRL: A Conditional Transformer Language Model for Controllable Generation, 2019
- Nguyen et al., Turning Up the Heat: Min-p Sampling for Creative and Coherent LLM Outputs, ICLR 2025
- Schaeffer, Kazdan, and Denisov-Blanch, Min-p, Max Exaggeration: A Critical Analysis of Min-p Sampling in Language Models, 2025
- Peeperkorn et al., Is Temperature the Creativity Parameter of Large Language Models?, ICCC 2024