Skip to Content
Uncodie Market Fit está disponible 🎉
Rest APIAiAI Image Generation API

AI Image Generation (/api/ai/image)

Try it

AI Image Generation

Generate images using Azure OpenAI (DALL·E) with fallback to Vercel AI Gateway.

Endpoint

POST /api/ai/image

Request Body

FieldTypeDescriptionRequired
promptstringText prompt to generate the imageYes
provider’azure’ | ‘vercel’Provider to useNo (default: ‘azure’)
size’256x256’ | ‘512x512’ | ‘1024x1024’Output sizeNo (default: ‘1024x1024’)
nnumberNumber of images to generateNo (default: 1)
quality’standard’ | ‘hd’Quality level (Azure)No

Example (Azure)

{ "prompt": "a watercolor fox in a forest", "provider": "azure", "size": "1024x1024", "n": 1, "quality": "hd" }

Example (Vercel fallback)

{ "prompt": "a watercolor fox in a forest", "provider": "vercel" }

Response

{ "provider": "azure", "images": [ { "url": "..." } ] }

Environment

  • Azure: AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, AZURE_OPENAI_IMAGES_DEPLOYMENT
  • Vercel fallback: VERCEL_AI_GATEWAY_OPENAI, VERCEL_AI_GATEWAY_API_KEY
Last updated on