Skip to main content
POST
/
atg
/
generate
Generate Alt Text (ATG)
curl --request POST \
  --url https://api.example.com/atg/generate \
  --header 'Content-Type: application/json' \
  --data '
{
  "image_url": "<string>",
  "api_key": "<string>",
  "mode": "<string>"
}
'
{
  "alt_text": "<string>",
  "confidence": 123,
  "credits_used": 123
}

Overview

Generate alt text for a single image using the ATG endpoint. This endpoint provides the same functionality as /generate but uses a different route for compatibility with existing integrations.

Request Body

image_url
string
required
The URL of the image to generate alt text for
api_key
string
required
Your GistMag API key
mode
string
default:"short"
The length of alt text to generate. Options: short, long, seo

Example Request

cURL

curl -X POST https://api.gistmag.co.uk/atg/generate \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://example.com/image.jpg",
    "api_key": "your_api_key_here",
    "mode": "short"
  }'

Python

import requests

url = "https://api.gistmag.co.uk/atg/generate"

payload = {
    "image_url": "https://example.com/image.jpg",
    "api_key": "your_api_key_here",
    "mode": "short"
}

headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(f"Status Code: {response.status_code}")
print(f"Response: {response.json()}")

# If successful
if response.status_code == 200:
    data = response.json()
    print(f"Alt Text: {data.get('alt_text')}")

Response

The response format is identical to the /generate endpoint.
alt_text
string
The generated alt text description
confidence
number
Confidence score (0-1) of the generated alt text
credits_used
number
Number of credits consumed for this request

Example Response

{
  "alt_text": "A beautiful sunset over the ocean with orange and pink hues",
  "confidence": 0.95,
  "credits_used": 1
}
This endpoint is maintained for backward compatibility. New integrations should use /generate.