Skip to main content

image generation

What you can do with this tutorial

You can generate images from the following prompts.

(masterpiece) 1girl maid cat ear starry sky 🔜

(masterpiece) 1girl maid cat ear

Step

To generate images in gpuless.io, use two APIs: image generation and image acquisition.

caution

To perform the following procedure, you need to register APIKEY.

Send request to generate image

First, let's call the image generation API called v1/images/generate. Enter the acquired APIKey for the {YOUR_API_KEY} of the header.

Request

Send post request in Curl.

curl -X POST \
https://api.gpuless.io/v1/images/generate \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {YOUR_API_KEY}' \
-d '{ \
"model":"anything-v4", \
"prompt": "(masterpiece) 1girl maid cat ear", \
"negative_prompt":"nsfw" \
}'

Response

You got an image ID 🎉

{
"image_id": "092cb6da-e1cd-4324-89d4-b7799a9f3166"
}

Send request to get images

Next, you can get the images generated using the v1/images endpoints. Get up to 100 cases.

Request

curl -X GET \
https://api.gpuless.io/v1/images \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {YOUR_API_KEY}'

Response

{
"images": [
{
"status": "generated",
"image_id":"092cb6da-e1cd-4324-89d4-b7799a9f3166",
"metadata": {
"model":"anything-v4",
"prompt":"(masterpiece) 1girl maid cat ear",
"negative_prompt":"nsfw"
},
"image_url": "https://api.gpuless.io/v1/images/092cb6da-e1cd-4324-89d4-b7799a9f3166",
"raw_image": "https://api.gpuless.io/v1/images/092cb6da-e1cd-4324-89d4-b7799a9f3166/raw"
}
]
}