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. Supported sizes and quality levels depend on the model. Available models include OpenAI/Azure DALL·E and GPT-Image and Google Imagen — swap the model string to change provider. Use /v2/models/all to list every image model.
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": {},
"moderation": "low"
}'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": {},
"moderation": "low"
}'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": {},
"moderation": "low"
},
)
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": {},
"moderation": "low"
},
)
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": {},
"moderation": "low"
}),
});
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": {},
"moderation": "low"
}),
});
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, for models that support one.
output_formatstringoptionalEncoding of the generated image, for models that let you choose it. Defaults to the provider default.
parametersobjectoptionalProvider-specific passthrough merged into the upstream request, for models that take extra options. Ignored by models that do not.
moderationstringoptionalContent-moderation level for OpenAI GPT image models: low (default) for less restrictive filtering, or auto for OpenAI's standard filtering. Ignored by every other model and host, including Azure.
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