transcribe turns the audio into text, generateText with Output.object turns the text into a typed ticket with a summary, intent, priority, and caller details, and generateSpeech reads a short acknowledgment back to the caller. Every step runs on a small ZeroGPU model through the @zerogpu/ai-sdk-provider package, so the whole pipeline is a few dozen lines of TypeScript and costs about three cents per voicemail. By combining the Vercel AI SDK and ZeroGPU, this cookbook walks you through a practical voice pipeline you can drop into a support inbox, a call center queue, or a Next.js route.
For the full reference, see the Vercel AI SDK integration guide.
In this cookbook, youβll explore:
- Vercel AI SDK: Vercelβs open-source TypeScript toolkit for building AI applications and agents, with one set of functions (
generateText,transcribe,generateSpeech, and more) that work the same across every model provider. Here it handles the audio in and out and validates the ticket against a zod schema. - ZeroGPU: A compute-efficient inference provider for apps and agents. We run purpose-built small and nano language models across an edge network for the high-volume tasks you run constantly - classification, extraction, moderation, routing, summarization - at ~10x lower latency and 50%+ lower cost than frontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage. Plug in and youβre live.
π₯ Watch the Video Guide
Video walkthrough coming soon.π¦ Installation
First, create a project and install the AI SDK, the ZeroGPU provider, andzod for the ticket schema. tsx runs the TypeScript file directly. Youβll need Node.js 22 or newer.
π Setting Up API Keys
Youβll need to set up your API key for ZeroGPU. This ensures that the tools can interact with external services securely. You can go to here to get an API key from ZeroGPU. The key starts withzgpu-api-.
ZEROGPU_API_KEY from the environment automatically, so the code below never touches the key.
ποΈ Access Speech Generation with ZeroGPU
ZeroGPU is a compute-efficient inference provider for apps and agents. We run purpose-built small and nano language models across an edge network for the high-volume tasks you run constantly - classification, extraction, moderation, routing, summarization - at ~10x lower latency and 50%+ lower cost than frontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage. Plug in and youβre live. In this section, we will generate the sample voicemail that the rest of the cookbook triages, so you donβt need an audio file of your own. Save this asmake-voicemail.ts:
TypeScript
voicemail.mp3 and youβll hear about 17 seconds of a customer reporting an outage. Got a real voicemail? Drop it in as voicemail.mp3 instead.
π ZeroGPU effortlessly turns text into natural-sounding speech in a single generateSpeech call, providing a fast, low-cost voice layer for AI integration!
π Triaging the Voice Note
The triage script runs three AI SDK calls in a row, each on a small ZeroGPU model: speech to text, text to a typed ticket, and ticket to a spoken reply. Createtriage.ts and add the cells below to it in order. Start with the imports:
TypeScript
Step 1: Transcribe the voicemail
transcribe sends the audio to whisper-tiny. Passing the language up front makes it faster and more accurate, and the result includes timed segments and the audio duration along with the text.
TypeScript
whisper-tiny is the smallest Whisper model, tuned for speed and cost. The next step still reads the meaning correctly, but treat exact numbers from a transcript as hints and check them against your own records before acting on them.
Step 2: Turn the transcript into a ticket
Now describe the ticket you want as a zod schema..describe() on a field tells the model what goes there, and z.enum limits intent and priority to values your helpdesk understands:
TypeScript
Output.object and send the transcript to gpt-6-luna. The AI SDK validates the reply against the schema, so ticket comes back fully typed:
TypeScript
ticket straight to your helpdesk API: every field is already validated.
Step 3: Speak an acknowledgment back
Last, build a short reply from the ticket and turn it into audio withchatterbox-nano, ready to send back by SMS, WhatsApp, or a callback system:
TypeScript
gpt-6-luna tokens. See the model catalog for current prices.
π Youβve turned a voicemail into a typed, prioritized support ticket and a spoken reply with three AI SDK calls. Since every step uses the standard AI SDK functions, you can move this script into a Next.js route handler or a queue worker without changing the model code, and swap any single step to another model by changing one model line.
π Highlights
This cookbook has guided you through setting up and running a Vercel AI SDK workflow with ZeroGPU for voice-note triage. You can adapt and expand this example for various other scenarios requiring fast, low-cost voice processing with structured, typed outputs. Key tools utilized in this cookbook include:- Vercel AI SDK: Vercelβs open-source TypeScript toolkit for building AI applications and agents, with one set of functions (
generateText,transcribe,generateSpeech, and more) that work the same across every model provider. Here it handles the audio in and out and validates the ticket against a zod schema. - ZeroGPU: A compute-efficient inference provider for apps and agents. We run purpose-built small and nano language models across an edge network for the high-volume tasks you run constantly - classification, extraction, moderation, routing, summarization - at ~10x lower latency and 50%+ lower cost than frontier-model workflows. Auto-scaling, with zero GPU infrastructure to manage. Plug in and youβre live.

