Create image
Generates one or more images from a text prompt. Compatible with the OpenAI /v1/images/generations API.
Images are returned as base64-encoded data (b64_json). The encoding is PNG for OpenAI/Azure models and follows output_format (default JPEG) for fal.ai models. Supported sizes and quality levels depend on the model. Available models include OpenAI/Azure DALL·E and GPT-Image, Google Imagen, and fal.ai models (flux-schnell, flux-dev, flux-pro-1.1, ideogram-v3, recraft-v3) — swap the model string to change provider. Use /v2/models/all to list every image model.
fal.ai models accept extra knobs (guidance_scale, style, rendering_speed, enable_safety_checker, …) via the parameters passthrough; these are ignored by OpenAI/Azure and Google models.
Example request
curl https://api.deutschlandgpt.de/v2/images/generations \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene mountain lake at sunset, pine trees reflected in calm water, photorealistic",
"model": "dall-e-3",
"n": 1,
"quality": "standard",
"size": "1024x1024",
"response_format": "b64_json",
"seed": 0,
"output_format": "png",
"parameters": {}
}'curl https://api.deutschlandgpt.de/v2/images/generations \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A serene mountain lake at sunset, pine trees reflected in calm water, photorealistic",
"model": "dall-e-3",
"n": 1,
"quality": "standard",
"size": "1024x1024",
"response_format": "b64_json",
"seed": 0,
"output_format": "png",
"parameters": {}
}'import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/images/generations",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
json={
"prompt": "A serene mountain lake at sunset, pine trees reflected in calm water, photorealistic",
"model": "dall-e-3",
"n": 1,
"quality": "standard",
"size": "1024x1024",
"response_format": "b64_json",
"seed": 0,
"output_format": "png",
"parameters": {}
},
)
print(response.json())import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/images/generations",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
json={
"prompt": "A serene mountain lake at sunset, pine trees reflected in calm water, photorealistic",
"model": "dall-e-3",
"n": 1,
"quality": "standard",
"size": "1024x1024",
"response_format": "b64_json",
"seed": 0,
"output_format": "png",
"parameters": {}
},
)
print(response.json())const response = await fetch('https://api.deutschlandgpt.de/v2/images/generations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"prompt": "A serene mountain lake at sunset, pine trees reflected in calm water, photorealistic",
"model": "dall-e-3",
"n": 1,
"quality": "standard",
"size": "1024x1024",
"response_format": "b64_json",
"seed": 0,
"output_format": "png",
"parameters": {}
}),
});
console.log(await response.json());const response = await fetch('https://api.deutschlandgpt.de/v2/images/generations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"prompt": "A serene mountain lake at sunset, pine trees reflected in calm water, photorealistic",
"model": "dall-e-3",
"n": 1,
"quality": "standard",
"size": "1024x1024",
"response_format": "b64_json",
"seed": 0,
"output_format": "png",
"parameters": {}
}),
});
console.log(await response.json());Request body
promptstringrequiredText description of the desired image. Max 1000 characters.
modelstringoptionalModel to use. Defaults to dall-e-3. Use /v2/models to list image models.
nintegeroptionalNumber of images to generate.
qualitystringoptionalImage quality. Common values: standard, hd. Supported values depend on the model.
sizestringoptionalImage dimensions. Common values: 1024x1024, 1792x1024, 1024x1792. Supported values depend on the model.
response_formatstringoptionalResponse format. Only b64_json is currently supported.
seedintegeroptionalOptional seed for reproducible generation. Supported by most fal.ai models.
output_formatstringoptionalEncoding of the generated image (fal.ai models only). Defaults to the provider default.
parametersobjectoptionalProvider-specific passthrough merged into the upstream request (fal.ai only). e.g. { "guidance_scale": 3.5, "style": "realistic_image", "enable_safety_checker": true }. Ignored by OpenAI/Azure/Vertex models.
Response
{
"created": 0,
"data": [
{
"b64_json": "string",
"revised_prompt": "string"
}
],
"usage": {
"imageCount": 0,
"quality": "string",
"dimension": "string",
"costInEuro": 0
}
}{
"created": 0,
"data": [
{
"b64_json": "string",
"revised_prompt": "string"
}
],
"usage": {
"imageCount": 0,
"quality": "string",
"dimension": "string",
"costInEuro": 0
}
}Image generation response
createdintegerUnix timestamp
dataobject[]b64_jsonstringBase64-encoded image data
revised_promptstringThe prompt as revised by the model (DALL-E 3 only)
usageobjectimageCountintegerqualitystringdimensionstringcostInEuronumberActual cost in EUR for this request
Response codes
Image generation response
objectInvalid quality or size for this model
Unauthorized
Insufficient credits
Model not found