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

@serphouse/ai-sdk

v0.1.0

Published

AI tool calling utilities for web search, news, and short videos via SerpHouse API

Readme

@SERPHouse/ai-sdk

AI tool calling utilities for web search, news, and short videos — powered by SERPHouse.

Drop-in Vercel AI SDK tool() definitions for Google web search, news, and short-video search.

TypeScript 5+ Vercel AI SDK MIT License


Install

npm install @serphouse/ai-sdk

Requires Node.js >= 18 with ai and zod as peer dependencies.


Quick Start

1. Get your API key from the SERPHouse Dashboard and set it:

export SERPHOUSE_API_KEY="your_key_here"

2. Import and use with any AI SDK model:

import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { search, news } from "@serphouse/ai-sdk";

const { text } = await generateText({
  model: openai("gpt-4o"),
  tools: { search: search(), news: news() },
  prompt: "What are the latest AI news?",
});

The LLM decides when to call each tool. No manual API wiring needed.


Tools

| Tool | Description | API Endpoint | |------|-------------|--------------| | search(options?) | Google web search | /web-search-lite | | news(options?) | Google News search | /google-news | | shortVideo(options?) | Google Short Videos search | /google-short-videos-api |

Each returns a typed Vercel AI SDK tool object with a Zod input schema and execute handler.

Input Schema

| Field | Type | Default | Description | |-------|------|---------|-------------| | q | string | — | Search query (required) | | domain | string | "google.com" | Google domain | | lang | string | "en" | Language code | | loc | string | "New York,New York,United States" | Location (City,State,Country) | | page | number | — | Page number | | date_range | string | "y" | Time filter: h, d, w, m, y, or YYYY-MM-DD,YYYY-MM-DD | | device | "desktop" \| "mobile" | "desktop" | Device type | | gl | string | "US" | Country GL code — search only |


Authentication

The library resolves the API key in this order:

  1. apiKey option passed to the tool factory
  2. SERPHOUSE_API_KEY environment variable
// Env var (default)
const tool = search();

// Explicit key (overrides env)
const tool = search({ apiKey: "sk-..." });

API

search(options?)

import { search } from "serptool";
const tool = search();

Google web search — organic results, ads, related searches.

news(options?)

import { news } from "@serphouse/ai-sdk";
const tool = news();

Google News search — headlines, sources, publish dates.

shortVideo(options?)

import { shortVideo } from "@serphouse/ai-sdk";
const tool = shortVideo();

Google Short Videos search.

ToolOptions

type ToolOptions = { apiKey?: string };

Examples

Anthropic

import { generateText } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
import { search } from "@serphouse/ai-sdk";

const { text } = await generateText({
  model: anthropic("claude-sonnet-4-20250514"),
  tools: { search: search() },
  prompt: "Search for the latest tech news.",
});

Google Gemini

import { generateText } from "ai";
import { google } from "@ai-sdk/google";
import { search } from "@serphouse/ai-sdk";

const { text } = await generateText({
  model: google("gemini-2.0-flash"),
  tools: { search: search() },
  prompt: "Search for AI startups.",
});

License

MIT