# AI SDK 4.1

By Steven Van · 2025-01-20

The open-source AI SDK adds experimental image generation across four providers, plus stream smoothing, easier chat persistence and non-blocking data streams.

Image generation is now in the AI SDK, the open-source JavaScript and TypeScript toolkit from [Vercel](<https://creatorstoolbox.com/tools/vercel>). [Version 4.1](<https://vercel.com/blog/ai-sdk-4-1>) adds an experimental generateImage function with one API across Replicate, OpenAI, Google Vertex and Fireworks. Switching providers means changing two lines, and the prompt and settings stay the same.

The function accepts size or aspectRatio, n for generating several images in parallel, and seed. Images come back as base64 and uint8Array. Provider-specific options go through providerOptions.

The release also includes:

- **Stream transformation:** a new experimental\_transform option on streamText, with a built-in smoothStream that smooths chunky provider output by character, word or line. It also supports content filtering, safety guardrails and custom transforms, and several transforms can be passed as an array.

- **Simpler useChat persistence:** the chat ID can be forwarded from client to server, response message IDs can be forwarded from server to client, and a new appendResponseMessages utility unifies messages for saving.

- **Non-blocking data streaming:** createDataStreamResponse returns immediately and lets developers stream data on demand, such as RAG context and search results, before the model's response begins. It supports annotations and metadata on messages, and useChat handles the streamed data on the client.

- **Other changes:** tool-calling improvements, structured output improvements, and new and updated providers.

![Vercel](<https://www.google.com/s2/favicons?domain=vercel.com&sz=128>)

Vercel

The platform for frontend developers — deploy, preview, and scale web apps and AI agents with zero config.

[View Vercel →](<https://creatorstoolbox.com/tools/vercel>)

[Original source](<https://vercel.com/blog/ai-sdk-4-1>)

[Read AI SDK 4.1 on Creators Toolbox](<https://creatorstoolbox.com/blog/vercel-ai-sdk-4-1>)

---
Canonical source: https://creatorstoolbox.com/blog/vercel-ai-sdk-4-1
