mirror of
https://github.com/open-webui/computer.git
synced 2026-11-05 01:17:24 +00:00
[GH-ISSUE #287] feat: template variables in request params, e.g. session_id = $CHAT_ID #200
Labels
No labels
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-webui/computer#200
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Classic298 on GitHub (Sep 20, 2026).
Original GitHub issue: https://github.com/open-webui/computer/issues/287
What happens
Model-specific request params (Settings → model → request params) merge into the API request body as-is, static values only. That works for things like
providerrouting, which is what the field is used for in practice.What's missing is any way to reference per-request context. Concretely: on OpenRouter,
session_idin the body pins prompt-cache affinity per conversation (it's also the key OpenRouter derives Z.AI cache affinity from, and the fallback when the OpenAI-styleprompt_cache_keyis sent instead). Sending it is only useful if the value differs per chat — a static one glues all chats to one cache session.So today there is no way to tell OpenRouter "this request belongs to chat X" even though the chat id is right there in the request loop.
Suggested change
Template variables in request-param values, resolved at request time:
$CHAT_IDis enough to cover the cache-affinity case on OpenRouter (andprompt_cache_keyfor OpenAI-compatible endpoints with the same mechanism). The chat id is available where params are merged in the request loop, so this is a small substitution at merge time, not new plumbing.Bonus, same mechanism:
$MODEL_ID,$WORKSPACEif there's ever a need.