Edit image
Edits an existing image from a prompt, optionally with an inpainting mask. Compatible with the OpenAI /v1/images/edits API — send multipart/form-data (not JSON).
Only image models flagged edit-capable work here: call /v2/models/all and use a model whose supports_edits is true. Each such model also reports an edit block with supports_mask and max_input_images. A mask is accepted only by models whose edit.supports_mask is true (OpenAI GPT-Image, FLUX inpaint/fill, Ideogram); natural-language and multi-reference edit models (Gemini Flash Image, FLUX.2, Seedream, Nano Banana) reject a mask with 400. Images are returned as base64-encoded data (b64_json).
Provider-specific knobs (e.g. OpenAI input_fidelity/background, fal strength/guidance_scale) can be sent in the parameters JSON field; OpenAI background, input_fidelity and output_format may also be sent as their own form fields.
https://api.deutschlandgpt.de/v2/images/editsExample request
curl https://api.deutschlandgpt.de/v2/images/edits \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY"curl https://api.deutschlandgpt.de/v2/images/edits \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY"import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/images/edits",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
)
print(response.json())import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/images/edits",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
)
print(response.json())const response = await fetch('https://api.deutschlandgpt.de/v2/images/edits', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
},
});
console.log(await response.json());const response = await fetch('https://api.deutschlandgpt.de/v2/images/edits', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
},
});
console.log(await response.json());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 edit response
createdintegerUnix timestamp
dataobject[]b64_jsonstringBase64-encoded edited image data
revised_promptstringThe prompt as revised by the model (when provided)
usageobjectimageCountintegerqualitystringdimensionstringcostInEuronumberActual cost in EUR for this request
Response codes
Image edit response
objectMissing image/prompt, a mask on a mask-less model, or too many input images
Unauthorized
Insufficient credits
Model not found or does not support editing