Repository navigation
v3.35.0
Agent
Optional max_tokens, and a clear stop at the output limit (#399, closes #387).
-
New setting:
max_tokens, set per model or app-wide, withnullon a model to opt it out. No default: nothing changes until an app sets it. A numeric string from a generatedconfig.jsonis accepted."llm_models": [{ "value": "anthropic/claude-sonnet-5", "max_tokens": 8192 }]
It bounds runaway generations (proxy logs show responses running 30+ minutes to a 131k-token ceiling, open-llm-proxy#150) and stops OpenRouter reserving credit for a model's whole output ceiling, which caused 402s on small balances (#386).
-
Responses that hit the limit: this applies to the app's cap, or the model's own ceiling when none is set.
- A cut-off text answer is shown with a note.
- No tool call from a cut-off response runs, since its arguments may be half-written.
- A response where reasoning spent the budget ends with a clear error.
Detection uses
finish_reason, OpenRouter'snative_finish_reason, and whether the completion count reached the cap. GLM-5.2 reports a cut-off tool call astool_calls, whichfinish_reasonalone would miss.
See "Capping response length" in the configuration guide.
Upgrading
No required config changes; bump the pin to @v3.35.0. To use the cap, add max_tokens to a model or to the top-level config.