Introducing the Vercel AI SDK
Vercel launched an open-source AI SDK for JavaScript and TypeScript that enables developers to build conversational, streaming, and chat interfaces with first-class support for OpenAI, LangChain, and Hugging Face models. The SDK includes React and Svelte hooks for real-time data rendering, integrates with Vercel Functions for instant scaling, and comes with an enhanced playground for comparing models and generating code.
This post is historical. Product names and runtime guidance may have changed. For new projects, use with the Node.js runtime and . Use for request-time routing before a response completes.Note:Vercel FunctionsFluid computeRouting Middleware
Over the past 6 months, AI companies like , , , , , and have launched with and Vercel. Vercel helps accelerate your product development by enabling you to focus on creating value with your AI applications, rather than spending time building and maintaining infrastructure.ScaleJasperPerplexityRunwayLexicaJenniNext.js
Today, we're launching new tools to improve the AI experience on Vercel.
The is an library designed to help developers build conversational, streaming, and chat user interfaces in JavaScript and TypeScript. The SDK supports React/Next.js, Svelte/SvelteKit, with support for Nuxt/Vue coming soon.Vercel AI SDKopen-source
To install the SDK, enter the following command in your terminal:
You can also .view the source code on GitHub
Choosing the right LLM for your application is crucial to building a great experience. Each has unique tradeoffs, and can be tuned in different ways to meet your requirements.
Vercel’s AI SDK embraces interoperability, and includes first-class support for , , and Inference. This means that regardless of your preferred AI model provider, you can leverage the Vercel AI SDK to create cutting-edge streaming UI experiences.OpenAILangChainHugging Face
The Vercel AI SDK includes React and Svelte hooks for data fetching and rendering streaming text responses. These hooks enable real-time, dynamic data representation in your application, offering an immersive and interactive experience to your users.
Building a rich chat or completion interface now just takes a few lines of code thanks to and :useChatuseCompletion
We've also included callbacks for storing completed streaming responses to a database within the same request. This feature allows for efficient data management and streamlines the entire process of handling streaming text responses.
The AI SDK works with Vercel Functions. You can deploy AI applications that scale instantly, stream generated responses, and run efficiently with Fluid compute.
With , you write application code in frameworks like Next.js and SvelteKit using the AI SDK, and Vercel converts this code into .framework-defined infrastructureglobal application infrastructure
In late April, we launched an interactive online prompt playground with 20 open source and cloud LLMs.play.vercel.ai
The playground provides a valuable resource for developers to compare various language model results in real-time, tweak parameters, and quickly generate Next.js, Svelte, and Node.js code.
Today, we’ve added a to the playground so you can simultaneously compare chat models side-by-side. We’ve also added code generation support for the Vercel AI SDK. You can now go from playground to chat app in just a few clicks.new chat interface
We'll be adding more in the coming weeks, as well as new templates built entirely with the AI SDK. Further, as new best practices for building applications emerge, we’ll lift them into the SDK based on your feedback.SDK examplesAI
**Vercel AI SDK: **Easily stream API responses from AI models
Explore models from , Hugging Face, and moreChat & Prompt Playground:OpenAI
The Vercel AI SDK
Chat & Prompt Playground
What’s Next?
Built-in LLM Adapters
Streaming First UI Helpers
Stream Helpers and Callbacks
Vercel Functions ready
Source: original entry ↗
More from Vercel
Follow Vercel to get its new changes in your feed and email digest.
OpenAI Decisions API now available on AI Gateway
OpenAI's Decisions API is now accessible through Vercel's AI Gateway with an OpenAI-compatible endpoint, enabling decision models to answer typed questions and return probabilities, choices, and scores for routing, triage, and guardrails use cases. Support is available across the OpenAI SDK, AI SDK, HTTP API, and CLI with the latest versions.
Timestamp attributes now supported in Vercel Flags
Vercel Flags now supports timestamp attributes for entities, allowing you to create time-based targeting rules. Use this feature to run limited-time campaigns, show content between specific dates, or target users based on registration date.
Glyph Cluster now available in stealth on AI Gateway
Glyph Cluster, a reasoning model for coding and long-context analysis, is now available as a stealth model on Vercel's AI Gateway for Pro and Enterprise plan teams with purchased AI Gateway credits at no cost during the stealth period. The model supports function calling, streams responses, and can be accessed via AI SDK, OpenAI-compatible APIs, and coding agents.