This is an asynchronous API; only the task_id will be returned. You should use the task_id to request the Task Result API to retrieve the image generation results.
Request Headers
Enum:
application/jsonBearer authentication format, for example: Bearer {{API Key}}.
Request Body
Optional extra parameters for the request.
Response
Use the task_id to request the Task Result API to retrieve the generated outputs.
Example
1. Txt2img request with normal parameters
Please set theContent-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.
Request:
Response:
task_id to get images
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.
You can get images url in imgs of response.
Request:
Response:
2.Txt2img request with lora
Please set theContent-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.
Request:
Response:
task_id to get images
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.
You can get images url in imgs of response.
Request:
Response:
3.Txt2img request with upscale
Please set theContent-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.
Request:
Response:
task_id to get images
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.
You can get images url in imgs of response.
Request:
Response:
4.Txt2img request with SDXL 1.0
Please set theContent-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.
Request:
Response:
task_id to get images
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.
You can get images url in imgs of response.
Request:
Response:
5.Txt2img request with Textual Inversion(embedding)
Please set theContent-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.
Request for textual inversion names:
Response:
Request:
Response:
task_id to get images
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.
You can get images url in imgs of response.
Request:
Response:
6.Txt2img request with nsfw_detection
When setenable_nsfw_detection true, NSFW detection will be enabled, incurring an additional cost of $0.0015 for each generated image.
nsfw_detection_level, nsfw check level, ranging from 0 to 2, with higher levels indicating stricter NSFW detection criteria. The default value is 0. The following table lists the NSFW detection criteria for each level.
- 0: Explicit Nudity, Explicit Sexual Activity, Sex Toys; Hate Symbols.
- 1: Explicit Nudity, Explicit Sexual Activity, Sex Toys; Hate Symbols; Non-Explicit Nudity, Obstructed Intimate Parts, Kissing on the Lips.
- 2: Explicit Nudity, Explicit Sexual Activity, Sex Toys; Hate Symbols; Non-Explicit Nudity, Obstructed Intimate Parts, Kissing on the Lips; Female Swimwear or Underwear, Male Swimwear or Underwear.
Content-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.
Request:
Response:
task_id to get images
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors.
You can get images url in imgs of response. There are two results in reponse.
-
enable_nsfw_detection, when return withtruemeans NSFW detection is enabled. -
nsfw_detection_result, presenting an array of NSFW detection outcomes for each image. The order of elements in the nsfw_detection_result array corresponds one-to-one with the sequence of images in theimagesfield in the response. Thevalidfield denotes the success of the NSFW detection process, while theconfidencefield, ranging from 0 to 100, signifies the confidence level of the NSFW detection result. Higher confidence values, nearing 100, suggest a greater likelihood of the corresponding image containing NSFW content.
Request:
Response: