DF-Imagen API Documentation

DF-Imagen API Documentation

URLs

(Both of these endoints have the same options, and support all the features of the other.)

https://imagen.dreamframe.workers.dev/ - Higher Quality, 5-60+ seconds generation time.

https://imagen-v2.dreamframe.workers.dev/ - Lower Quality, 15-20 seconds generation time.


Authentication

All requests require an API key via the key query parameter:

key=df-imagen_<your_key_here>

Keep your key secret. Do not share publicly.


Generate Image

URL Parameters

Parameter Required Description
key Yes Your API key (df-imagen_<your_key>)
prompt Yes Text description of the image
width No Image width in pixels (default 512)
height No Image height in pixels (default 512)

Example Request

https://imagen.dreamframe.workers.dev/?key=df-imagen_3f9a8c1d2b&prompt=delicious%20salad%20with%20lettuce,%20and%20onions

Example Request with Custom Size

https://imagen.dreamframe.workers.dev/?key=df-imagen_3f9a8c1d2b&prompt=delicious%20salad&width=1024&height=768

Note: The response will be the image file itself. Once downloaded, it will no longer be accessible via the same request.


Error Handling & Retry Policy

Code Meaning
401 Invalid or missing API key
400 Bad request / missing parameters
500 Internal server error

Retry Errors:

  1. If you receive an internal server error/unknown error, try changing the prompt by adding or removing a character or more.
  2. If the error persists after changing the prompt, contact support.

⚠️ Avoid repeated retries in a short time to prevent overloading the server.


Optional Parameters

Parameter Description
width Override image width (default 512)
height Override image height (default 512)

Postman Usage:

DreamFrame Imagen Postman (www.postman.com)