> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gistmag.co.uk/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate Alt Text (ATG)

> Generate alt text using the ATG endpoint

## 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.

<Endpoint method="post" url="/atg/generate" />

## Request Body

<ParamField body="image_url" type="string" required>
  The URL of the image to generate alt text for
</ParamField>

<ParamField body="api_key" type="string" required>
  Your GistMag API key
</ParamField>

<ParamField body="mode" type="string" default="short">
  The length of alt text to generate. Options: `short`, `long`, `seo`
</ParamField>

## Example Request

### cURL

```bash theme={null}
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

```python theme={null}
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.

<ResponseField name="alt_text" type="string">
  The generated alt text description
</ResponseField>

<ResponseField name="confidence" type="number">
  Confidence score (0-1) of the generated alt text
</ResponseField>

<ResponseField name="credits_used" type="number">
  Number of credits consumed for this request
</ResponseField>

### Example Response

```json theme={null}
{
  "alt_text": "A beautiful sunset over the ocean with orange and pink hues",
  "confidence": 0.95,
  "credits_used": 1
}
```

<Note>
  This endpoint is maintained for backward compatibility. New integrations should use `/generate`.
</Note>
