Skip to main content
Give any AI SDK model live web search. The model asks for a search, execute calls Stophy, and the model answers from the results.

The search tool

Save this as stophy.ts. When execute calls it, it returns the top 5 web results as JSON.
stophy.ts

Give it to the AI SDK

Set OPENAI_API_KEY in your environment, and STOPHY_API_KEY to go past the free limits. Wrap the search in tool(). stopWhen lets the model search, read the results and answer in up to five steps. Any AI SDK model works, so swap openai(...) for another provider.