AI SDK 3.1 brings unified LLM abstractions to TypeScript

Vercel has released AI SDK 3.1, bringing ModelFusion into the fold as the project moves toward a comprehensive TypeScript framework for AI application development. The SDK is organized into three core areas: AI SDK Core for unified LLM interactions, AI SDK UI for chat interface hooks, and AI SDK RSC for generative UI with React Server Components.

AI SDK Core: an ORM-style layer for language models

AI SDK Core functions as a low-level abstraction layer over LLM providers, similar to how ORMs like Drizzle or Prisma abstract databases. Developers specify two things: the type of output they need (text or structured objects) and the delivery method (streamed or complete). This simplifies integration by hiding provider-specific differences.

The API works with any provider implementing the AI SDK Language Model Specification, an open standard that allows third parties to build compatible integrations. In addition to first-party support for OpenAI, Anthropic, Google Gemini, and Mistral, the community has already contributed providers such as LlamaCpp.

Generating text and structured data

Using the Core API, generating text requires only a model reference and a prompt. Switching between providers is a matter of changing a few lines, as the interface remains consistent. For instance, moving from Mistral's mistral-large-latest to OpenAI's gpt-4-turbo does not change the surrounding code.

Structured output is handled through the generateObject and streamObject functions. Developers define a Zod schema, pass it to the call, and receive a validated, type-safe object—for example, a styled recipe object with all fields checked against the schema.

AI SDK UI: eliminating chat boilerplate

Building a conventional chatbot UI involves significant repetition: client state for messages, streaming text parsing, loading indicators, and persistence lifecycle management. AI SDK UI condenses this into three framework-agnostic hooks: useChat, useCompletion, and useAssistant.

In a Next.js App Router setup, a server route using Core's streamText can feed directly into a client component using useChat. The hook handles receiving streamed tokens, managing message state, and updating the interface in real time, bringing a functional streaming chatbot to under 50 lines of total code.

AI SDK RSC: beyond text interfaces

Traditional LLM apps tend to suffer from two UX constraints: they either rely on static knowledge without realtime data or render everything as plain text. AI SDK RSC addresses this by pairing tool calling with component-based rendering.

The new streamUI function, designed as a successor to the existing render helper (to be deprecated in the next minor version), is compatible with the Core Language Model Specification. A React Server Action built with streamUI can fetch live weather data through a tool call and render a custom UI component based on the result, moving the interaction beyond simple text output.

What's next

The 3.1 release consolidates the SDK into a single cohesive stack: Core for universal LLM calls in any JavaScript environment, UI for rapid chat interface development, and RSC for generative component-driven applications. Developers can consult the updated documentation or test models through the AI playground.