Today we're introducing the new v0 API : programmatic, headless access to v0 's app-building agent. Send a prompt and v0 generates an app, starts a dev server in a Vercel Sandbox , and gives you a preview URL you can embed in your own UI.
Each chat is an isolated workspace for one app, where v0 can read, edit, and run the files. Follow-up messages continue from the current state. v0 verifies the code running in the Sandbox, so it can catch and fix errors in your app in real time.
The new API is now generally available.
Copy link to heading How it works
Create a chat from a prompt, stream its work, and render the live preview, all from your own interface. First, install the v0 SDK.
Then, create a chat. Send a prompt, and v0 generates your app.
import { v0 } from 'v0'
const result = await v0 . chats . create ( {
message : 'Build an issue triage app for a support team.' ,
} )
if ( result . error ) {
throw new Error ( result . error . message )
}
const chatId = result . data . chat .…