Docs / API Reference / Generate Image
/v1/images/generationsGenerate Image
OpenAI-compatible image generation. The response carries the image itself: base64 data for the GPT Image models, a download link (or base64 on request) for Seedream 4.5. No task polling is involved.
#Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Image model ID: gpt-image-2 (image output free, pay only for input), gpt-image-2.6 ($0.04 per image) or seedream-4.5 ($0.05 per image produced) |
prompt | string | Yes | Text description of the image |
n | integer | No | Number of images to generate. Default: 1 |
size | string | No | Output size, model-dependent (e.g. "1024x1024") |
output_format | string | No | gpt-image-2.6 only: png (default), jpeg, webp, gif (animated) or svg |
background | string | No | gpt-image-2.6 only: transparent for a transparent background (png or webp) |
image | string or array | No | seedream-4.5 only: reference pictures as public URLs or data:image/...;base64,... strings (not billed) |
sequential_image_generation | string | No | seedream-4.5 only: auto to allow a set of related images; disabled (default) for one |
sequential_image_generation_options | object | No | seedream-4.5 only: {"max_images": 1 to 15}, billed per image actually returned |
response_format | string | No | seedream-4.5 only: url (default, valid 24 hours) or b64_json. The GPT Image models always return b64_json |
watermark | boolean | No | seedream-4.5 only: false by default (no watermark); true adds a small "AI generated" mark |
#Example request
curl https://relaydance.com/v1/images/generations \
-H "Authorization: Bearer $RELAYDANCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A photorealistic sunset over snow-capped mountains",
"n": 1
}' | jq -r '.data[0].b64_json' | base64 --decode > sunset.png#Response
{
"created": 1794605056,
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA...",
"revised_prompt": "A photorealistic sunset over snow-capped mountains"
}
]
}With the GPT Image models the image is delivered inline as base64 in data[].b64_json; hosted image URLs are not provided. With gpt-image-2.6 each item also carries width and height, and the top level reports the output_format actually produced.
With seedream-4.5 each item carries a url valid for 24 hours (or b64_json if you asked for it) and its pixel size, and usage.generated_images is the number of images billed at $0.05 each. Samples for reference pictures and image sets are in the Image Generation guide.
#Edit an image
/v1/images/editsImage to image with gpt-image-2.6. Send a multipart form: the source picture in the image file field, plus model and prompt; output_format is optional. The response has the same shape as above, and each image returned costs $0.04.
curl https://relaydance.com/v1/images/edits \
-H "Authorization: Bearer $RELAYDANCE_API_KEY" \
-F model=gpt-image-2.6 \
-F [email protected] \
-F prompt="Turn this picture into a watercolor painting" \
| jq -r '.data[0].b64_json' | base64 --decode > edited.pngclient.images.generate(...) with the base URL set to https://relaydance.com/v1. See the Image Generation guide for SDK samples.