curl --request POST \
--url https://api.dreamto.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2.6-sunburst-economy",
"prompt": "An orange cat in an astronaut helmet floating in space with Earth behind it, photorealistic",
"size": "1024x1024",
"quality": "medium"
}
'{
"created": 1794643200,
"data": [
{
"b64_json": "<BASE64_IMAGE_DATA>"
}
],
"background": "opaque",
"output_format": "png",
"quality": "medium",
"size": "1024x1024",
"usage": {
"input_tokens": 29,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 29
},
"output_tokens": 1756,
"output_tokens_details": {
"image_tokens": 1756,
"text_tokens": 0
},
"total_tokens": 1785
}
}{
"error": {
"code": "invalid_request",
"http_status": 400,
"message": "Invalid request.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"http_status": 401,
"message": "Unauthorized.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_balance",
"http_status": 402,
"message": "Insufficient balance.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "insufficient_balance_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"http_status": 429,
"message": "Rate limit exceeded. Please try again later.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "rate_limit_error"
}
}{
"error": {
"code": "service_unavailable",
"http_status": 502,
"message": "Service temporarily unavailable. Please try again later.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "api_error"
}
}Create image
Generates images from a prompt. The request is synchronous and returns the images as Base64 when done, usually in 10–90 seconds (longer for high quality and large sizes); set the client timeout to at least 5 minutes. With stream: true the response is SSE.
curl --request POST \
--url https://api.dreamto.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2.6-sunburst-economy",
"prompt": "An orange cat in an astronaut helmet floating in space with Earth behind it, photorealistic",
"size": "1024x1024",
"quality": "medium"
}
'{
"created": 1794643200,
"data": [
{
"b64_json": "<BASE64_IMAGE_DATA>"
}
],
"background": "opaque",
"output_format": "png",
"quality": "medium",
"size": "1024x1024",
"usage": {
"input_tokens": 29,
"input_tokens_details": {
"image_tokens": 0,
"text_tokens": 29
},
"output_tokens": 1756,
"output_tokens_details": {
"image_tokens": 1756,
"text_tokens": 0
},
"total_tokens": 1785
}
}{
"error": {
"code": "invalid_request",
"http_status": 400,
"message": "Invalid request.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"http_status": 401,
"message": "Unauthorized.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_balance",
"http_status": 402,
"message": "Insufficient balance.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "insufficient_balance_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"http_status": 429,
"message": "Rate limit exceeded. Please try again later.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "rate_limit_error"
}
}{
"error": {
"code": "service_unavailable",
"http_status": 502,
"message": "Service temporarily unavailable. Please try again later.",
"request_id": "req_7c1e9a4b2d3f5a6b8c9d0e1f",
"type": "api_error"
}
}Authorizations
Body
Request body of image generation.
Rendering quality; higher is slower and uses more output tokens.
Allowed values:
auto: Chosen by the model (default).low: Low: fastest and cheapest, good for drafts.medium: Medium.high: High: best detail and text, slowest.xhigh: Extra high: finer texture and small text, with more latency and output tokens.max: Maximum: the slowest and most output tokens; OpenAI recommends it only when lower tiers miss a quality requirement.
auto, low, medium, high, xhigh, max Output image format.
Allowed values:
png: PNG (default).jpeg: JPEG: smaller and faster.webp: WebP.gif: Animated GIF (9 frames by default upstream); no streaming, previews oroutput_compression.svg: SVG vector: generations only,nmust be 1 andsvg.modelis required; no streaming, previews oroutput_compression.
png, jpeg, webp, gif, svg How much the model plans before rendering; default high. More planning suits complex layouts and many elements but can add latency and unwanted changes. It is independent of quality: when the layout is right but small text is hard to read, raise quality, not complexity.
Allowed values:
low: Least planning and fastest, for simple images.medium: Moderate planning.high: Most planning (default), for complex layouts and many elements.
low, medium, high Response
Images generated. With stream: true the body is text/event-stream.
Generation result.
Actual output format.
Allowed values:
png: PNG (default).jpeg: JPEG: smaller and faster.webp: WebP.gif: Animated GIF (9 frames by default upstream); no streaming, previews oroutput_compression.svg: SVG vector: generations only,nmust be 1 andsvg.modelis required; no streaming, previews oroutput_compression.
png, jpeg, webp, gif, svg 
