vercel/v0-sdk

SDK for the v0 Platform API

What it solves

This SDK provides a standardized way for developers to integrate v0's AI-driven UI generation capabilities into their own applications. It removes the need to manually handle API calls, authentication, and the complex streaming of AI-generated code and previews.

How it works

The project consists of a TypeScript SDK generated from the v0 API OpenAPI schema. It includes a set of tools for managing chat sessions, creating streaming responses, and handling Vercel OIDC authentication. It also provides a dedicated React package for browser clients to interact with v0 proxies via AI SDK transports and SWR hooks.

Who it’s for

Developers building frontends or platforms that want to embed v0's generative UI capabilities, such as the ability to create and preview AI-generated websites or components, directly within their own user interface.

Highlights

  • Streaming Support: Includes helpers like readV0Stream to handle real-time updates of AI-generated content.
  • Design Mode Integration: A browser bridge (createDesignModeBridge) that allows developers to embed v0 previews with support for selection, layer state, and document reloads without exposing API keys in the browser.
  • TypeScript First: Fully typed SDK generated from OpenAPI specifications for better developer experience.
  • React Integration: Provides a dedicated @v0-sdk/react package for seamless integration with the AI SDK useChat hook.

Related

  • Project
  • Project
  • Project
  • Project
  • Project