What's New
Provider-specific max_tokens clamping — prevents request failures on providers with hard output token limits.
The Problem
Claude Code sends max_tokens: 16384+ by default (Anthropic's limit). DeepSeek's native API rejects any request with max_tokens > 8192, causing silent failures.
The Fix
The proxy now automatically clamps max_tokens to the provider's hard limit before forwarding:
Claude Code sends: max_tokens: 16384
Proxy clamps to: max_tokens: 8192 (DeepSeek limit)
Upstream receives: max_tokens: 8192 ✓
Details
providers.js: newmaxOutputTokensfield per provider (DeepSeek: 8192)sanitizeRequestBody()now acceptsopts.maxOutputTokensfor clamping- OpenRouter has no cap (OpenRouter handles limits internally)
- No clamping when value is already under the limit
- Backward compatible —
optsparameter is optional
Tests
118 tests (99 unit + 19 integration), all passing.
Full Changelog: v2.0.0...v2.0.1