VercelLogotypeVercelLogotype
LoginSign Up
Back to Templates

AI SDK Image Generator

An open-source AI image generator built with Next.js, the AI SDK, and various AI providers (Replicate, Fireworks, Google Vertex AI, OpenAI)

DeployView Demo
ai-sdk-image-generator-screenshot

Features

  • Supports image generation using generateImage from the AI SDK by Vercel, allowing multiple AI providers to be used interchangeably with just a few lines of code.
  • A single input to generate images across multiple providers simultaneously.
  • shadcn/ui components for a modern, responsive UI powered by Tailwind CSS.
  • Built with the latest Next.js App Router (version 15).

Model Providers

This template includes the following providers by default:

  • Replicate
  • Google Vertex AI
  • OpenAI
  • Fireworks

You can easily add or remove providers (and their associated models) by updating the configuration in the codebase.

Deploy Your Own

You can deploy your own version of the AI SDK Image Generator to Vercel by clicking the button below:

Running Locally

  1. Clone the repository and install dependencies:

    npm install
    # or
    yarn install
    # or
    pnpm install
  2. Create an .env.local file (or set Environment Variables in your Vercel dashboard) to store any necessary API keys for the providers you plan to use. There is an .env.example file that you can use as a reference.

    # Standard API keys
    OPENAI_API_KEY=...
    REPLICATE_API_TOKEN=...
    FIREWORKS_API_KEY=...
    # Google Vertex AI settings
    GOOGLE_CLIENT_EMAIL=... # From your service account JSON file
    GOOGLE_PRIVATE_KEY=... # From your service account JSON file
    GOOGLE_VERTEX_PROJECT=... # Your Google Cloud project ID
    GOOGLE_VERTEX_LOCATION=... # e.g., "us-central1"

    For Google Vertex AI setup:

    • Get your service account credentials from the Google Cloud Console
    • The values for GOOGLE_CLIENT_EMAIL and GOOGLE_PRIVATE_KEY can be found in your service account JSON file
    • Set GOOGLE_VERTEX_LOCATION to your preferred region (e.g., "us-central1")
    • Set GOOGLE_VERTEX_PROJECT to your Google Cloud project ID

    For more details on Google Vertex AI configuration, see the AI SDK documentation.

  3. Run the development server:

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
  4. Open http://localhost:3000 to view your new AI image generator application.

Authors

This repository is maintained by the Vercel team and community contributors. Special thanks to:

  • Walter Korman (@shaper) - Vercel
  • Nico Albanese (@nicoalbanese10) - Vercel

Contributions are welcome! Feel free to open issues or submit pull requests to enhance functionality or fix bugs.

GitHub Repovercel-labs/ai-sdk-image-generator
Use Cases
AI
Stack
Next.jsTailwind

Related Templates

Get Started

  • Templates
  • Supported frameworks
  • Marketplace
  • Domains

Build

  • Next.js on Vercel
  • Turborepo
  • v0

Scale

  • Content delivery network
  • Fluid compute
  • CI/CD
  • Observability
  • AI GatewayNew
  • Vercel AgentNew

Secure

  • Platform security
  • Web Application Firewall
  • Bot management
  • BotID
  • SandboxNew

Resources

  • Pricing
  • Customers
  • Enterprise
  • Articles
  • Startups
  • Solution partners

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Community

Frameworks

  • Next.js
  • Nuxt
  • Svelte
  • Nitro
  • Turbo

SDKs

  • AI SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDK
  • Streamdown AINew

Use Cases

  • Composable commerce
  • Multi-tenant platforms
  • Web apps
  • Marketing sites
  • Platform engineers
  • Design engineers

Company

  • About
  • Careers
  • Help
  • Press
  • Legal
  • Privacy Policy

Community

  • Open source program
  • Events
  • Shipped on Vercel
  • GitHub
  • LinkedIn
  • X
  • YouTube

Loading status…

Select a display theme:
    • AI Cloud
      • v0

        Build applications with AI

      • AI SDK

        The AI Toolkit for TypeScript

      • AI Gateway

        One endpoint, all your models

      • Vercel Agent

        An agent that knows your stack

      • Sandbox

        AI workflows in live environments

    • Core Platform
      • CI/CD

        Helping teams ship 6× faster

      • Content Delivery

        Fast, scalable, and reliable

      • Fluid Compute

        Servers, in serverless form

      • Observability

        Trace every step

    • Security
      • Bot Management

        Scalable bot protection

      • BotID

        Invisible CAPTCHA

      • Platform Security

        DDoS Protection, Firewall

      • Web Application Firewall

        Granular, custom protection

    • Company
      • Customers

        Trusted by the best teams

      • Blog

        The latest posts and changes

      • Changelog

        See what shipped

      • Press

        Read the latest news

      • Events

        Join us at an event

    • Learn
      • Docs

        Vercel documentation

      • Academy

        Linear courses to level up

      • Knowledge Base

        Find help quickly

      • Community

        Join the conversation

    • Open Source
      • Next.js

        The native Next.js platform

      • Nuxt

        The progressive web framework

      • Svelte

        The web’s efficient UI framework

      • Turborepo

        Speed with Enterprise scale

    • Use Cases
      • AI Apps

        Deploy at the speed of AI

      • Composable Commerce

        Power storefronts that convert

      • Marketing Sites

        Launch campaigns fast

      • Multi-tenant Platforms

        Scale apps with one codebase

      • Web Apps

        Ship features, not infrastructure

    • Tools
      • Marketplace

        Extend and automate workflows

      • Templates

        Jumpstart app development

      • Partner Finder

        Get help from solution partners

    • Users
      • Platform Engineers

        Automate away repetition

      • Design Engineers

        Deploy for every idea

  • Enterprise
  • Pricing
Log InContact
Sign Up
Sign Up
Back to Templates
DeployView Demo

Chatbot

A full-featured, hackable Next.js AI chatbot built by Vercel
Chatbot

Dynamic Model Usage with AI SDK

A chatbot that allows you to dynamically set the LLM using Vercel AI SDK with Feature Flags and Edge Config
Dynamic Model Usage with AI SDK
v0

Build applications with AI

AI SDK

The AI Toolkit for TypeScript

AI Gateway

One endpoint, all your models

Vercel Agent

An agent that knows your stack

Sandbox

AI workflows in live environments

CI/CD

Helping teams ship 6× faster

Content Delivery

Fast, scalable, and reliable

Fluid Compute

Servers, in serverless form

Observability

Trace every step

Bot Management

Scalable bot protection

BotID

Invisible CAPTCHA

Platform Security

DDoS Protection, Firewall

Web Application Firewall

Granular, custom protection

Customers

Trusted by the best teams

Blog

The latest posts and changes

Changelog

See what shipped

Press

Read the latest news

Events

Join us at an event

Docs

Vercel documentation

Academy

Linear courses to level up

Knowledge Base

Find help quickly

Community

Join the conversation

Next.js

The native Next.js platform

Nuxt

The progressive web framework

Svelte

The web’s efficient UI framework

Turborepo

Speed with Enterprise scale

AI Apps

Deploy at the speed of AI

Composable Commerce

Power storefronts that convert

Marketing Sites

Launch campaigns fast

Multi-tenant Platforms

Scale apps with one codebase

Web Apps

Ship features, not infrastructure

Marketplace

Extend and automate workflows

Templates

Jumpstart app development

Partner Finder

Get help from solution partners

Platform Engineers

Automate away repetition

Design Engineers

Deploy for every idea