Text-to-image
Generate an image from a text prompt.
Using SDXL 1.0
Use stable-diffusion-xl-1024-v1-0 as the engine_id of your request and pass in height & width as one of the following combinations:
- 1024x1024 (default)
- 1152x896
- 896x1152
- 1216x832
- 1344x768
- 768x1344
- 1536x640
- 640x1536
SDXL 1.0 Pricing
When specifying 30 steps or fewer, generation costs 0.9 credits.
When specifying above 30 steps, generation cost is determined using the following formula:
cost = 0.9 * (steps / 30)
Using SD 1.6
SD1.6 is a flexible-resolution base model allowing you to generate non-standard aspect ratios. The model is optimized for a resolution of 512 x 512 pixels. To generate 1 megapixel outputs, we recommend using SDXL 1.0, which is available at the same price.
Pass in stable-diffusion-v1-6 as the engine_id of your request and ensure the height & width you pass in adhere to the following restrictions:
- No dimension can be less than 320 pixels
- No dimension can be greater than 1536 pixels
- Height and width must be specified in increments of 64
- The default resolution is 512 x 512
Path parameters
Headers
Allows for requests to be scoped to an organization other than the user's default. If not provided, the user's default organization will be used.
Used to identify the source of requests, such as the client application or sub-organization. Optional, but recommended for organizational clarity.
Used to identify the version of the application or service making the requests. Optional, but recommended for organizational clarity.
Request body
Example request
{
"cfg_scale": 7,
"height": 512,
"width": 512,
"sampler": "K_DPM_2_ANCESTRAL",
"samples": 1,
"seed": 0,
"steps": 30,
"text_prompts": [
{
"text": "A lighthouse on a cliff",
"weight": 1
}
]
}Response
Generation successful.
Example response
{
"artifacts": [
{
"finishReason": "CONTENT_FILTERED",
"seed": 1229191277
}
]
}