Gemini AI Alt Text Generator


Generate concise, SEO-friendly alt text for images using Google’s Gemini model — one image at a time. Simple setup, live progress, and built for WordPress.

Auto Alt Text Generator inspects images in your Media Library that are missing alt text and uses Google Gemini (single-image endpoint) to generate a short, accurate alt attribute suitable for accessibility and SEO.
generateContent endpoint).Good alt text improves accessibility for screen-reader users and gives search engines contextual clues about images. This plugin saves time by producing consistent, concise alt text for images you already uploaded.
wp-content/plugins/.Version: 2.2) and different URLs for Plugin URI and Author URI if you plan to publish to the WordPress directory.Get your key from Google AI Studio: https://aistudio.google.com/app/apikey.
Enter the API key on the plugin settings page (or leave it in the plugin file while testing). The plugin sends a single-image request to: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent
Alt Text (attachment excerpt / _wp_attachment_image_alt).The plugin uses the single-image generateContent endpoint to avoid JSON batch format errors that happen when trying to send many images in one request. This approach is more compatible with servers that can’t easily assemble large batch payloads or with APIs that expect one `contents` object per call.
This is the payload structure the plugin sends for a single image request (image data is base64-encoded):
{
"contents":[
{
"parts":[
{ "text": "Write a short and clear alt text (max 125 characters) for this image..." },
{
"inline_data": {
"mime_type": "image/jpeg",
"data": "BASE64_IMAGE_DATA"
}
}
]
}
],
"generationConfig": {
"temperature": 0.4,
"maxOutputTokens": 60
}
}
Response parsing looks for candidates[0].content.parts[0].text to extract the generated alt text.
Version header to contain only digits and periods (for example 2.2). Remove any extra text like “-beta” or “(test)”.wp-config.php and check wp-content/debug.log for plugin errors.error_log() or temporarily store responses to a local file for inspection.Yes — the plugin prompts the model to return concise descriptive text only. Still, always review output for accuracy if images are sensitive or branded.
Yes — but the plugin processes images sequentially (one API call per image). For large libraries you may want to add rate-limit handling, retries, or process in smaller manual batches to avoid hitting API quotas.
You set the key on the plugin settings page or temporarily place it in the plugin file during testing. Recommended: store it in the plugin settings so non-developers can manage it.
