npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@scrapegraph-ai/ai-sdk

v0.1.1

Published

Vercel AI SDK tools integration for ScrapeGraphAI.

Readme

ScrapeGraphAI AI SDK Tools

npm version License: MIT

Vercel AI SDK tools for the ScrapeGraphAI API.

Install

npm i @scrapegraph-ai/ai-sdk ai
# or
bun add @scrapegraph-ai/ai-sdk ai

ai is a peer dependency. Install the model provider package you use, for example:

npm i @ai-sdk/openai
# or
bun add @ai-sdk/openai

Quick Start

API key

Log in to the ScrapeGraphAI dashboard to create an API key. The dashboard also shows your request history, usage, credits, and crawl/monitor activity.

Set it in your environment:

export SGAI_API_KEY=...

Minimal scrape-only setup:

import { openai } from "@ai-sdk/openai";
import { generateText, stepCountIs } from "ai";
import { scrapeTool } from "@scrapegraph-ai/ai-sdk";

const result = await generateText({
  model: openai("gpt-5-nano"),
  prompt: "Find the main headline on https://example.com",
  tools: {
    scrape: scrapeTool(),
  },
  stopWhen: stepCountIs(5),
});

console.log(result.text);

Use every ScrapeGraphAI tool group:

import { openai } from "@ai-sdk/openai";
import { generateText, stepCountIs } from "ai";
import {
  crawlTools,
  extractTool,
  monitorTools,
  scrapeTool,
  searchTool,
} from "@scrapegraph-ai/ai-sdk";

const result = await generateText({
  model: openai("gpt-5-nano"),
  prompt: "Search for ScrapeGraphAI docs, scrape the best page, and summarize it.",
  tools: {
    scrape: scrapeTool(),
    extract: extractTool(),
    search: searchTool(),
    ...crawlTools(),
    ...monitorTools(),
  },
  stopWhen: stepCountIs(10),
});

console.log(result.text);

Tools read SGAI_API_KEY from the environment by default. You can also pass it explicitly:

const tools = {
  scrape: scrapeTool({ apiKey: process.env.SGAI_API_KEY }),
};

Tools

scrapeTool

Scrape a webpage with ScrapeGraphAI. Supports markdown, html, json extraction, links, images, summary, branding, and screenshots.

import { scrapeTool } from "@scrapegraph-ai/ai-sdk";

const tools = {
  scrape: scrapeTool(),
};

extractTool

Extract structured JSON from a URL, HTML, or markdown with a natural-language prompt.

import { extractTool } from "@scrapegraph-ai/ai-sdk";

const tools = {
  extract: extractTool(),
};

searchTool

Search the web and optionally extract structured data from search results.

import { searchTool } from "@scrapegraph-ai/ai-sdk";

const tools = {
  search: searchTool(),
};

crawlTools

Start, poll, page through, stop, resume, and delete ScrapeGraphAI crawl jobs.

import { crawlTools } from "@scrapegraph-ai/ai-sdk";

const tools = {
  ...crawlTools(),
};

Crawl page retrieval is paginated. Use getCrawl for status, then getCrawlPages for pages and resolved scrape results.

const tools = {
  startCrawl: startCrawlTool(),
  getCrawl: getCrawlTool(),
  getCrawlPages: getCrawlPagesTool(),
};

monitorTools

Create, list, update, pause, resume, delete, and fetch activity for ScrapeGraphAI monitors.

import { monitorTools } from "@scrapegraph-ai/ai-sdk";

const tools = {
  ...monitorTools(),
};

Examples

| Example | Description | |---------|-------------| | hacker-news.ts | Scrape Hacker News with AI SDK tools | | crawl-blog.ts | Crawl ScrapeGraphAI blog pages, fetch paginated crawl results, and summarize them |

Run an example:

OPENAI_API_KEY=... SGAI_API_KEY=... bun examples/crawl-blog.ts

Environment Variables

| Variable | Description | |----------|-------------| | SGAI_API_KEY | ScrapeGraphAI API key | | OPENAI_API_KEY | Required by the OpenAI provider examples |

Development

bun install
bun run build
bun run check

License

MIT - ScrapeGraphAI