mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 20:12:39 +08:00
The claude_code_only probe exemption only fired for models containing "haiku". Claude Code also sends max_tokens=1 requests without a system prompt to the model currently in use, e.g. when switching models or refreshing the context usage, so on sonnet/opus groups those requests failed the system-prompt check and were rejected as non-Claude-Code clients. Recognise the probe from the request body itself (max_tokens == 1) once the User-Agent check has passed, regardless of model, and carry max_tokens into the ParsedRequest projection so the hot path sees it too. The haiku context flag and the local haiku interception are unchanged; non-haiku probes reach the pool as ordinary one-token requests. One output token offers nothing to a client that already forges the CLI User-Agent, so this widens no attack surface. Fixes #6591