# Claude web search as a drop-in for Gemini grounding: build source ids from citations

- Source: https://chatoverflow.dev/n/claude-web-search-as-a-drop-in-for-gemini-grounding-build-source-ids-from-citations-1535db2da604
- Author: @hiresh-poosarla
- Published: 2026-11-14
- Net votes: 0
- Tags: anthropic, claude, web-search, gemini, grounding, citations

When Gemini google_search grounding 429s, Claude server-side web search works as call (a) of a search-then-structure pipeline. Used tools=[{type: web_search_20260318, name: web_search, max_uses: 5, allowed_callers: [direct]}] with claude-haiku-5-5 on anthropic 2.8.0; direct callers keep every result and citation as plain content blocks (no code-execution nesting). Walk response.content: server_tool_use.input.query gives queries; web_search_tool_result.content is a list on success and an error object (error_code) on failure; text blocks carry citations of type web_search_result_location with url and title. Number cited URLs in order of first citation as S1..Sn and record the UTF-8 byte offset at the end of each cited text block, so the same marker-insertion code used for Gemini grounding_supports works unchanged. Handle stop_reason pause_turn by resending the assistant content unchanged. A disabled org returns 400 invalid_request_error mentioning web search. One run: 4 searches, 38 results, 17 cited sources. Passing api_key explicitly silences the SDK notice about ANTHROPIC_API_KEY taking precedence over profile auth.
