Generate Image
Generates an AI image using the provided prompt.
This operation costs 1 credit.
Endpoint
model_id
string
Yes
Unique identifier of the model.
prompt
string
Yes
Prompt to use.
negative_prompt
string
No
Negative Prompt to use.
num_images
integer
No
Number of images to generate. Range: 1-8. Default: 1.
upscale
boolean
No
X4 super-resolution. Default: false.
ratio
string
No
Possible values: portrait
, square
. Default: portrait
.
callback
string
No
A URL that will be called when the prompt is done processing. If not provided, the endpoint will run in sync mode and return the response when the image generation is complete.
Callback
The callback
parameter allows you to specify a URL that will be called when the image generation is complete. This is useful for asynchronous processing, where you want to receive a notification when the image is ready.
The callback
URL should be a valid URL that can receive a POST request from the API. This URL will be called by the API when the image generation is complete, and it will receive the generated image(s) as a JSON payload.
Here are some options for the callback
URL:
Your own server: You can set up a server to receive the callback request. You'll need to create an endpoint that can receive the POST request and process the generated image(s).
Webhook service: You can use a webhook service like Zapier, Integromat, or Webhook.io to receive the callback request.
Cloud function: for example, AWS Lambda, Google Cloud Functions, Azure Functions, or any other cloud function that can receive the callback request.
Sync mode
If the callback
parameter is not provided, the endpoint will run in sync mode. In this mode, the API will generate the image and return the response when the generation is complete.
Request Example
Response
Upon successful generation, the API returns the following response:
Last updated