Skip to main content
View source

v0 by Vercel

View as Markdown

A RocketRide tool node that exposes Vercel's v0 generative UI API to an AI agent.

What it does

Lets an agent generate React + Tailwind CSS UI components from natural-language prompts. The agent describes the desired component with generate_ui and receives production-ready code, the full set of generated files, and a live preview URL. It can then iterate with refine_ui, sending follow-up instructions to the same v0 chat.

Talks to the v0 Platform API (https://api.v0.dev/v1/chats) over plain HTTPS using requests, no Vercel SDK is required. Chats are stateful server-side: each generation returns a chat_id, and refinements reuse it, so the agent never has to replay prior context.

Requests use a 120-second timeout (generation can take a while) and are retried via the shared post_with_retry helper. API and transport failures raise rather than returning error payloads, the agent framework converts the exception into a structured error for the model. Response bodies are never logged, even on malformed responses.

This node is marked experimental: v0 API availability and behavior may change.


Configuration

FieldTypeDescription
apikeystringDefault empty. Vercel v0 API key

The node fails at pipeline start if apikey is empty, and config validation warns about a missing key before that.

This node has no lanes: it is invoke-only and is called exclusively through its agent tools.


Available tools

generate_ui

Generate a React UI component from a natural-language description.

| Tool | Description | |---|---|---| | generate_ui | Generate a React UI component from a natural-language description. Provide a detailed prompt describing the desired UI and receive production-ready React + Tailwind CSS code, a live demo URL, and a chat_id for follow-up refinements via refine_ui. | | refine_ui | Refine a previously generated UI component by sending follow-up instructions to an existing v0 chat. Requires the chat_id from a prior generate_ui call. The v0 chat is stateful server-side, so prior context need not be replayed. |

Returns:

OutputDescription
successtrue on success
chat_idv0 chat ID, pass to refine_ui to iterate
codePrimary generated React component code (content of the first generated file)
filesAll generated files as {name, content} objects
demo_urlLive preview URL for the generated UI

refine_ui

Refine a previously generated component by sending follow-up instructions to an existing v0 chat.

InputRequiredDescription
promptyesFollow-up instructions describing how to change the component.
chat_idyesThe chat_id returned from a previous generate_ui or refine_ui call.

Returns the same shape as generate_ui. If the v0 follow-up response omits the chat id, the tool falls back to the chat_id it was given, so the value the agent holds always stays valid for further refinements.


Error behavior

  • An empty prompt (or missing chat_id for refine_ui) raises a validation error before any API call is made.
  • v0 Platform API errors ({"error": ...} payloads), non-JSON response bodies, and unexpected payload types raise a RuntimeError with a descriptive message.
  • A generation that returns no files raises v0 returned no files rather than returning empty code.

Authentication

Provide a Vercel v0 API key in the apikey field. The key is sent as a Authorization: Bearer <apikey> header on every request and is cleared from memory when the pipeline ends.


Schema

FieldTypeDescriptionDefault
tool_v0.apikeystringAPI Key
Vercel v0 API key
""

Dependencies

  • requests