Building an AI startup?
You might be eligible for our Startup Program. Get fully funded access to the infrastructure you’re reading about right now (up to $50K value).
@brightdata/ai-sdk package gives you drop-in tools for web scraping, search, and structured dataset collection, no manual wiring required.
Steps to Get Started
Prerequisites
- Bright Data API Key, get yours from the Bright Data Dashboard
- Node.js 18+
- TypeScript (recommended)
Installation
Install the Bright Data AI SDK package alongside the Vercel AI SDK:Set your API key as an environment variable:
.env.local
Import and Use
Import the tools you need directly from
@brightdata/ai-sdk and pass them to any Vercel AI SDK call.
No additional setup files or wrappers needed, each tool is a factory function that reads your API key
automatically from BRIGHTDATA_API_KEY.Available Tools
All tools are factory functions, call them with an optional config object (or no arguments at all to use env defaults):| Tool | Import | Description |
|---|---|---|
scrape() | import { scrape } from '@brightdata/ai-sdk' | Scrape any website and return clean markdown. Bypasses anti-bot protection and CAPTCHAs. |
search() | import { search } from '@brightdata/ai-sdk' | Search Google, Bing, or Yandex with anti-bot bypass. Returns markdown results. |
amazon_product() | import { amazon_product } from '@brightdata/ai-sdk' | Get detailed Amazon product info: price, ratings, reviews, and specs. |
linkedin_profile() | import { linkedin_profile } from '@brightdata/ai-sdk' | Fetch LinkedIn profile data including experience, education, and skills. |
linkedin_jobs() | import { linkedin_jobs } from '@brightdata/ai-sdk' | Search LinkedIn job postings by location and keyword. |
instagram_profile() | import { instagram_profile } from '@brightdata/ai-sdk' | Get Instagram profile info and recent posts. |
facebook_profile() | import { facebook_profile } from '@brightdata/ai-sdk' | Collect Facebook profile data from a profile URL. |
chatgpt() | import { chatgpt } from '@brightdata/ai-sdk' | Query ChatGPT via Bright Data’s dataset API with optional web search mode. |
How each tool works
scrape(options?)
Scrape any public webpage and get back clean markdown (or HTML).
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The URL to scrape |
country | string | No | 2-letter country code for the proxy exit node |
search(options?)
Search the web via Google, Bing, or Yandex.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | The search query |
search_engine | string | No | 'google' (default), 'bing', or 'yandex' |
country | string | No | 2-letter country code for localized results |
data_format | string | No | 'markdown' (default) or 'html' |
amazon_product(options?)
Retrieve structured Amazon product data.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Amazon product URL (must include /dp/ or /gp/product/) |
zipcode | string | No | ZIP code for location-specific pricing |
linkedin_profile(options?)
Collect detailed LinkedIn profile data for one or more profiles.
| Parameter | Type | Required | Description |
|---|---|---|---|
urls | string[] | Yes | Array of LinkedIn profile URLs (min 1) |
linkedin_jobs(options?)
Search LinkedIn job postings by location and keyword.
| Parameter | Type | Required | Description |
|---|---|---|---|
location | string | Yes | Job location, e.g. "New York, NY" |
keyword | string | No | Job title or search keyword |
country | string | No | 2-letter country code |
instagram_profile(options?)
Fetch Instagram profile info and recent posts.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Instagram profile URL |
facebook_profile(options?)
Collect Facebook profile data.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Facebook profile URL |
chatgpt(options?)
Query ChatGPT via Bright Data’s ChatGPT dataset API with optional web search.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Prompt to send to ChatGPT |
additional_prompt | string | No | Optional follow-up prompt |
country | string | No | 2-letter country code |
require_sources | boolean | No | Fail when no sources are found |
web_search | boolean | No | Enable ChatGPT web search mode |
Example Output
Example: scrape a webpage
Prompt: “Scrape https://example.com and tell me what it’s about” AI Response:Example: run a Google search
Prompt: “Search for best mechanical keyboards 2025” AI Response:Amazon Product Example
Prompt: “Get info about https://www.amazon.com/dp/B0D2Q9397Y” AI Response:Best Practices
- API key management, Use
BRIGHTDATA_API_KEYin your environment; avoid hardcoding keys. - Error handling, All tools catch errors internally and return a descriptive string, so LLM loops won’t crash.
- Data format, Use
markdownfor scraping to get clean, LLM-friendly content. - Multi-step agents, Set
stopWhen: stepCountIs(N)to let the model chain tool calls autonomously. - Country targeting, Pass a 2-letter country code to get geo-specific results or pricing.
- Async datasets, For large dataset jobs (many LinkedIn profiles, etc.), consider setting
async: truein the underlying SDK client to avoid timeouts.
Which environment variables to set
.env.local