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

openwebui_chat_config (Resource)

Manages context compaction for chats in Open WebUI. Compaction summarises an older part of a conversation once it grows past a token threshold.

Do not write these settings through openwebui_config_import as well. That path writes the stored keys directly and skips the bounds Open WebUI applies here, so the two would overwrite each other.

Example Usage

# Compaction summarises the older part of a conversation once it passes the
# token threshold. Open WebUI clamps the retention percentage to between 10 and
# 50, and treats an unset cap as the threshold.
resource "openwebui_chat_config" "example" {
  enable_context_compaction               = true
  context_compaction_model                = ""
  context_compaction_token_threshold      = 80000
  context_compaction_token_cap            = 120000
  context_compaction_retention_percentage = 40
  context_compaction_prompt_template      = ""
}

Schema

Required

  • context_compaction_prompt_template (String) Prompt template that produces the summary.
  • context_compaction_token_threshold (Number) Token count at which a conversation is compacted. Open WebUI raises a lower value to 1.
  • enable_context_compaction (Boolean) Whether Open WebUI compacts a conversation once it passes the token threshold.

Optional

  • context_compaction_model (String) Model that writes the summary. An empty value uses the chat's own model.
  • context_compaction_retention_percentage (Number) Percentage of the conversation kept verbatim after compaction. Open WebUI clamps this to between 10 and 50.
  • context_compaction_token_cap (Number) Upper bound on the tokens a compacted conversation keeps. Open WebUI stores the threshold when this is unset, so it never reads back as null.

Read-Only

  • id (String) Identifier of this singleton resource. Always chat.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# Open WebUI holds one chat configuration, so this resource is a singleton.
# Import it under its fixed id.
terraform import openwebui_chat_config.example chat