SDK for the v0 Platform API
513
stars
257
commits
TypeScript
primary language
Sep 11, 2026
updated
TypeScript SDK for the v0 API.
This repository contains the v2 SDK package and compatible examples:
v0 - TypeScript SDK generated from the v0 API OpenAPI schema, with helpers for streaming responses and Vercel OIDC auth.@v0-sdk/react - AI SDK transport and generated /swr hooks for browser clients that call an application-owned v0 proxy.examples/basic - Small TypeScript scripts for synchronous and streaming chat creation.examples/react-chat - Minimal Next.js chat using AI SDK useChat with V0Transport.npm install v0@canary
# or
pnpm add v0@canary
# or
yarn add v0@canary
# or
bun add v0@canary
Set V0_API_KEY, or deploy server-side code on Vercel with OIDC enabled, then use the default client.
You can get an API key from v0.app/settings
import { v0 } from 'v0'
const response = await v0.chats.create({
message: 'Build me a personal website',
})
if (response.error) {
throw new Error(response.error.message)
}
const preview = await v0.chats.getPreview({
chatId: response.data.chat.id,
})
if (preview.error) {
throw new Error(preview.error.message)
}
console.log(preview.data?.url)
Use createV0Client when you need to customize auth, baseUrl, or fetch options.
import { createV0Client } from 'v0'
const v0 = createV0Client({
auth: process.env.CUSTOM_V0_API_KEY!,
})
import { readV0Stream, v0 } from 'v0'
const serverResult = await v0.chats.createStream({
message: 'Build a hello world button',
})
const result = readV0Stream(serverResult.toResponse())
for await (const update of result.stream) {
console.log(update)
}
console.log(await result.final)
This repo uses Bun workspaces.
bun install
bun run generate
bun run build
bun run typecheck
bun run lint
bun run fmt:check
The generated SDK is built from packages/v0-sdk/openapi.json with @hey-api/openapi-ts.
Apache 2.0
TypeScript
99.8%
SDK for the v0 Platform API
513
stars
257
commits
TypeScript
primary language
Sep 11, 2026
updated
TypeScript SDK for the v0 API.
This repository contains the v2 SDK package and compatible examples:
v0 - TypeScript SDK generated from the v0 API OpenAPI schema, with helpers for streaming responses and Vercel OIDC auth.@v0-sdk/react - AI SDK transport and generated /swr hooks for browser clients that call an application-owned v0 proxy.examples/basic - Small TypeScript scripts for synchronous and streaming chat creation.examples/react-chat - Minimal Next.js chat using AI SDK useChat with V0Transport.npm install v0@canary
# or
pnpm add v0@canary
# or
yarn add v0@canary
# or
bun add v0@canary
Set V0_API_KEY, or deploy server-side code on Vercel with OIDC enabled, then use the default client.
You can get an API key from v0.app/settings
import { v0 } from 'v0'
const response = await v0.chats.create({
message: 'Build me a personal website',
})
if (response.error) {
throw new Error(response.error.message)
}
const preview = await v0.chats.getPreview({
chatId: response.data.chat.id,
})
if (preview.error) {
throw new Error(preview.error.message)
}
console.log(preview.data?.url)
Use createV0Client when you need to customize auth, baseUrl, or fetch options.
import { createV0Client } from 'v0'
const v0 = createV0Client({
auth: process.env.CUSTOM_V0_API_KEY!,
})
import { readV0Stream, v0 } from 'v0'
const serverResult = await v0.chats.createStream({
message: 'Build a hello world button',
})
const result = readV0Stream(serverResult.toResponse())
for await (const update of result.stream) {
console.log(update)
}
console.log(await result.final)
This repo uses Bun workspaces.
bun install
bun run generate
bun run build
bun run typecheck
bun run lint
bun run fmt:check
The generated SDK is built from packages/v0-sdk/openapi.json with @hey-api/openapi-ts.
Apache 2.0
TypeScript
99.8%