Skip to content

Image Generation

POST /v1/images/generations

Text-to-image endpoint. Returns an image URL or base64 encoding (controlled by response_format).

Request parameters

ParameterTypeRequiredDescription
modelstringImage model, e.g. dall-e-3, gpt-image-1
promptstringImage description prompt
nintegerNumber of images (default 1)
sizestringImage size, e.g. 1024x1024, 1792x1024, 1024x1792
qualitystringQuality tier (model-dependent, e.g. standard / hd)
stylestringStyle (vivid / natural, DALL·E 3 only)
response_formatstringurl (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"
ParameterDescription
imageOriginal image file (PNG, up to 4MB, must have an alpha channel)
maskMask file (PNG; white areas are the regions to edit)
promptDescription of the edit instruction

Size reference

ModelSupported sizes
DALL·E 31024x1024, 1792x1024, 1024x1792
DALL·E 2256x256, 512x512, 1024x1024
gpt-image-11024x1024, 1536x1024, 1024x1536, auto

OpenAI-compatible · Multimodal AI gateway