Menu

Giving a Vercel AI SDK app tools that read any video link
📰

Giving a Vercel AI SDK app tools that read any video link

DEV Community: nextjs·Yusuf Yildiz·12 days ago
#AKc5ffeJ
#devtonextjs#devto#dev#const#json
Long article (1127 words) — no AI summary yet.
Reading 0:00
15s threshold

A lot of AI apps I see have the same feature request sooner or later: the user pastes a YouTube or podcast link and wants a summary, notes or answers about it. With the Vercel AI SDK the model side of that is easy. The hard part is getting the media in.

Fetching it yourself usually works on your laptop and then breaks once the app is deployed. Sites block the datacenter IPs that Vercel, AWS and the like run on, and plenty of videos have no captions to fall back on. I built Importly for this - you send it the link and get back the transcript, the file or the video's details - so here's how I wire it into an AI SDK app as tools.

The only packages you need are ai and zod .

1. Keep the key on the server

# .env.local IMPORTLY_API_KEY = your_api_key

Enter fullscreen mode

Exit fullscreen mode

The tools run in your route handler, so the key never reaches the browser.

2. Define the tools

Each tool starts a job and polls until it finishes.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.