mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 17:08:33 +08:00
For OpenAI-compatible API-key accounts, /v1/responses requests with image-generation intent could be scheduled to accounts whose upstream does not support the Responses API (extra.openai_responses_supported=false). The flag was only consulted at forward time, where such accounts are silently downgraded to a Chat-Completions path that cannot produce images, causing upstream 4xx/5xx or canceled requests. Fix: - Add endpoint capability OpenAIEndpointCapabilityResponses. Its check in SupportsOpenAIEndpointCapability excludes only OpenAI API-key accounts probed as unsupported (mirroring the forward-time downgrade condition); OAuth/Grok/unprobed accounts keep existing behavior, and a responses- capable upstream must still pass the chat_completions gate. Reusing the existing requiredCapability plumbing makes every scheduler filter path enforce it with no scheduler signature changes. - Request the responses capability at the HTTP Responses and ResponsesWebSocket call sites only when imageIntent && platform==openai, so non-image requests keep the downgrade path and Grok's own image path is untouched. - Normalize max_tokens -> max_output_tokens on the native responses forward path (PlatformOpenAI), and strip prompt_cache_options alongside prompt_cache_retention/safety_identifier. /v1/images/generations continues to use native image capability (unchanged). Tests: capability truth table, scheduler exclusion of unsupported accounts, and forward-path transform behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KXpzKKvsb5jW2GvgBQqnnZ