Skip to main content

Stable Diffusion 3

Text to image with Stable Diffusion 3


import requests
import json

url = "https://api.imagepipeline.io/sd3/v1"
headers = {
"API-Key": "Your API Key",
"Content-Type": "application/json"
}
data = {
"samples": 2,
"prompt": "High end wildlife photography, beautiful colourful toucan sitting on a tree branch, trending on artstation",
"negative_prompt": "censored, worst quality, normal quality, low quality, low res, blurry, distorted facial, missing eyes, distorted eyes, distorted nose, bad mouth, watermark, weird faces, extra digits, cropped, jpeg artifacts, signature, username, error, sketch, duplicate, ugly, monochrome, horror, geometry, mutation, disgusting, low resolution",
"guidance_scale": 7,
"width": 1024,
"height": 1024,
"num_inference_steps": 29
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())

Available JSON Parameters for Control

ParameterTypeNotes
promptstringRequired. Description of the image to generate.
negative_promptstringRequired. Description of what should not appear in the image.
num_inference_stepsintegerRequired. Number of inference steps.
samplesintegerRequired. Max: 4. Number of images to generate.
guidance_scalenumberRequired. Max: 20. Controls how much the image should adhere to the prompt.
heightintegerDefault: 1024. Optional image height.
widthintegerDefault: 1024. Optional image width.
webhookstringGenerated image will be sent to this webhook.
direct_linkbooleanFetches the friendly URL in PNG format.
batch_idstringAdds a batch_id.
file_prefixstringAdds a file_prefix.
queued_image_urlsbooleanReturns the links of the images prematurely. The link will have the image once the task is completed.

Status

Your response will include a status.

  • If the status = SUCCESS, you will also have download_urls that will have the links to your generated image based on the number of samples you have entered. The maximum number of samples that can be generated is 4.
  • If the status = PENDING, you will receive an id. You can use the status endpoint to fetch your image using the id.
  • If the status = FAILURE, you will receive only an error message.

Endpoint: [GET]

  • https://api.imagepipeline.io/sd3/v1/status/{{id}}

Pass the API-Key as the authorization in the header.