github Lexus2016/claude-flow v2.0.1
v2.0.1 — max_tokens clamping

latest releases: v2.1.1, v2.1.0
one month ago

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: new maxOutputTokens field per provider (DeepSeek: 8192)
  • sanitizeRequestBody() now accepts opts.maxOutputTokens for clamping
  • OpenRouter has no cap (OpenRouter handles limits internally)
  • No clamping when value is already under the limit
  • Backward compatible — opts parameter is optional

Tests

118 tests (99 unit + 19 integration), all passing.

Full Changelog: v2.0.0...v2.0.1

Don't miss a new claude-flow release

NewReleases is sending notifications on new releases.