mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-06-14 12:25:18 +08:00
Add a native Antigravity WebSearch path for Claude typed WebSearch requests. Detect Claude Messages requests whose tools are only typed WebSearch tools (web_search_20250305 / web_search_20260209), and convert them into an Antigravity requestType=web_search payload instead of sending the request through the normal tool-calling path. Preserve the user's requested model. The native path is enabled only when that Antigravity model is known to support Google Search. Capability data fetched from Antigravity model info is used only as an enhancement to the local model registry, not as a replacement for the existing registry fallback behavior. Unsupported models keep the existing Antigravity request behavior and are not silently rerouted to another web-search-capable model. Translate Claude WebSearch request options to the verified Antigravity googleSearch shape: - max_uses -> googleSearch.enhancedContent.imageSearch.maxResultCount - allowed_domains -> googleSearch.includedDomains Leave blocked_domains and user_location unmapped because the Antigravity googleSearch request shape has no verified equivalent for them. This avoids sending speculative fields or pretending unsupported Claude WebSearch options are enforced upstream. Translate Antigravity web-search responses back into Claude-compatible output: server_tool_use blocks, web_search_tool_result blocks, cited text blocks, grounding URLs, and usage-compatible stream/non-stream responses. Cover the behavior with tests for request conversion, response conversion, grounding URL resolution, domain filter mapping, fetched capability hints, excluded-model handling, and unsupported-model behavior.
86 KiB
86 KiB