Chat Parameters
Within Open WebUI, there are three levels to setting a System Prompt and Advanced Parameters: per-chat basis, per-model basis, and per-account basis. This hierarchical system allows for flexibility while maintaining structured administration and control.
System Prompt and Advanced Parameters Hierarchy Chart
| Level | Definition | Modification Permissions | Override Capabilities |
|---|---|---|---|
| Per-Chat | System prompt and advanced parameters for a specific chat instance | Users can modify. The system prompt replaces the per-account one, and is sent after the model's system prompt | An advanced parameter set here is the one sent, in place of the per-account and per-model value |
| Per-Account | Default system prompt and advanced parameters for a specific user account | Users can set. A chat's own system prompt replaces this one for that chat | An advanced parameter set here replaces the per-model value, and gives way to a per-chat one |
| Per-Model | Default system prompt and advanced parameters for a specific model | Administrators can set, Users cannot modify | The system prompt is sent first, ahead of the folder, chat or account system prompt, and does not replace them. Advanced parameters apply to every chat that has not set them itself |
How system prompts combine
Open WebUI joins the system prompts of the levels below into a single system message, one part per line, in this order:
- The model's System Prompt, set in Workspace > Models.
- The folder's System Prompt, when the chat is in a folder that has one.
- The chat's System Prompt from Controls. When the chat has none, the account's System Prompt from Settings > General takes its place. The two are never sent together.
Variables such as {{CURRENT_DATE}}, chat variables and user variables are filled in at every level. The order is the same for Ollama and OpenAI-compatible connections. A request to the /api/chat/completions API follows the same order, with the request's own system message in place of the chat or account prompt. A request sent straight to /openai/chat/completions or /ollama/api/chat gets only the model's system prompt, placed in front of any system message the request carries.
1. Per-chat basis:
- Description: The per-chat basis setting refers to the system prompt and advanced parameters configured for a specific chat instance. These settings are only applicable to the current conversation and do not affect future chats.
- How to set: Open the Model controls menu (the knobs icon next to the message input) and expand Controls. It holds the chat's files, valves, system prompt and advanced parameters, and shows for admins and for users with the Allow Chat Controls permission.
- Override capabilities: A System Prompt set here replaces the per-account one (#2) for that chat. It does not replace the model's system prompt (#3), which is still sent ahead of it. An Advanced Parameter set here is the value sent for that chat, even when the model carries one of its own.
Example Use Case
Per-chat basis: Suppose a user wants to set a custom system prompt for a specific conversation. They can do so by opening Model controls > Controls and modifying the System Prompt field. These changes will only apply to the current chat session.
2. Per-account basis:
- Description: The per-account basis setting refers to the default system prompt and advanced parameters configured for a specific user account. Any user-specific changes can serve as a fallback in situations where lower-level settings aren't defined.
- How to set: Users can set their own system prompt and advanced parameters for their account within the General section of the Settings menu in Open WebUI.
- Override capabilities: Users can set their own system prompt on their account. It is sent in every chat whose Controls leave the System Prompt empty, after the model's system prompt when the model has one. An Advanced Parameter set here is sent in place of the model's, and is itself replaced by anything the chat sets in its Controls.
Example Use Case
Per-account basis: Suppose a user wants to set their own system prompt for their account. They can do so by accessing the Settings menu and modifying the System Prompt field.
3. Per-model basis:
- Description: The per-model basis setting refers to the default system prompt and advanced parameters configured for a specific model. These settings are applicable to all chat instances using that model.
- How to set: Administrators can set the default system prompt and advanced parameters for a specific model within the Models section of the Workspace in Open WebUI.
- Override capabilities: User accounts are restricted from modifying the System Prompt or specific Advanced Parameters on a per-model basis (#3). This restriction prevents users from inappropriately altering default settings.
- System prompt preservation: When an Admin sets a model's System Prompt in the Workspace section, it is sent with every chat that uses the model, and a User account cannot remove or edit it from the General settings or a chat's Controls. A system prompt set there is added after the model's, not in place of it.
- Parameter precedence: An Advanced Parameter an Admin sets on the model applies to every chat that does not set that same parameter itself. A User account that sets it in the General settings or in a chat's Controls sends its own value, and the per-chat value wins over the per-account one. A parameter nobody has set at any of those levels falls through to the instance-wide values under Global Model Defaults. This includes the context length: a
num_ctxset in a chat's Controls is the one sent, even for a model that carries its own. Stream Chat Response is the exception: a value set on the model wins, then the chat's, then the account's. - Model controls: When the model has Model controls, the option picked there (or the control's default option) sits above every level: its parameters replace the same ones set in a chat's Controls, the General settings, the model or the Global Model Defaults. The choice is saved per model on the account, so it carries across all chats with that model.
Example Use Case
Per-model basis: Suppose an administrator wants to set a default system prompt for a specific model. They can do so by accessing the Models section and modifying the System Prompt field for the corresponding model. Any chat instances using this model will automatically use the model's system prompt and advanced parameters.
top_k takes whole numberstop_k counts candidate tokens, so it accepts integers from 0 to 1000 and nothing else. Both its slider and its number box step by 1, and typing a fraction, a negative number or any other non-integer leaves the previous value in place instead of accepting it. This applies wherever the parameter is edited, per chat, per account or per model.
Ollama Parameters in Advanced Params
Advanced Params also lists parameters named after Ollama's own options. Each one starts at Default, which sends nothing. Clicking Default switches the row to Custom and fills in the starting value below, which is then sent with every request until you click Custom again.
For a model from an Ollama connection, Open WebUI puts each of these into the request's options under the same name. For a model from an OpenAI-compatible connection, it sends them as top-level fields of the request body under the same name, and the provider decides whether to use or reject them.
| Parameter | Sent to Ollama as | Starting value | Slider range | What it controls |
|---|---|---|---|---|
| mirostat | options.mirostat | 0 | 0 to 2 | Turns on Mirostat sampling (1 or 2), for controlling perplexity. 0 leaves it off. |
| mirostat_eta | options.mirostat_eta | 0.1 | 0 to 1 | How fast Mirostat reacts to the text generated so far. |
| mirostat_tau | options.mirostat_tau | 5 | 0 to 10 | The balance between coherent and diverse output under Mirostat. Lower is more focused. |
| repeat_last_n | options.repeat_last_n | 64 | -1 to 128 | How many recent tokens the repetition penalty looks back over. |
| tfs_z | options.tfs_z | 1 | 0 to 2 | Tail free sampling. 1 leaves it off, higher values cut more low-probability tokens. |
| repeat_penalty | options.repeat_penalty | 1.1 | -2 to 2 | How strongly repeated tokens are penalized. 1 leaves it off. |
| use_mmap | options.use_mmap | Enabled | on or off | Whether the model file is memory-mapped when loaded. |
| use_mlock | options.use_mlock | Enabled | on or off | Whether the model's memory is locked in RAM so it is not swapped to disk. |
| num_keep (Ollama) | options.num_keep | 24 | -1 to 10240000 | How many tokens are kept when the context is refreshed. |
| num_batch (Ollama) | options.num_batch | 512 | 256 to 8192 | How many tokens are processed together per batch. Higher needs more memory. |
| num_gpu (Ollama) | options.num_gpu | 0 | 0 to 256 | How many model layers are offloaded to the GPU. |
For what each option does on your Ollama version, see Ollama's Modelfile parameters and the "Generate request (With options)" example in its API reference. Neither page lists every option above.
use_mmap, use_mlock, num_thread (Ollama), num_gpu (Ollama) and keep_alive (Ollama) appear in Settings > General and in a chat's Controls only for admin accounts. The model editor in Workspace > Models and the admin Global Model Defaults always show them. A value set at any level follows the parameter precedence described above.
Optimize System Prompt Settings for Maximum Flexibility
Bonus Tips This tip applies for both administrators and user accounts. To achieve maximum flexibility with your system prompts, we recommend considering the following setup:
-
Assign your primary System Prompt (i.e., to give an LLM a defining character) you want to use in your General settings System Prompt field. This sets it on a per-account level and allows it to work as the system prompt across all your LLMs without requiring adjustments within a model from the Workspace section.
-
For your secondary System Prompt (i.e, to give an LLM a task to perform), choose whether to place it in the System Prompt field under Model controls > Controls (on a per-chat basis) or the Models section of the Workspace section (on a per-model basis) for Admins, allowing you to set them directly. Your account-level system prompt works together with a per-model system prompt, since both are sent. A per-chat system prompt in Controls replaces the account-level one for that chat.
-
As an administrator, you should assign your LLM parameters on a per-model basis using Models section for optimal flexibility. For both of these secondary System Prompts, ensure to set them in a manner that maximizes flexibility and minimizes required adjustments across different per-account or per-chat instances. It is essential for both your Admin account as well as all User accounts to understand the priority order by which system prompts within Controls and the Models section will be applied to the LLM.
Open WebUI sends a system prompt, whether it comes from the chat, your account, a folder or the model, as a system message at the start of the conversation. Some models have a chat template that accepts only alternating user and assistant turns, and the model server rejects the request with an error such as Conversation roles must alternate user/assistant. Use a model or chat template that accepts a system role, or clear the system prompt at every level for that model. Features that add their own instructions to the system message, such as voice mode, skills and the code interpreter, trigger the same error with such a model.
Chat Variables
Chat variables turn a model's system prompt into a short form. An administrator writes placeholders into the system prompt, and Open WebUI asks whoever opens a chat with that model to fill them in. The answers are saved on that chat and reused for every message in it.
Declare one in a model's system prompt:
{{chat.variables.key_name}}That produces a single-line text field. Add a definition after the pipe for a typed field:
{{chat.variables.project_name | text:placeholder="Which project?":required}}
{{chat.variables.tone | select:options=["Formal","Casual"]:default="Formal"}}The grammar and the available field types are the same ones used by prompt input variables. Keys must be lowercase snake case: start with a letter, then letters, digits, or underscores.
chat.variables. prefix is requiredOnly a placeholder carrying the full chat.variables. prefix declares a chat variable. A bare {{project_name | text:required}} is the prompt input variable syntax, which works in prompt content and does nothing in a system prompt.
Writing one in a system prompt declares no variable at all: no control appears next to the chat input, no form ever opens, and the placeholder itself is sent to the model as literal text. Nothing warns you, so the model looks like it simply ignored the feature.
The check is the Detected Variables list in the model editor. It updates as you type, and a placeholder missing the prefix never shows up in it.
Filling them in
When a selected model declares chat variables, a control appears next to the chat input and opens the Chat Variables form. Selecting the model does not open it: nothing is shown until you either press that control or try to send a message. The values can be changed from the same control later, and take effect for messages sent after the change.
Sending a message opens the form instead of sending only when there is nothing usable to send with, which means one of:
- a
requiredfield has neither a value nor adefault, or - every field is without a value and without a
default.
Otherwise the message goes straight to the model and any unfilled variable is substituted as an empty string.
required and defaultThe form is an input gate rather than a confirmation step, so it only interrupts when the chat cannot sensibly proceed without an answer. A field carrying a default already has one, which is why a model whose variables all have defaults starts the chat immediately.
That also means one default is enough to stop the form appearing for the other optional fields alongside it. They stay reachable from the control next to the chat input, they are just not asked for.
So: mark a field required when the answer has to come from the user, and give a default when you are happy for the chat to start without asking.
Values are stored on the chat, so reopening it keeps them, and forking or cloning your own chat carries them over. A copy of someone else's chat starts with empty chat variables. In temporary chats they travel with each request and last only as long as the chat does.
A single value can be up to 20,000 characters, and all of a chat's variables together up to 100,000 characters.
Values are validated against the current definitions when the prompt is assembled, and if any of them fails, every chat variable in that prompt renders empty rather than just the offending one. Removing an option from a select therefore silently blanks the whole set for chats that were storing the removed value, so re-open affected chats and re-fill the form after changing a definition.
Several models in one chat
Selecting more than one model merges their variables. Identical definitions collapse into one field, which is required if any of the models marks it required. If two selected models define the same key differently, sending is blocked and the conflicting keys are listed along with the models that define them, so deselect one of them or make the definitions match.
Authoring checks
The model editor lists what it found under Detected Variables, split into Chat Variables and User Variables. It warns about a key that is not lowercase snake case, a select with no options=[...], the same key defined two different ways, and a user variable given a definition, since those are configured by each user and a definition has no effect on them.
User Variables
User variables let one shared system prompt produce a different result for each person using it. An administrator writes a placeholder into a model's system prompt, and every user fills in their own value.
Each user manages their own values under Settings > Account > User Variables, as a list of key and value pairs. Reference them in a system prompt with:
{{user.variables.key_name}}At request time each placeholder is replaced with that user's value for the key. A key the user has not set is replaced with an empty string, so the prompt never shows the raw placeholder.
For example, a single shared model can carry Address the user as {{user.variables.preferred_name}} and answer in {{user.variables.language}}. and behave correctly for everyone, without an administrator maintaining a model per person.
Rules for keys and values
- Keys must be lowercase snake case: start with a letter, then letters, digits, or underscores (
preferred_name,team2). Keys that do not match are rejected. - Values are plain text. A single value can be up to 20,000 characters, and all of a user's variables together up to 100,000 characters.
- Values are stored per user and are only ever substituted into that user's own requests.
Values are personal, so treat them as user-supplied text rather than a place for secrets: anything put in a variable is inserted into the prompt sent to the model configured for that chat.
User variables or chat variables?
Both are written into a model's system prompt and both are filled in by users rather than administrators. The difference is who is asked and how long the answer lasts.
| Chat variables | User variables | |
|---|---|---|
| Written as | {{chat.variables.key}} | {{user.variables.key}} |
| Who fills them in | whoever opens the chat, in a form | each user, once, in Settings > Account |
| How long they last | that one conversation | every request that user sends |
| Field types | typed, defined after the pipe | plain text only |
| When they are asked for | when the chat starts | never, they are set ahead of time |
Definitions after the pipe only apply to chat variables. Writing one on a user variable has no effect, and the model editor flags it, since each user configures their own value in settings rather than being prompted for it.