AIHero
    Free

    Series · 16 lessons

    Vercel AI SDK Tutorial

    Build any LLM app in TypeScript with Vercel's AI SDK. Learn streaming, structured outputs, tool calls and agents.

    Matt Pocock
    Matt Pocock

    I've been building a lot of stuff with TypeScript and AI recently. I've been building agents, workflows, custom scripts and CLIs to help me work faster and smarter.

    And Vercel's AI SDK has been an awesome tool in my toolkit.

    It's a library that solves a lot of the pain points when working with LLMs.

    And in this tutorial, I'm going to give you a full guide on how to get to grips with it.

    This is really good! Learned a few things I didn't know.

    Addy Osmani — Engineering leader @ Google ChromeAddy Osmani — Engineering leader @ Google Chrome

    You can use the AI SDK Core anywhere JavaScript runs. And that's why I'm so excited about it. It's so versatile, so powerful and it's just the right level of abstraction for almost any task.

    Head to AI Hero's GitHub Repo for all the code, and to run the examples.

    What you'll learn

    1. 01Hot-swapping models
    2. 02Streaming
    3. 03Structured outputs
    4. 04Handling images and files
    5. 05Tool calling
    6. 06Building agents

    16 lessons, in order

    1. 01

      What Is Vercel's AI SDK?

      Learn how Vercel's AI SDK simplifies building AI apps by providing a unified API to interact with different LLM providers.
    2. 02

      Generate Text With Vercel's AI SDK

      Learn how to generate AI text responses using Vercel's AI SDK with Anthropic's Claude models. Simple setup for text generation in TypeScript.
    3. 03

      Streaming Text With Vercel's AI SDK

      Learn how to use Vercel's AI SDK to stream text to massively improve your user's experience.
    4. 04

      Adding System Prompts With Vercel's AI SDK

      Learn how to use system prompts with Vercel's AI SDK to customise the LLM's behavior.
    5. 05

      Hot-Swap AI Models With Vercel's AI SDK

      Learn how to easily switch AI models using Vercel's AI SDK for flexible and decoupled application development.
    6. 06

      Working With Message Histories In Vercel's AI SDK

      Learn how to manage conversation history in AI chatbots using Vercel AI SDK's CoreMessage array. A practical guide with TypeScript examples.
    7. 07

      Use Local Models With Vercel's AI SDK

      Learn how to connect Vercel's AI SDK to local or remote models using OpenAI-compatible APIs, featuring LM Studio integration on localhost.
    8. 08

      Structured Outputs with Vercel's AI SDK

      Discover how to use Vercel's AI SDK for structured outputs with OpenAI, focusing on efficient data retrieval in predefined formats.
    9. 09

      Streaming Objects With Vercel's AI SDK

      Learn how to stream structured outputs from an LLM using Vercel's AI SDK.
    10. 10

      Generate Enums With Vercel's AI SDK

      Learn how to build a sentiment analysis system using enums and the AI SDK to classify text as positive, negative, or neutral in just a few lines of code.
    11. 11

      Generate Arrays With Vercel's AI SDK

      Learn how to use Vercel's AI SDK to generate arrays of objects with a Zod schema for creating fake user data.
    12. 12

      Build an Alt Text Generator With Vercel's AI SDK

      Learn how to use Vercel's AI SDK to generate alt text for images using both local files and URLs with a simple guide.
    13. 13

      Extract Structured Data From PDF's With Vercel's AI SDK

      Learn how to extract structured data from PDF invoices using the Vercel AI SDK and Zod schemas, enabling automated data processing and database storage.
    14. 14

      Create Embeddings With Vercel's AI SDK

      Learn how to use Vercel's AI SDK to create and search embeddings for words and data.
    15. 15

      Tool Calling With Vercel's AI SDK

      Learn how to do tool calling in TypeScript with Vercel's AI SDK, using the simplest possible example.
    16. 16

      Build Your First Agent With Vercel's AI SDK

      Let's build an AI agent. Learn how LLM's can respond to the results of tool calls with Vercel's AI SDK.

    After this series

    Put it to work with the skills

    Free, open-source skills that turn these fundamentals into a real engineering workflow with your agent.

    Browse the skills