Skip to content

WriteAlt – AI Alt Text & SEO

WriteAlt adds a Studio tool for reviewing and generating alt text across configured image fields. Generate descriptions for individual images or selected batches, and save them to existing alt fields on draft documents.

Install command

npm install @writealt/sanity-plugin-writealt

WriteAlt for Sanity Studio

Find and fill missing image alt text across Sanity drafts. WriteAlt adds a Studio tool where editors can see images alongside their document titles, select the images they want to work on, and save descriptions to existing image fields.

What you can do

  • Find gaps across configured content types. Review images from existing drafts and filter for missing descriptions on the current page.
  • Generate for one image or a batch. Choose a language, writing style, and optional keywords. Fill only missing descriptions, or explicitly regenerate an existing one.
  • Review before publishing. WriteAlt saves to the configured alt field on the current draft. It doesn't publish documents, create drafts, replace images, or change asset references.

Example: review blog post hero images

Map the blog post's hero image field, open WriteAlt in Studio, and choose Missing alt. Select the draft images you want to update and choose Generate for selected. Review the descriptions in the drafts before publishing through your normal editorial workflow.

Install and configure

The package declares support for Sanity Studio 4, 5, and 6 with React 19. Use a Node.js version supported by your Studio and the package (Node.js 22.12+ for Studio 6). Installation is free. Generation requires a WriteAlt API key, uses account credits, and needs an authenticated server route on the same origin as Studio. A standalone static Studio cannot generate descriptions with this release.

npm install @writealt/sanity-plugin-writealt

In sanity.config.ts, add the tool to your existing plugins:

import { writeAlt } from '@writealt/sanity-plugin-writealt'

// In defineConfig({...}):
plugins: [
  writeAlt({
    fields: [{ type: 'post', field: 'heroImage', altField: 'alt' }],
    relayPath: '/api/writealt-sanity',
  }),
]

Map one existing top-level image field per document type. The image object must already define an editable string field for alt text. The document must already have a draft and the editor must have permission to update it. Your frontend still needs to render the configured alt field.

Set up the generation route

For a Studio hosted with an existing Next.js app or compatible Node server, add a server route on the same origin as Studio. For example, in app/api/writealt-sanity/route.ts:

import { createWriteAltStudioRelay } from '@writealt/sanity-plugin-writealt/relay'
import { editorCanUseWriteAlt } from '@/server/editor-auth'

export const runtime = 'nodejs'
export const POST = createWriteAltStudioRelay({
  origin: 'https://studio.example.com',
  projectId: 'yourProjectId',
  dataset: 'production',
  verifyRequest: editorCanUseWriteAlt,
})

Implement editorCanUseWriteAlt using your site's server-side session and permission checks. It must return true only for logged-in, authorized editors. Set WRITEALT_API_KEY on the host, never in a browser-exposed SANITY_STUDIO_ variable. The route accepts only the configured origin and public Sanity CDN assets from the configured project and dataset. For static Studio without a compatible route, omit relayPath to browse images without generation.

Data and support

Your server route sends image bytes and writing preferences to the WriteAlt API. The plugin saves descriptions through your signed-in Sanity editor session.

npm package | Privacy policy | Contact support