Introduction
Merge Gateway is an LLM gateway. You send requests to one endpoint and it routes them to OpenAI, Anthropic, Google, and other model vendors, with routing policies, budgets, and zero data retention handled on the Gateway side. Gateway includes a hosted web search tool,merge:web_search. When you add it to a request, the model can search the web mid-request and cite the pages it used. Tavily is one of the engines that can run those searches. Set the engine to tavily and Gateway calls Tavily Search on the model’s behalf, passes the results back to the model, and returns the answer with URL citations.
You don’t need a Tavily account for this. Searches run on Merge-managed credentials and are billed through your Merge account.
Prerequisites
- A Merge Gateway API key from the Merge Gateway dashboard.
Set up Tavily in Merge Gateway
1
Add the web search tool and select Tavily
Add The tool also works through the OpenAI SDK and Vercel AI SDK when they’re pointed at Gateway. See Merge Gateway: Get started for the base URLs.
merge:web_search to the request’s tools and set engine to tavily. The rest of your request stays the same.engine defaults to auto, which uses Merge’s own engine order. Set "engine": "tavily" explicitly to run Tavily.2
Read the results
The model’s answer includes one
url_citation annotation per source, and usage.server_tool_use reports how many searches ran and how many results came back.Configure Tavily searches
Set these in the tool’sparameters object:
To require at least one search, set the request’s
tool_choice to {"type": "merge:web_search"}.
Best practices
- Pin the engine on every request. With
engineleft atauto, Gateway picks the engine for you. Add"engine": "tavily"to each request where you want Tavily results. - Scope searches with domain filters. Use
allowed_domainsto keep results within sources you trust, such as official documentation or regulatory sites, andexcluded_domainsto drop sources you don’t want. - Choose the search depth deliberately. The default runs Tavily basic search, which is enough for lookups such as release notes or a current price. Set
search_context_sizetohighwhen the model needs more of each page, for example to compare several sources or quote specific details.highruns Tavily advanced search and returns more content from each result.