Skip to main content
A type-safe API client for the v0 by Vercel API, auto-generated from the official OpenAPI specification with full TypeScript support.

Features

  • Type-Safe - Full TypeScript support with auto-generated types from OpenAPI spec
  • Zod Schemas - Runtime validation with Zod schemas for all API types
  • Auto-Updated - Daily regeneration from upstream OpenAPI specs

Installation

pnpm add v0-api

Usage

Basic Usage

import { createClient } from "v0-api";

const client = createClient({
  baseUrl: "https://api.v0.dev",
  headers: {
    Authorization: `Bearer ${process.env.V0_TOKEN}`,
  },
});

// List projects
const projects = await client.getProjects();

// Generate a component
const generation = await client.createGeneration({
  prompt: "Create a login form with email and password",
});

Type Exports

import type { Types } from "v0-api";

// Use TypeScript types for your application
type Project = Types.Project;
type Generation = Types.Generation;

Zod Schemas

import { Schemas } from "v0-api";

// Validate API responses at runtime
const projectSchema = Schemas.project;
const validated = projectSchema.parse(response);

API Reference

The client exposes v0 API endpoints for AI-powered component generation and project management.