If your site has images without alt text, you have two problems:
- Screen readers can't describe them to visually impaired users
- You might get sued -- ADA lawsuits over web accessibility hit record numbers in 2025
Manually writing alt text for hundreds of images is tedious. So I built an API that does it with one call per image.
The API
Send an image URL, get WCAG 2.1 compliant alt text back:
curl -X POST https://api.origrid.io/v1/alt/generate \
-H "Content-Type: application/json" \
-d '{"image_url": "https://picsum.photos/id/42/800/600"}'
Response:
{
"alt_text": "Two teal coffee cups on saucers and a smartphone on a rustic wooden table in a cafe",
"alt_text_length": 84,
"wcag_compliant": true
}
That's it. No complex setup, no image upload, no training. Send a URL, get alt text.
What makes it WCAG compliant
The API follows WCAG 2.1 Success Criterion 1.1.1:
- Max 125 characters -- screen readers handle short alt text better
- Describes content, not decoration -- "sunset over beach" not "beautiful photo"
- Never starts with "Image of" or "Photo of" -- screen readers already announce it's an image
- Specific -- mentions subjects, actions, colors, and setting
The wcag_compliant boolean in the response tells you programmatically whether the generated text meets the criteria.
Real examples
| Image | Generated alt text |
|---|---|
| Beach sunset | Golden sunset over sandy beach with turquoise waters and palm tree silhouettes |
| Coffee shop | Two teal coffee cups on saucers and a smartphone on a rustic wooden table in a cafe |
| Dog portrait | A black labrador puppy sits on a wooden floor, looking up with big dark eyes |
| Mountain landscape | Mountain lake surrounded by pine trees with snow-capped peaks reflected in calm blue water |
All under 125 characters, all descriptive, all screen-reader friendly.
Bulk processing with Python
Here's how to add alt text to every image on a page:
import requests
from bs4 import BeautifulSoup
RAPIDAPI_KEY = "your_key"
HEADERS = {
"X-RapidAPI-Key": RAPIDAPI_KEY,
"Content-Type": "application/json"
}
def get_alt_text(image_url):
resp = requests.post(
"https://origrid-alt-text.p.rapidapi.com/v1/alt/generate",
headers=HEADERS,
json={"image_url": image_url}
)
return resp.json()["alt_text"]
# Fetch page and find images without alt text
page = requests.get("https://yoursite.com/page")
soup = BeautifulSoup(page.text, "html.parser")
for img in soup.find_all("img"):
if not img.get("alt"):
alt = get_alt_text(img["src"])
img["alt"] = alt
print(f"Added: {alt}")
# Save the updated HTML
with open("updated_page.html", "w") as f:
f.write(str(soup))
Why not use ChatGPT directly?
You could, but:
- ChatGPT doesn't enforce 125 char limit -- you'd need to prompt-engineer and validate
-
No
wcag_compliantflag -- you'd build your own validation - API integration is messy -- ChatGPT's API isn't designed for single-purpose endpoints
- Cost -- GPT-4 vision is expensive for bulk image processing
Origrid Alt Text is a purpose-built endpoint. One call, one response, validated output.
Try it
Origrid Alt Text on RapidAPI -- free tier, no setup.
Or test directly:
# Try with any public image URL
curl -X POST https://api.origrid.io/v1/alt/generate \
-H "Content-Type: application/json" \
-d '{"image_url": "https://picsum.photos/id/237/800/600"}'
The API also supports JPEG, PNG, WebP, and GIF. Full OpenAPI docs at api.origrid.io/docs.
How do you handle alt text at scale? I'm curious about CMS integrations people would find useful. Drop a comment.
Top comments (0)