Problem
max: "abc" flows to JSON.stringify({max_tokens: NaN}) = {"max_tokens": null} sent upstream: non-numeric max degrades silently instead of clamping to the default 140.
Where
src/index.ts (outputMax computation, no finite check).
Acceptance
Add a failing test first posting {prompt, max: "abc"} (and max: {}), asserting the upstream body carries clamped 140, not null. Then fix.
Problem
max: "abc"flows toJSON.stringify({max_tokens: NaN})={"max_tokens": null}sent upstream: non-numeric max degrades silently instead of clamping to the default 140.Where
src/index.ts(outputMaxcomputation, no finite check).Acceptance
Add a failing test first posting
{prompt, max: "abc"}(andmax: {}), asserting the upstream body carries clamped140, notnull. Then fix.