npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@v0-sdk/ai-tools

v0.3.8

Published

AI SDK tools for the v0 Platform API

Downloads

1,007

Readme

@v0-sdk/ai-tools

⚠️ Developer Preview: This SDK is currently in beta and is subject to change. Use in production at your own risk.

AI SDK tools for the v0 Platform API. This package provides a comprehensive collection of tools that can be used with the AI SDK to interact with v0's API endpoints, enabling AI agents to create, manage, and deploy v0 projects and chats.

Requirements

  • AI SDK: ^5.0.0
  • Zod: ^3.23.8 (required for AI SDK 5 compatibility)
  • Node.js: >=22

Installation

npm install @v0-sdk/ai-tools ai zod@^3.23.8

Quick Start

import { generateText } from 'ai'
import { v0Tools } from '@v0-sdk/ai-tools'

const result = await generateText({
  model: 'openai/gpt-4',
  prompt: 'Create a new React component for a todo list',
  tools: v0Tools({
    apiKey: process.env.V0_API_KEY,
  }),
})

That's it! v0Tools() returns all available tools in a flat structure ready to use with the AI SDK.

Usage Patterns

Organized by Category (Recommended - Better Context Management)

import { v0ToolsByCategory } from '@v0-sdk/ai-tools'

const tools = v0ToolsByCategory({ apiKey: process.env.V0_API_KEY })

const result = await generateText({
  model: 'openai/gpt-4',
  prompt: 'Help me manage my v0 projects',
  tools: {
    // Only include specific categories you need
    ...tools.chat,
    ...tools.project,
  },
})

All Tools (High Context Usage)

⚠️ Note: This includes all ~20+ tools which adds significant context to your AI calls.

import { v0Tools } from '@v0-sdk/ai-tools'

const result = await generateText({
  model: 'openai/gpt-4',
  prompt: 'Complete workflow: create project, chat, and deploy',
  tools: v0Tools({ apiKey: process.env.V0_API_KEY }), // All tools available
})

Organized by Category (Alternative Pattern)

import { v0ToolsByCategory } from '@v0-sdk/ai-tools'

const tools = v0ToolsByCategory({ apiKey: process.env.V0_API_KEY })

const result = await generateText({
  model: 'openai/gpt-4',
  prompt: 'Help me manage my v0 projects',
  tools: {
    // Only include specific categories
    ...tools.chat,
    ...tools.project,
  },
})

Individual Tool Creators (For Granular Control)

import { createChatTools, createProjectTools } from '@v0-sdk/ai-tools'

const chatTools = createChatTools({ apiKey: process.env.V0_API_KEY })
const projectTools = createProjectTools({ apiKey: process.env.V0_API_KEY })

const result = await generateText({
  model: 'openai/gpt-4',
  prompt: 'Create a chat in my existing project',
  tools: {
    // Pick specific tools
    createChat: chatTools.createChat,
    sendMessage: chatTools.sendMessage,
    getProject: projectTools.getProject,
    assignChatToProject: projectTools.assignChatToProject,
  },
})

Available Tools

Chat Tools (tools.chat)

| Tool | Description | | -------------- | --------------------------------------------- | | createChat | Create a new chat with v0 | | sendMessage | Send a message to an existing chat | | getChat | Get details of an existing chat | | updateChat | Update chat properties (name, privacy) | | deleteChat | Delete an existing chat | | favoriteChat | Toggle favorite status of a chat | | forkChat | Fork an existing chat to create a new version | | listChats | List all chats with filtering options |

Project Tools (tools.project)

| Tool | Description | | ---------------------------- | ------------------------------------------ | | createProject | Create a new project in v0 | | getProject | Get details of an existing project | | updateProject | Update project properties | | listProjects | List all projects | | assignChatToProject | Assign a chat to a project | | getProjectByChat | Get project details by chat ID | | createEnvironmentVariables | Create environment variables for a project | | listEnvironmentVariables | List environment variables for a project | | updateEnvironmentVariables | Update environment variables | | deleteEnvironmentVariables | Delete environment variables |

Deployment Tools (tools.deployment)

| Tool | Description | | --------------------- | ---------------------------------------------- | | createDeployment | Create a new deployment from a chat version | | getDeployment | Get details of an existing deployment | | deleteDeployment | Delete an existing deployment | | listDeployments | List deployments by project, chat, and version | | getDeploymentLogs | Get logs for a deployment | | getDeploymentErrors | Get errors for a deployment |

User Tools (tools.user)

| Tool | Description | | ---------------- | ------------------------------------ | | getCurrentUser | Get current user information | | getUserBilling | Get current user billing information | | getUserPlan | Get current user plan information | | getUserScopes | Get user scopes/permissions | | getRateLimits | Get current rate limit information |

Hook Tools (tools.hook)

| Tool | Description | | ------------ | ---------------------------------------- | | createHook | Create a new webhook for v0 events | | getHook | Get details of an existing webhook | | updateHook | Update properties of an existing webhook | | deleteHook | Delete an existing webhook | | listHooks | List all webhooks |

Configuration

Environment Variables

Set your v0 API key as an environment variable:

export V0_API_KEY=your_api_key_here

Direct Configuration

import { v0Tools } from '@v0-sdk/ai-tools'

const tools = v0Tools({
  apiKey: 'your_api_key_here',
  baseUrl: 'https://api.v0.dev', // optional, defaults to v0's API
})

Examples

Complete Workflow Example

import { generateText } from 'ai'
import { v0Tools } from '@v0-sdk/ai-tools'

const result = await generateText({
  model: 'openai/gpt-4',
  prompt: `Help me with a complete v0 workflow:
  1. Create a new project for an e-commerce site
  2. Create a chat in that project to design a product catalog
  3. Send a message asking for a React component
  4. Deploy the result
  5. Check deployment logs`,
  tools: v0Tools({
    apiKey: process.env.V0_API_KEY,
  }),
})

console.log(result.text)

Project Management Example

import { generateText } from 'ai'
import { v0ToolsByCategory } from '@v0-sdk/ai-tools'

const tools = v0ToolsByCategory({ apiKey: process.env.V0_API_KEY })

const result = await generateText({
  model: 'openai/gpt-4',
  prompt:
    'Create a new project called "My Portfolio" with environment variables for API keys',
  tools: {
    // Only include project tools for this specific task
    ...tools.project,
  },
})

TypeScript Support

The package is written in TypeScript and provides full type safety:

import type { V0ToolsConfig } from '@v0-sdk/ai-tools'

const config: V0ToolsConfig = {
  apiKey: process.env.V0_API_KEY,
  baseUrl: 'https://api.v0.dev',
}

const tools = v0Tools(config)

Error Handling

All tools include proper error handling and will throw descriptive errors if the v0 API returns an error:

try {
  const result = await generateText({
    model: 'openai/gpt-4',
    prompt: 'Create a chat',
    tools: v0Tools({ apiKey: 'invalid-key' }),
  })
} catch (error) {
  console.error('Error:', error.message)
}

Contributing

This package is part of the v0 SDK monorepo. See the main repository for contribution guidelines.

License

Apache 2.0