pi-mono/packages
David Brailovsky 0a4fad5489
fix(ai): leave room for OpenRouter's input overcount when clamping max tokens (#11712)
OpenRouter checks input + max_tokens against the context window before
routing, using its own tokenizer. For prose it counted up to 12% more
input tokens than the provider. pi left only 4096 tokens spare, so
models whose output limit is close to the window (e.g. DeepSeek flash)
were rejected with a 400, which pi then treated as a context overflow
and compacted.

The default output limit now leaves 15% of the estimated input unused
(at least 4096). When that would leave less than 32768 tokens of output,
only the fixed 4096 margin is kept and output is capped at 32768.

fixes #10497
2026-11-02 22:43:27 +01:00
..
agent Add [Unreleased] section for next cycle 2026-11-02 11:38:21 +01:00
ai fix(ai): leave room for OpenRouter's input overcount when clamping max tokens (#11712) 2026-11-02 22:43:27 +01:00
chord docs(chord): Chord v2 becomes the package's root 2026-11-02 21:40:16 +00:00
codemode Add [Unreleased] section for next cycle 2026-11-02 11:38:21 +01:00
coding-agent fix(coding-agent): only report packages as up to date when pi update checked them (#11711) 2026-11-02 21:49:07 +01:00
durable Add [Unreleased] section for next cycle 2026-11-02 11:38:21 +01:00
env Add [Unreleased] section for next cycle 2026-11-02 11:38:21 +01:00
evals Release v1.5.0 2026-11-02 11:38:21 +01:00
mcp Add [Unreleased] section for next cycle 2026-11-02 11:38:21 +01:00
schema Add [Unreleased] section for next cycle 2026-11-02 11:38:21 +01:00
telemetry Add [Unreleased] section for next cycle 2026-11-02 11:38:21 +01:00
tui Add [Unreleased] section for next cycle 2026-11-02 11:38:21 +01:00