Cap OpenRouter max_tokens — some models default to their full context window
build-agent / build-and-push (push) Successful in 11s

This commit is contained in:
2026-08-23 14:45:19 +00:00
parent 77ce4a7334
commit d7a881c768
+4
View File
@@ -15,6 +15,10 @@ export async function askOpenRouter(model, prompt) {
body: JSON.stringify({
model: model || DEFAULT_MODEL,
messages: [{ role: "user", content: prompt }],
// Some models default max_tokens to their full context window (e.g. 65536),
// which can exceed available credit balance before a single token is generated.
// This is a quick chat reply, not a long-form task — cap it.
max_tokens: 1024,
}),
});