Hyperbrowser integrates seamlessly with OpenAI and Anthropic’s function calling APIs, enabling you to enhance your AI applications with web scraping and crawling capabilities. This guide shows how to set up and use Hyperbrowser’s scrape, crawl, and extract tools with OpenAI (and Anthropic-compatible definitions).Documentation Index
Fetch the complete documentation index at: https://hyperbrowser.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Setup
Installation
Setup your Environment
To use Hyperbrowser with your code, you need an API Key from the dashboard. Add it to your.env as HYPERBROWSER_API_KEY. You will also need an OPENAI_API_KEY.
Code
WebsiteCrawlTool, a WebsiteScrapeTool, and a WebsiteExtractTool to be used for OpenAI and Anthropic function calling. Each class provides a tool definition for both OpenAI and Anthropic that defines the schema which can be passed into the tools argument. Then, in the handleToolCall/handle_tool_call function, we parse the tool call arguments and dispatch the appropriate tool class runnable function based on the function name which returns the result of the scrape or crawl in formatted markdown.