Image Generation
POST /v1/images/generations
Text-to-image endpoint. Returns an image URL or base64 encoding (controlled by response_format).
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | Image model, e.g. dall-e-3, gpt-image-1 |
prompt | string | ✅ | Image description prompt |
n | integer | — | Number of images (default 1) |
size | string | — | Image size, e.g. 1024x1024, 1792x1024, 1024x1792 |
quality | string | — | Quality tier (model-dependent, e.g. standard / hd) |
style | string | — | Style (vivid / natural, DALL·E 3 only) |
response_format | string | — | url (default) or b64_json |
Text-to-image example
bash
curl https://api.idreame.ai/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-d '{
"model": "dall-e-3",
"prompt": "A glass terminal floating under the aurora, cyberpunk style, highly detailed",
"size": "1024x1024",
"quality": "hd",
"n": 1
}'python
from openai import OpenAI
client = OpenAI(
base_url="https://api.idreame.ai/v1",
api_key="sk-xxxxxxxx",
)
response = client.images.generate(
model="dall-e-3",
prompt="A glass terminal floating under the aurora, cyberpunk style, highly detailed",
size="1024x1024",
quality="hd",
n=1,
)
print(response.data[0].url)Response example
json
{
"created": 1752600000,
"data": [
{
"url": "https://.../generated-image.png",
"revised_prompt": "A glass terminal floating in aurora light..."
}
]
}TIP
revised_prompt is the model's optimized version of your original prompt (DALL·E 3 only), reflecting the prompt actually used for generation.
Image editing (image-to-image)
POST /v1/images/edits
Upload an original image and a mask, and modify the specified region according to a prompt. Uses multipart/form-data:
bash
curl https://api.idreame.ai/v1/images/edits \
-H "Authorization: Bearer sk-xxxxxxxx" \
-F "image=@original.png" \
-F "mask=@mask.png" \
-F "model=dall-e-2" \
-F "prompt=Replace the background with a starry sky" \
-F "n=1" \
-F "size=1024x1024"| Parameter | Description |
|---|---|
image | Original image file (PNG, up to 4MB, must have an alpha channel) |
mask | Mask file (PNG; white areas are the regions to edit) |
prompt | Description of the edit instruction |
Size reference
| Model | Supported sizes |
|---|---|
| DALL·E 3 | 1024x1024, 1792x1024, 1024x1792 |
| DALL·E 2 | 256x256, 512x512, 1024x1024 |
| gpt-image-1 | 1024x1024, 1536x1024, 1024x1536, auto |