Skip to main content
The /v1/images/generations endpoint generates images from text prompts. It is compatible with the OpenAI Images API and supports models including gpt-image-2 and Gemini image generation models available through Flatkey.

Endpoint

Request

Headers

Body parameters

model
string
required
Image model ID. Example: "gpt-image-2", "gemini-3-pro-image", "gemini-2.5-flash-image".
prompt
string
required
Text description of the image to generate. More detailed prompts produce better results.
n
integer
Number of images to generate. Default: 1. Maximum varies by model.
size
string
Image dimensions. Common values: "256x256", "512x512", "1024x1024", "1792x1024", "1024x1792". Support varies by model.
quality
string
Image quality setting. Values: "standard" or "hd". Default: "standard". Only supported by some models.
response_format
string
"url" (default) — returns a temporary URL to the image. "b64_json" — returns base64-encoded image data.

Example requests

Response

Response fields

created
integer
Unix timestamp of when the request was fulfilled.
data
array
Array of generated image objects.
Image URLs are temporary and expire after a short period. Download and store images you want to keep.