diff --git a/stacks/gateway-chat/conf/index.html b/stacks/gateway-chat/conf/index.html
index df7ae53..75c386f 100644
--- a/stacks/gateway-chat/conf/index.html
+++ b/stacks/gateway-chat/conf/index.html
@@ -249,7 +249,12 @@ async function send(){
model: $('model').value.trim() || 'gen',
messages,
temperature: parseFloat($('temp').value),
- max_tokens: parseInt($('max').value, 10),
+ // Guarded: an empty or non-numeric field makes parseInt return NaN, and
+ // JSON.stringify serialises NaN as `null` -- which the server reads as
+ // "no max_tokens supplied" and silently substitutes its own default.
+ // That is indistinguishable from the field being ignored. Fall back to the
+ // same 4096 the input defaults to.
+ max_tokens: parseInt($('max').value, 10) || 4096,
stream: true
// intentionally NO `tools` — vLLM 400s on an empty array.
};