v1

latestOpenAPI 3.0.3raw.githubusercontent.com2023-03-2673842.0 KB
v1/generation

text-to-image

Generate a new image from a text prompt

post/generation/{engine_id}/text-to-image

Path parameters

engine_idstring required
Example:stable-diffusion-v1-5

Headers

Accept'application/json' | 'image/png'

The format of the response. Leave blank for JSON, or set to 'image/png' for a PNG image.

Organizationstring

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.

Request body

heightinteger

Height of the image in pixels. Must be in increments of 64 and pass the following validation:

  • For 768 engines: <span style='display: flex; justify-content: flex-start; gap:8px'>589,824 <span></span> height * width <span></span> 1,048,576</span>
  • All other engines: <span style='display: flex; justify-content: flex-start; gap:8px'>262,144 <span></span> height * width <span></span> 1,048,576</span>
widthinteger

Width of the image in pixels. Must be in increments of 64 and pass the following validation:

  • For 768 engines: <span style='display: flex; justify-content: flex-start; gap:8px'>589,824 <span></span> height * width <span></span> 1,048,576</span>
  • All other engines: <span style='display: flex; justify-content: flex-start; gap:8px'>262,144 <span></span> height * width <span></span> 1,048,576</span>
cfg_scalenumber

How strictly the diffusion process adheres to the prompt text (higher values keep your image closer to your prompt)

clip_guidance_preset'FAST_BLUE' | 'FAST_GREEN' | 'NONE' | 'SIMPLE' | 'SLOW' | 'SLOWER' | 'SLOWEST'
sampler'DDIM' | 'DDPM' | 'K_DPMPP_2M' | 'K_DPMPP_2S_ANCESTRAL' | 'K_DPM_2' | 'K_DPM_2_ANCESTRAL' | 'K_EULER' | 'K_EULER_ANCESTRAL' | 'K_HEUN' | 'K_LMS'

Which sampler to use for the diffusion process. If this value is omitted we'll automatically select an appropriate sampler for you.

samplesinteger

Number of images to generate

seedinteger

Random noise seed (omit this option or use 0 for a random seed)

stepsinteger

Number of diffusion steps to run

Example request

{
  "cfg_scale": 7,
  "clip_guidance_preset": "FAST_BLUE",
  "height": 512,
  "sampler": "K_DPM_2_ANCESTRAL",
  "samples": 1,
  "seed": 0,
  "steps": 75,
  "text_prompts": [
    {
      "text": "A lighthouse on a cliff",
      "weight": 1
    }
  ],
  "width": 512
}

Response

OK response.

base64string

Image encoded in base64

finishReason'SUCCESS' | 'ERROR' | 'CONTENT_FILTERED'
seednumber

The seed associated with this image

Example response

[
  {
    "base64": "Sed corporis modi et.",
    "finishReason": "CONTENT_FILTERED",
    "seed": 1229191277
  }
]
All 7 operations