mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-16 23:53:33 +08:00
Anthropic gates newer models on a minimum Claude Code client version. With CLICurrentVersion pinned at 2.1.220, claude-fable-5-1 fails every request with "Claude Code 2.1.220 does not support this model; version 2.1.251 or newer is required", and the only fix is a release that bumps one constant. Add SUB2API_CLAUDE_CLI_VERSION, mirroring what internal/pkg/xai already does with XAI_GROK_CLI_VERSION. CLICurrentVersion remains the built-in pin; the new CLIVersion() is what every consumer reads. With no env var set the resolved value equals the pin, so existing deployments are unaffected. The value is resolved once at package init rather than per call: the User-Agent header and the request body's cc_version are written by different code paths for the same request, and reading different values would make that request contradict itself. Validation is strict (three numeric segments, not below the pin) because identity_service.go documents what a malformed version does once it reaches an account's persistent fingerprint: sustained 429s without reset headers, 5s fallback cooldown, pool collapse into a 503 storm, and no reset entry point. Invalid values warn and fall back rather than being silently dropped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0168uDMAj9anaJrnH8CeFze6