Problem
max: "abc" flows through Math.max/Math.min to NaN, serialized as max_tokens: null upstream.
Where
app/api/ai/route.ts (outputMax computation, no finite check).
Acceptance
Add a failing route test first asserting numeric max_tokens for max: "abc". Then coerce/validate max.
Problem
max: "abc"flows throughMath.max/Math.mintoNaN, serialized asmax_tokens: nullupstream.Where
app/api/ai/route.ts(outputMaxcomputation, no finite check).Acceptance
Add a failing route test first asserting numeric
max_tokensformax: "abc". Then coerce/validatemax.