---
title: "Alt Text Generator"
description: "Generate descriptions for your images using AI."
url: "https://vercel.com/templates/next.js/ai-alt-text-generator"
links:
  repository: "https://github.com/vercel/examples/tree/main/solutions/alt-tag-generator"
  demo: "https://alt-text-generator.vercel.app/"
  deploy: "https://vercel.com/new/clone?demo-title=Alt+Text+Generator&demo-description=Generate+descriptions+for+your+images+using+AI.&demo-url=https%3A%2F%2Falt-text-generator.vercel.app%2F&demo-image=%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F4drwrKAAIaxlj20navkPPK%2Fb528d47de1d68c0017620f6b6dd673be%2Fnewalttaggenerator.png&project-name=Alt+Text+Generator&repository-name=ai-alt-text-generator&repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fsolutions%2Falt-tag-generator&from=templates&skippable-integrations=1&env=REPLICATE_API_TOKEN&envDescription=Instructions+on+how+to+configure+these+env+vars%3A&envLink=https%3A%2F%2Fgithub.com%2Fvercel%2Fexamples%2Ftree%2Fmain%2Fsolutions%2Falt-tag-generator%23readme"
---

# Alt Text Generator

Generate descriptions for your images using AI.

# Alt Image Generator

This project will generate relevant alt text for images using AI.

![Alt Image Generator](https://github.com/vercel/examples/blob/main/solutions/alt-tag-generator/ogimage.png?raw=true)

## How it works

It uses an ML modal from Salesforce called [BLIP](https://github.com/salesforce/BLIP) on [Replicate](https://replicate.com/) to generate relevant alt text for images. You can feed the Next.js API route an image as a query param and it will return a one sentence description of that image.

## Clone and Deploy

Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [pnpm](https://pnpm.io/installation) to bootstrap the example:

```bash
pnpm create next-app --example https://github.com/vercel/examples/tree/main/solutions/alt-tag-generator
```

After cloning the repo, go to [Replicate](https://replicate.com/) to make an account and put your API key in a file called `.env.local`.

Then, run the application in the command line and it will be available at `http://localhost:3000`.

```bash
pnpm dev
```

To use the API route, go to the link below in your browser or run a curl command in your terminal to get a sample result. Feel free to replace the dub.sh link with a link to any image.

```bash
curl http://localhost:3000/api/generate?imageUrl=https://dub.sh/confpic
```

## One-Click Deploy

Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/solutions/alt-tag-generator&env=REPLICATE_API_TOKEN&project-name=alt-tag-generation&repo-name=alt-tag-generation)

## Related Templates

### [Inpainter with Stable Diffusion](https://vercel.com/templates/next.js/inpainter-stable-diffusion)

Next.js application for inpainting with Stable Diffusion using the Replicate API.

### [Dall-E 2 AI Art Generator](https://vercel.com/templates/next.js/dall-e)

Dall-E 2 frontend using Upstash for message queue + Redis.

---

## Additional documentation

The [Vercel Knowledge Base](https://vercel.com/kb) contains guides and answers to common questions about Vercel, including deployment, framework configuration, domains, caching, and troubleshooting.
