From d7a881c768f46279bcd77880dbd972b6840f654a Mon Sep 17 00:00:00 2001 From: William Turner Date: Sun, 23 Aug 2026 14:45:19 +0000 Subject: [PATCH] =?UTF-8?q?Cap=20OpenRouter=20max=5Ftokens=20=E2=80=94=20s?= =?UTF-8?q?ome=20models=20default=20to=20their=20full=20context=20window?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/src/openrouter.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/agent/src/openrouter.js b/agent/src/openrouter.js index 56ae82c..ee7c21f 100644 --- a/agent/src/openrouter.js +++ b/agent/src/openrouter.js @@ -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, }), });