Skip to main content
Prompt Management catalog policies reshape the LLM request body on pre_request. Create them under PoliciesCatalog, or attach them from a consumer Policies tab. Scope each policy gateway-wide or targeted. Protocol: LLM only. To restrict which models a consumer may call, use the consumer Routing tab (Filter by available models / default model) — not a catalog policy. See Model resolution.

Prompt Template

prompt_template runs at pre_request and rewrites the chat body using Mustache-style {{placeholders}} (v1 engine: mustache only). The console form has two modes. The UI edits one mode at a time; config for the other mode is preserved if you switch. You must configure at least one inject template or one named template (backend validation).

Configure in the console

  1. PoliciesCatalogPrompt Template.
  2. Choose Mode: Auto-inject or Named templates.
  3. Add templates (details below).
  4. Set If a variable is missing (Reject request / Use empty string).
  5. Optionally open Advanced Settings (escape JSON control characters).
  6. Set mode (Enforce / Observe) and scope, then save.

Mode A — Auto-inject

Gateway renders each inject template from context variables and writes a system message into the request. Placeholders must match {{name}} where name is letters, digits, ., -, or _ (e.g. {{user_id}}, {{tenant.name}}). Context variables (context_variables) map placeholder names to request data: The console does not yet expose a full context-variable editor; values configured via API or existing policies are preserved. When a placeholder cannot be resolved: The shared UI control writes the same choice to both on_missing_context_variable and on_missing_client_variable (client supports error / empty_string only).

Mode B — Named templates

Clients reference a template in a plain string user message (not multimodal content parts):
or, if a default label is set on the policy:
Resolution rules
  1. Scan user message string content for {template://name} or {template://name@label}.
  2. Exactly one distinct reference per request (repeats of the same ref are OK for multi-turn).
  3. Resolve name → template, then label (or default label) → version.
  4. Render placeholders from client variables (request properties / template vars) and context variables.
  5. Replace the entire messages array with the rendered content (not a single-message patch). Multi-turn history sent by the client is discarded when rendering succeeds.
Optional per-version required_variables (type / enum / max_length) can be set via API; the console preserves them if present.

Advanced

Example (auto-inject)

Example (named template client call)


Prompt Compression

prompt_compression shrinks the request prompt on pre_request before the model runs. Transforms are deterministic (same input → same bytes) so provider prompt-cache prefixes stay stable, and the plugin fails open: any decode/transform error leaves the original body unchanged. The console uses the catalog settings schema form (booleans, integers, role multi-select).

Configure in the console

  1. PoliciesCatalogPrompt Compression.
  2. Enable at least one transform (defaults are all on).
  3. Tune thresholds and optional target roles.
  4. Set mode and scope, then save.

Settings

At least one of compress JSON / normalize whitespace / strip ANSI must stay enabled.

Example