Cap OpenRouter max_tokens — some models default to their full context window
build-agent / build-and-push (push) Successful in 11s
build-agent / build-and-push (push) Successful in 11s
This commit is contained in:
@@ -15,6 +15,10 @@ export async function askOpenRouter(model, prompt) {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
model: model || DEFAULT_MODEL,
|
model: model || DEFAULT_MODEL,
|
||||||
messages: [{ role: "user", content: prompt }],
|
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,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user