balt1794

payload plugin alt text generator

by balt1794
AI content generation
v3
^3.92.0
MIT

Overview

Summary generated from the README

Adds AI-generated alt text to upload collections in Payload. It provides a Generate button on each image, a bulk admin page in the sidebar, and an optional automatic mode on upload. It calls the external Alt Text Generator service from the server using an API key and credits, and requires Payload 3.92 or newer and Node.js 20.9 or newer.

Features

  • Generate alt text button under the alt field on each image
  • Bulk admin page to scan, select, generate, edit and save results
  • Automatic alt text on upload or file replacement
  • Supports 131 languages and uses the editing locale on localized sites
  • Configurable access function and alt field name
  • Adds a hidden settings table that stores the auto mode and language

Use cases

  • Fill in missing alt text across an existing media library in one pass
  • Create accessible alt text automatically for editor uploads
  • Write alt text per locale on multilingual sites

From the author

Generate SEO-friendly alt text for the images in your Payload CMS media library: one at a time, in bulk, or automatically on upload.

Installation

npm i @balt1794/payload-plugin-alt-text-generator

0

Stars

0

Forks

0

Open Issues

1 months ago

Last Updated

15

Weekly Downloads

v1.0.0

npm Version

146.5 KB

Unpacked Size

0

Dependencies

GitHub stars

00 since Oct 25

Show data
GitHub stars by day (UTC)
DateStars
Dec 6, 20260
Dec 5, 20260
Dec 4, 20260
Dec 3, 20260
Dec 2, 20260
Dec 1, 20260
Nov 30, 20260
Nov 29, 20260
Nov 28, 20260
Nov 27, 20260
Nov 26, 20260
Nov 25, 20260
Nov 24, 20260
Nov 23, 20260
Nov 22, 20260
Nov 21, 20260
Nov 20, 20260
Nov 19, 20260
Nov 18, 20260
Nov 17, 20260
Nov 16, 20260
Nov 15, 20260
Nov 14, 20260
Nov 13, 20260
Nov 12, 20260
Nov 11, 20260
Nov 10, 20260
Nov 9, 20260
Nov 8, 20260
Nov 7, 20260
Nov 6, 20260
Nov 5, 20260
Nov 4, 20260
Nov 3, 20260
Nov 2, 20260
Nov 1, 20260
Oct 31, 20260
Oct 30, 20260
Oct 29, 20260
Oct 28, 20260
Oct 27, 20260
Oct 26, 20260
Oct 25, 20260
npm weekly downloads

15+15 since Oct 31

Show data
npm weekly downloads by day (UTC)
DateWeekly downloads
Dec 6, 202615
Dec 5, 202614
Dec 4, 202614
Dec 3, 202619
Dec 2, 202618
Dec 1, 202615
Nov 30, 202615
Nov 29, 202613
Nov 28, 202615
Nov 27, 202615
Nov 26, 20269
Nov 25, 20268
Nov 24, 202610
Nov 23, 202610
Nov 22, 202611
Nov 21, 202615
Nov 20, 202620
Nov 19, 202624
Nov 18, 202628
Nov 17, 202628
Nov 16, 202632
Nov 15, 202634
Nov 14, 202630
Nov 13, 202645
Nov 12, 202644
Nov 11, 202654
Nov 10, 202655
Nov 9, 202677
Nov 8, 2026375
Nov 7, 2026372
Nov 6, 2026351
Nov 5, 2026348
Nov 4, 2026334
Nov 3, 2026330
Nov 2, 2026303
Nov 1, 20260
Oct 31, 20260

Each point is npm's rolling 7-day download count.

Health Score

61/100Good

Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.

Badge for your README

