1 Resources model
Forgejo Actions edited this page 2026-11-26 06:34:52 +00:00

openwebui_model (Resource)

Manages a custom model definition in Open WebUI. A model overlays an existing backend model (set via base_model_id) with custom parameters, capabilities, and access controls.

Example Usage

resource "openwebui_model" "example" {
  model_id      = "custom-rag"
  name          = "Custom RAG Model"
  base_model_id = "llama3.2"
  is_active     = true
  description   = "RAG-tuned model for the internal knowledge base"

  read_groups  = ["Support"]
  write_groups = ["Support"]

  # A grant can also name one account. Write the mail address the account signs
  # in with, or its user ID.
  read_users = ["contractor@example.com"]

  # Skills the model loads with every conversation, by skill_id.
  skill_ids = ["code-review"]

  params = {
    temperature = 0.1
    num_ctx     = 4096
  }

  capabilities = {
    vision     = false
    web_search = true
  }
}

Schema

Required

  • model_id (String) Unique identifier for the model, e.g. custom-rag.
  • name (String) Display name shown in the Open WebUI interface.
  • params (Attributes) Model parameter overrides. The block is required, and every attribute inside it is optional, so a model that changes no parameter writes params = {}. A parameter left out keeps whatever the base model uses. (see below for nested schema)

Optional

  • base_model_id (String) Identifier of the underlying model to use as a base, e.g. llama3.2 or gpt-4o.
  • capabilities (Attributes) Feature capability toggles for this model. (see below for nested schema)
  • default_feature_ids (List of String) List of feature IDs enabled by default, e.g. ["web_search"].
  • description (String) Short description shown alongside the model name.
  • hidden (Boolean) When true, the model is hidden from the model selector list in the UI but remains usable via the API. It is not the same as is_active. A hidden model is still active.
  • is_active (Boolean) Whether the model is visible and available to users. Defaults to false.
  • knowledge_ids (List of String) List of knowledge base IDs attached to the model. Open WebUI stores a copy of each knowledge base under meta.knowledge; the provider resolves the IDs on write and reports only the IDs on read. Knowledge entries attached in the web UI that name a single file or note are not represented here, and setting this attribute replaces them.
  • meta_additional_json (String) Additional metadata JSON merged into the model's meta object. e.g. jsonencode({ info = "custom" }). Two keys never appear here: knowledge, which knowledge_ids manages, and chat_variables_schema, which Open WebUI derives from the system prompt on every read.
  • params_additional_json (String) Additional model parameters JSON merged into params, for fields not covered by the params block. e.g. jsonencode({ top_p = 0.9 }).
  • profile_image_url (String) URL of the model's profile image. Open WebUI accepts an empty string, /user.png, /favicon.png, /static/favicon.png, /api/v1/users/{id}/profile/image, an http(s) URL with a host, or a data:image/{png,jpeg,gif,webp};base64, URI. It drops anything else without an error.
  • public_read (Boolean) Whether every signed-in user can read the model. This is what the web UI calls public sharing.
  • public_write (Boolean) Whether every signed-in user can edit the model.
  • read_groups (List of String) List of group names or IDs granted read access. With no groups, no users, and neither public_read nor public_write, the model is visible to its owner and to admins only.
  • read_users (List of String) List of user email addresses or IDs granted read access.
  • skill_ids (List of String) List of skill IDs to attach to the model by default.
  • suggestion_prompts (List of String) List of suggested starter prompts shown when the model is selected.
  • tags (List of String) List of tags for categorising the model.
  • tool_ids (List of String) List of tool IDs to attach to the model by default.
  • write_groups (List of String) List of group names or IDs granted write access.
  • write_users (List of String) List of user email addresses or IDs granted write access. Name the same address in read_users as well.

Read-Only

  • created_at (Number) Unix timestamp of when the model was created. Set by Open WebUI.
  • id (String) Terraform identifier. Always equal to model_id.
  • updated_at (Number) Unix timestamp of when the model was last updated. Set by Open WebUI.
  • user_id (String) Owner user identifier. Set by Open WebUI.

Nested Schema for params

Optional:

  • custom_params (Map of String) Additional key/value parameters passed through to Open WebUI.
  • format (String) Output format, e.g. json.
  • frequency_penalty (Number) Penalty scaled by token frequency.
  • function_calling (String) Function calling mode, e.g. "auto".
  • keep_alive (String) How long to keep the model loaded in memory, e.g. "5m".
  • max_tokens (Number) Maximum number of tokens to generate.
  • min_p (Number) Minimum probability threshold for token sampling.
  • mirostat (Number) Mirostat sampling mode: 0 = disabled, 1 = Mirostat, 2 = Mirostat 2.0.
  • mirostat_eta (Number) Mirostat learning rate. It sets how fast the sampler reacts to the generated text.
  • mirostat_tau (Number) Mirostat target entropy. A lower value makes the output more focused.
  • num_batch (Number) Batch size for prompt processing.
  • num_ctx (Number) Context window size in tokens.
  • num_gpu (Number) Number of GPU layers to use.
  • num_keep (Number) Number of tokens to retain from the previous context.
  • num_thread (Number) Number of CPU threads to use for inference.
  • presence_penalty (Number) Penalty for tokens that have appeared at all.
  • reasoning_effort (String) Reasoning effort level for models that support it, e.g. "high".
  • reasoning_tags (List of String) List of XML tags used to delimit reasoning tokens.
  • repeat_last_n (Number) Number of tokens to look back for repeat penalty.
  • repeat_penalty (Number) Penalty applied to repeated tokens.
  • seed (Number) Random seed for reproducible outputs.
  • stream_delta_chunk_size (Number) Chunk size in tokens for streaming responses.
  • stream_response (Boolean) Whether to stream the response. Defaults to the base model setting.
  • system (String) System prompt prepended to every conversation.
  • temperature (Number) Sampling temperature, 0 to 2. Lower values are more deterministic.
  • tfs_z (Number) Tail free sampling z parameter.
  • think (Boolean) Whether to enable chain-of-thought reasoning.
  • top_k (Number) Top-k sampling: number of highest-probability tokens to consider.
  • top_p (Number) Nucleus sampling probability threshold.
  • use_mlock (Boolean) Whether to lock model weights in RAM.
  • use_mmap (Boolean) Whether to use memory-mapped files for model weights.

Nested Schema for capabilities

Optional:

  • builtin_tools (Boolean) Whether Open WebUI's built-in tools are offered to the model. Defaults to true.
  • citations (Boolean) Whether the model returns citations.
  • code_interpreter (Boolean) Whether code interpreter is available.
  • file_context (Boolean) Whether uploaded files go into the prompt as context. When false, the model reaches them through the file search tool instead. Defaults to true.
  • file_upload (Boolean) Whether file uploads are allowed in chat.
  • image_generation (Boolean) Whether image generation is available.
  • memory (Boolean) Whether the model reads and writes user memories. Defaults to true.
  • status_updates (Boolean) Whether the model emits status update messages.
  • terminal (Boolean) Whether the model can run terminal commands. Defaults to true.
  • usage (Boolean) Whether token usage statistics are returned.
  • vision (Boolean) Whether the model accepts image inputs.
  • web_search (Boolean) Whether web search is available.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# A model is imported by its model_id, the identifier the API and the model
# picker use.
terraform import openwebui_model.example custom-rag