Image generation
Text-to-image and image-to-image generation through the OpenAI-shape /v1/images/generations endpoint. Swap models by ID — Black Forest Labs Flux, DALL-E 3, Google Imagen 3, Stable Diffusion XL, Ideogram, Recraft. Cheap edge models return inline; the heaviest frontier models use async jobs.
Generate an image
POST /v1/images/generations { "model": "bfl/flux-2-klein-9b", "prompt": "a neon ramen shop in the rain, cinematic, 35mm", "size": "1024x1024", "n": 1, "response_format": "url" } // → { "created": ..., "data": [{ "url": "https://media.aigateway.sh/..." }] }
Picking a model
| Model | Strength |
|---|---|
bfl/flux-2-klein-9b | Fast, photorealistic, cheap — great default. |
bfl/flux-2-pro | Top-quality Flux, slower, higher cost. |
openai/dall-e-3 | Strong prompt adherence, good typography. |
google/imagen-3 | Best hands + anatomy, photorealism. |
stability-ai/sdxl | Open-weight, tune with custom LoRAs via BYOK. |
ideogram/ideogram-v3 | Best-in-class text rendering in images. |
Response formats
response_format accepts "url" (default — 24h-signed URL from media.aigateway.sh) or "b64_json" (inline base64, ideal for serverless).
Image-to-image + edits
/v1/images/edits takes a source image file + optional mask. Supported on Flux, SDXL, and DALL-E — the gateway translates to each provider's native editing API.
Async / long-running models
High-quality text-to-video models and the heaviest Flux variants run on the async-job pattern — submit returns 202, poll or webhook on completion. The body shape is the same; the gateway auto-detects which pattern a given model needs.