Skip to main content

Setup

Set OPENAI_API_KEY in your environment. STOPHY_API_KEY is optional for this example.

The Stophy tool

This function calls web search and returns the results as markdown, which is short and easy for a model to read. It reads your key from STOPHY_API_KEY.
stophy.ts

Use it as a tool

Pass the function as a tool to the Responses API. When the model calls it, run the search and send the result back.