Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.thehog.ai/llms.txt

Use this file to discover all available pages before exploring further.

Send a POST request to /api/generate/image to generate an image and receive it as a downloadable binary file. The Hog calls Vertex AI Gemini image models with your prompt and streams the result directly to the response body with a Content-Disposition: attachment header, making it suitable for server-side file saving, piping to object storage, or triggering a browser download.
This endpoint returns raw image bytes, not JSON. If you need the image as base64-encoded data inside a JSON response — for example, to display it in a UI without saving to disk — use POST /api/generate with output: "image" instead.

Request

POST https://api.thehog.ai/api/generate/image
prompt
string
required
The image generation instruction. Describe the image you want in natural language. More detailed prompts generally produce better results.
filename
string
The suggested filename included in the Content-Disposition header (e.g. "hero-banner.png"). The filename is sanitized before use — path separators and special characters are replaced with underscores. If omitted, the filename defaults to generated with an extension matching the image MIME type.

Response

The response body is the raw image file. There is no JSON envelope.
HeaderValue
Content-TypeOne of image/png, image/jpeg, or image/webp depending on what the model returns.
Content-Dispositionattachment; filename="<filename>" — triggers a download in browsers.

Comparison with POST /api/generate

POST /api/generate/imagePOST /api/generate with output: "image"
Response formatRaw binary bytesJSON with imageBase64 string
Use caseSave to disk, pipe to storageDisplay in a web UI, process in memory
Content-DispositionYes, attachmentNo

Example

Use curl with the -O and -J flags to save the file using the server-provided filename:
curl --request POST \
  --url https://api.thehog.ai/api/generate/image \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --output hero-banner.png \
  --data '{
    "prompt": "A clean, modern SaaS dashboard UI screenshot showing a pipeline funnel chart with blue and purple gradients, white background, minimal design.",
    "filename": "hero-banner.png"
  }'