Payload Directory health badge
Markdown
[![Payload Directory](https://payloaddirectory.dev/badge/1439985828-root.svg)](https://payloaddirectory.dev/plugins/1439985828-root)
HTML
<a href="https://payloaddirectory.dev/plugins/1439985828-root"><img src="https://payloaddirectory.dev/badge/1439985828-root.svg" alt="Payload Directory"></a>
Updated Oct 30, 2026Created Oct 30, 2026Published Oct 30, 2026

README

Alt Text Generator for Payload CMS

Alt Text Generator logo

Write SEO-friendly alt text for the images in your Payload media library. Generate it for one image, for a selection, for every image that is missing it, or automatically when an image is uploaded. 131 languages.

Get a free API key

The Alt Text Generator page in the Payload admin

What you get

  • A button on every image. Open an image in your media collection and click Generate alt text.
  • A bulk page. An Alt Text Generator link appears in the admin sidebar. It scans your images, shows the ones with no alt text, generates all of them or only the ones you tick, lets you edit the results, and saves them together.
  • Automatic mode. Turn it on and new uploads get alt text the moment you save. Replacing an image's file writes new alt text for the new picture.
  • Language and locales. Pick the language of the alt text. On sites with Payload localization, the alt text is written in the language of the locale you are editing.
  • Credits shown in the admin. One credit writes alt text for one image. New accounts get free credits.
  • Your key stays on your server. The API key is only used by the plugin's server code and never reaches the browser.

Requirements

  • Payload 3.92 or newer (tested on 3.92.1 with SQLite and local file storage)
  • Node.js 20.9 or newer
  • An Alt Text Generator API key (get one free)

Install

npm install @balt1794/payload-plugin-alt-text-generator

Add the plugin to payload.config.ts and list the upload collections that hold your images:

import { buildConfig } from 'payload'
import { altTextGenerator } from '@balt1794/payload-plugin-alt-text-generator'

export default buildConfig({
  // ...
  plugins: [
    altTextGenerator({
      collections: ['media'],
      autoGenerate: true, // optional, can also be switched in the admin
    }),
  ],
})

Put your key in .env:

ALT_TEXT_GENERATOR_API_KEY=your-key-here

Then run:

npx payload generate:importmap

The import map tells Payload where to find the plugin's admin parts, so run it once after installing and restart your dev server.

Database changes (SQL databases only)

The plugin adds one small hidden settings table (it stores the auto-generate switch and the language you choose on the Alt Text Generator page). If your collection does not already have an alt text field, the plugin adds that too.

  • MongoDB: nothing to do.
  • SQLite or Postgres: while you run the dev server, Payload updates the tables for you. For production, create and run a migration, as you do for any schema change:
npx payload migrate:create
npx payload migrate

Where to find it in the admin

The plugin shows up in three places, so you can always tell it is installed:

  1. Dashboard. A note says "Alt Text Generator is active" and links to the bulk page.
  2. Sidebar. A new Alt Text Generator link opens the bulk page.
  3. Every image. Open an image in your media collection. The alt text field has a Generate alt text button under it.

Dashboard note and sidebar link

Use it

One image

Open the image, click Generate alt text, and save. With automatic mode on, a new image gets its alt text when you save it, so there is no need to click anything.

The Generate alt text button on an image

Many images

  1. Open Alt Text Generator in the sidebar. It scans your images.
  2. Missing shows images with no alt text. All shows everything.
  3. Tick the images you want, or leave all unticked.
  4. Click Generate selected or Generate all missing.
  5. Read the results, change anything you like, then click Save changes.

Generate all missing skips images that already have alt text. Tick an image to generate it anyway, or turn on Overwrite images that already have alt text.

Bulk page with images missing alt text

Settings on the bulk page

  • Write alt text automatically when an image is uploaded. Saved in the database, so you can change it without editing code.
  • Language. The language of the alt text.

Options

OptionDefaultWhat it does
collectionsrequiredUpload collections to add alt text to.
apiKeyALT_TEXT_GENERATOR_API_KEYYour API key. Prefer the environment variable.
autoGeneratefalseStarting value for automatic mode. Whatever an admin saves on the bulk page takes over.
languageenglishStarting language. Whatever an admin saves takes over.
altFieldaltThe field that holds the alt text. It is created if the collection does not have it.
accessany signed-in userDecides who may generate alt text, check credits and change the settings.
disabledfalseTurns the plugin off but keeps its fields so your database stays consistent.

Limit who can generate

Each generation uses one credit. If your users collection includes people who are not staff, such as customers or members, limit the plugin to your team:

altTextGenerator({
  collections: ['media'],
  access: ({ req }) => req.user?.role === 'admin',
})

Sites with several languages

If Payload localization is on, the bulk page shows a Locale dropdown instead of a language dropdown. The alt text is generated in the language of the locale (for example es writes Spanish) and saved into that locale. Make your alt field localized: true to keep a separate alt text per locale.

Privacy

When you generate alt text, a resized copy of the image (JPEG, up to 1024 px) and your API key are sent from your Payload server to alttextgeneratorai.com. Images are not stored by the plugin. Nothing is sent from the browser.

Troubleshooting

What you seeWhat to do
No Alt Text Generator link in the sidebarRun npx payload generate:importmap and restart.
"No API key"Set ALT_TEXT_GENERATOR_API_KEY in .env and restart.
"Invalid API key"Copy the key again from your dashboard.
"No credits left on this API key"Add credits at alttextgeneratorai.com.
"You do not have permission to do this"Your access function returned false for this user.
Database error about a missing table or columnRun the migration steps above.

Support

[email protected], or open an issue on GitHub.

License

MIT © Bryam Loaiza

Similar plugins