The AI SDK is a library written in TypeScript that makes working with LLMs a lot easier. At the time of recording, it's up to two and a half million downloads per week and it's built and maintained by a core team at Vercel, but it doesn't just run on Vercel infrastructure. The AI SDK runs anywhere JavaScript runs. And it's useful both on the back end, but also connecting the back end to the front end. The AI SDK comes in three main parts. The first part is the core that runs anywhere JavaScript runs.
And you install it by installing just one package, the ai
package. Then you have a set of UI hooks too that can work with any major framework. These are under their own packages, so @ai-sdk/react
, @ai-sdk/vue
, @ai-sdk/angular
, @ai-sdk/svelte
, etc. There's also a React server components offering, but I don't really think about this very much. The core working on the backend and the UI working on the frontend is really what you need.
One of the main things the AI SDK does really well is avoiding vendor lock-in. You get a single unified API that you can talk to any of these providers. You want to talk to Anthropic? Sure, you can install @ai-sdk/anthropic
. There are many, many, many of these providers, not just the ones here.
And as these providers add new features, they then get supported in the AI SDK, usually either on the day they're released or a couple of days later. So that's one of the primary benefits of the AI SDK. You learn one set of tools and you can talk to any of these models. But they also provide really great helpers for lots of common use cases. Whether you want to do structured outputs, whether you want to work with agents.
And especially the logic for streaming from the back end to the front end is invaluable because that stuff is extremely hard and so having a library abstract this connection for us is great. I personally think of the AI SDK as the standard library for TypeScript and AI. There are many frameworks out there, many abstractions that just feel too big, too jargon heavy. But so many folks I talk to say the AI SDK is the exception. It's straightforward, easy to use, and I freaking love it.
And I hope throughout this course you will grow to love it too. Nice work, and I will see you in the next one.