
Security News
npm Introduces minimumReleaseAge and Bulk OIDC Configuration
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.
@expandai/ai
Advanced tools
Vercel AI SDK integration for expand.ai - fetch and extract content from any URL
Vercel AI SDK integration for Expand - fetch and extract content from any URL with AI.
npm install @expandai/ai ai zod
# or
pnpm add @expandai/ai ai zod
# or
yarn add @expandai/ai ai zod
You need an Expand API key. Get one at expand.ai.
Set your API key as an environment variable:
export EXPAND_API_KEY=your_api_key_here
import { expandFetchTool } from '@expandai/ai'
import { generateText } from 'ai'
import { openai } from '@ai-sdk/openai'
const result = await generateText({
model: openai('gpt-4'),
tools: {
expandFetch: expandFetchTool,
},
prompt: 'What is on the Expand homepage at https://expand.ai?',
})
console.log(result.text)
import { createExpandFetchTool } from '@expandai/ai'
const customTool = createExpandFetchTool({
apiKey: 'your_custom_api_key',
description: 'Custom tool description for your specific use case',
})
const result = await generateText({
model: openai('gpt-4'),
tools: {
fetch: customTool,
},
prompt: 'Summarize the content at https://example.com',
})
import { expandFetchTool } from '@expandai/ai'
import { generateText } from 'ai'
import { openai } from '@ai-sdk/openai'
import { weatherTool } from './other-tools'
const result = await generateText({
model: openai('gpt-4'),
tools: {
expandFetch: expandFetchTool,
weather: weatherTool,
},
prompt: 'Check the weather forecast on https://weather.com and plan my weekend',
})
expandFetchToolThe default tool instance that uses the EXPAND_API_KEY environment variable.
import { expandFetchTool } from '@expandai/ai'
createExpandFetchTool(options?)Create a custom Expand fetch tool with specific configuration.
Parameters:
options.apiKey (optional): Expand API key. Defaults to process.env.EXPAND_API_KEYoptions.description (optional): Custom tool description for the AI modelReturns: A Vercel AI SDK tool
import { createExpandFetchTool } from '@expandai/ai'
const tool = createExpandFetchTool({
apiKey: 'your_api_key',
description: 'Fetch web content for analysis',
})
The tool returns an object with:
url: The fetched URLmarkdown: The extracted content in Markdown formatmeta: Metadata object containing:
title: Page titledescription: Page descriptionimport { expandFetchTool } from '@expandai/ai'
import { generateText } from 'ai'
import { anthropic } from '@ai-sdk/anthropic'
const result = await generateText({
model: anthropic('claude-3-5-sonnet-20241022'),
tools: {
expandFetch: expandFetchTool,
},
prompt: `
Research the latest developments in AI from these sources:
- https://openai.com/blog
- https://www.anthropic.com/news
Provide a summary of the most important updates.
`,
})
import { expandFetchTool } from '@expandai/ai'
import { streamText } from 'ai'
import { openai } from '@ai-sdk/openai'
const result = await streamText({
model: openai('gpt-4-turbo'),
tools: {
expandFetch: expandFetchTool,
},
prompt: `
Compare the pricing pages of:
- https://vercel.com/pricing
- https://netlify.com/pricing
Which one offers better value for small teams?
`,
})
for await (const chunk of result.textStream) {
process.stdout.write(chunk)
}
import { createExpandFetchTool } from '@expandai/ai'
import { generateText } from 'ai'
import { openai } from '@ai-sdk/openai'
try {
const tool = createExpandFetchTool({ apiKey: process.env.EXPAND_API_KEY })
const result = await generateText({
model: openai('gpt-4'),
tools: { expandFetch: tool },
prompt: 'Fetch https://example.com',
})
} catch (error) {
console.error('Failed to fetch content:', error)
}
ai >= 3.0.0zod >= 3.0.0Apache-2.0
For issues and questions:
FAQs
Vercel AI SDK integration for expand.ai - fetch and extract content from any URL
We found that @expandai/ai demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm rolls out a package release cooldown and scalable trusted publishing updates as ecosystem adoption of install safeguards grows.

Security News
AI agents are writing more code than ever, and that's creating new supply chain risks. Feross joins the Risky Business Podcast to break down what that means for open source security.

Research
/Security News
Socket uncovered four malicious NuGet packages targeting ASP.NET apps, using a typosquatted dropper and localhost proxy to steal Identity data and backdoor apps.