Stable Diffusion Features

Learn about the Stable Diffusion features production ready for your app. Here you will find basic Stable Diffusion Features, endpoints like text-to-image.

The resulting Stable Diffusion API call will return a Generation.

The Generation Model

The Generation is a Stable Diffusion Result with all the feature information for your needs.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier of the Generation.

  • Name
    prompt
    Type
    string
    Description

    The text based for the image generation.

  • Name
    negative_prompt
    Type
    string
    Description

    The text that shouldn't appear in the image, this doesn't mean it won't be included in the image but it has more probabilities. Example: hands, desfigured.

  • Name
    init_image
    Type
    string
    Description

    Inital image to generate variations of.

  • Name
    mask
    Type
    string
    Description

    Black and white image to use as mask for inpainting over init_image. Black pixels are inpainted and white pixels are preserved.

  • Name
    prompt_strength
    Type
    string
    Description

    1.0 value corresponds to full destruction of information in init_image

  • Name
    aspect_ratio
    Type
    array
    Description

    You can choose different Aspect Ratio to your output images. By default the aspect_ratio is "square" with 512x512px. Options: portrait, landscape, square.

  • Name
    webhook
    Type
    string
    Description

    The URL for us to call when the results are ready, or poll the get a prediction endpoint until it has one of the terminated statuses.

    This is a POST call with the body of the Generation Model. If you don't want to use the webhook, you can ping the GET Text-to-Image endpoint

  • Name
    model
    Type
    string
    Description

    Options: sd1.5, sd2.1. The base Stable Diffusion Model you want to Generation.

  • Name
    num_generations
    Type
    integer
    Description

    Number of images generation result, max of 8 images.

  • Name
    metadata
    Type
    JSON
    Description

    You can add metadata info about your Fine-Tune, like user_id, and other information you want to include to integrate it with your system.

  • Name
    error
    Type
    string
    Description

    An error message just in case any errors occur.


POST/v1/sd/text-to-image

Send Text to Image

This endpoint allows you to Generation a new Model and adds prompts to it.

Required attributes

  • Name
    prompt
    Type
    string
    Description

    The text based for the image generation.

Optional attributes

  • Name
    negative_prompt
    Type
    string
    Description

    The text that shouldn't appear in the image, this doesn't mean it won't be included in the image but it has more probabilities. Example: hands, desfigured.

  • Name
    aspect_ratio
    Type
    array
    Description

    You can choose different Aspect Ratio to your output images. By default the aspect_ratio is "square" with 512x512px. Options: portrait, landscape, square.

  • Name
    webhook
    Type
    string
    Description

    The URL for us to call when the results are ready, or poll the get a prediction endpoint until it has one of the terminated statuses.

    This is a POST call with the body of the Generation Model. If you don't want to use the webhook, you can ping the GET Text-to-Image endpoint

  • Name
    model
    Type
    string
    Description

    Options: sd1.5, sd2.1. The base Stable Diffusion Model you want to Generation.

  • Name
    num_generations
    Type
    integer
    Description

    Number of images generation result, max of 8 images.

  • Name
    metadata
    Type
    JSON
    Description

    You can add metadata info about your Fine-Tune, like user_id, and other information you want to include to integrate it with your system.

Request

POST
/v1/sd/text-to-image
  curl --request POST \
    --url https://api.bodia.ai/v1/sd/text-to-image \  
    --header 'Authorization: Bearer {API_KEY}' \
    --data '{          
      "prompt": "3D pixel retro tiny cute Macintosh computer",
      "webhook": "https://example.com"          
    }'

Response

{
  "id": "H0T9Zyt2od17qjJp0jk5-6Jb",
  "prompt": "3D pixel retro tiny cute Macintosh computer",
  "started_at": "2023-03-17T10:23:17.683Z",            
  "model": "sd1.5",
  "webhook": "https://example.com",
  "aspect_ratio": "square"
}

GET/v1/sd/text-to-image/:id

Get Text to Image Generation

GET request to the Generations endpoint to retrieve a list of all your fine tunes.

Request

GET
/v1/sd/text-to-image/:id
curl -G https://api.bodia.ai/v1/sd/text-to-image/{GENERATION_ID} \
  -H "Authorization: Bearer {API_KEY}"

Response

{
  "id": "H0T9Zyt2od17qjJp0jk5-6Jb",
  "prompt": "3D pixel retro tiny cute Macintosh computer",
  "started_at": "2023-03-17T10:23:17.683Z",            
  "model": "sd1.5",
  "webhook": "https://example.com",
  "aspect_ratio": "square"
}

--


POST/v1/sd/image-to-image

Send Image to Image

This endpoint allows you to Generation a new Model and adds prompts to it.

Required attributes

  • Name
    prompt
    Type
    string
    Description

    The text based for the image generation.

  • Name
    init_image
    Type
    string
    Description

    Inital image to generate variations of.

Optional attributes

  • Name
    negative_prompt
    Type
    string
    Description

    The text that shouldn't appear in the image, this doesn't mean it won't be included in the image but it has more probabilities. Example: hands, desfigured.

  • Name
    mask
    Type
    string
    Description

    Black and white image to use as mask for inpainting over init_image. Black pixels are inpainted and white pixels are preserved.

  • Name
    prompt_strength
    Type
    string
    Description

    1.0 value corresponds to full destruction of information in init_image.

    Default value: 0.8

  • Name
    aspect_ratio
    Type
    array
    Description

    You can choose different Aspect Ratio to your output images. By default the aspect_ratio is "square" with 512x512px. Options: portrait, landscape, square.

  • Name
    webhook
    Type
    string
    Description

    The URL for us to call when the results are ready, or poll the get a prediction endpoint until it has one of the terminated statuses.

    This is a POST call with the body of the Generation Model. If you don't want to use the webhook, you can ping the GET Text-to-Image endpoint

  • Name
    num_generations
    Type
    integer
    Description

    Number of images generation result, max of 8 images.

  • Name
    metadata
    Type
    JSON
    Description

    You can add metadata info about your Fine-Tune, like user_id, and other information you want to include to integrate it with your system.

Request

POST
/v1/sd/image-to-image
  curl --request POST \
    --url https://api.bodia.ai/v1/sd/image-to-image \  
    --header 'Authorization: Bearer {API_KEY}' \
    --data '{          
      "prompt": "3D pixel retro tiny cute Macintosh computer",
      "init_image": "https://example_image.jpg",
      "webhook": "https://example.com"          
    }'

Response

{
  "id": "kLCk5-M7i69WGEuVXnXY9k6E",
  "prompt": "3D pixel retro tiny cute Macintosh computer",
  "negative_prompt": null,
  "init_image": "https://example_image.jpg",
  "started_at": "2023-04-03T14:07:40.052Z",
  "finish_at": null,
  "model": "sd1.5",
  "webhook": null,
  "error": null,
  "aspect_ratio": "square",
}


POST/v1/sd/image-to-image-sd2-1

Send Image to Image SD.2.1

This endpoint allows you to Generation a new Model and adds prompts to it.

Required attributes

  • Name
    prompt
    Type
    string
    Description

    The text based for the image generation.

  • Name
    init_image
    Type
    string
    Description

    Inital image to generate variations of.

Optional attributes

  • Name
    negative_prompt
    Type
    string
    Description

    The text that shouldn't appear in the image, this doesn't mean it won't be included in the image but it has more probabilities. Example: hands, desfigured.

  • Name
    prompt_strength
    Type
    string
    Description

    1.0 value corresponds to full destruction of information in init_image.

    Default value: 0.8

  • Name
    aspect_ratio
    Type
    array
    Description

    You can choose different Aspect Ratio to your output images. By default the aspect_ratio is "square" with 512x512px. Options: portrait, landscape, square.

  • Name
    webhook
    Type
    string
    Description

    The URL for us to call when the results are ready, or poll the get a prediction endpoint until it has one of the terminated statuses.

    This is a POST call with the body of the Generation Model. If you don't want to use the webhook, you can ping the GET Text-to-Image endpoint

  • Name
    num_generations
    Type
    integer
    Description

    Number of images generation result, max of 8 images.

  • Name
    metadata
    Type
    JSON
    Description

    You can add metadata info about your Fine-Tune, like user_id, and other information you want to include to integrate it with your system.

Request

POST
/v1/sd/image-to-image-sd2-1
  curl --request POST \
    --url https://api.bodia.ai/v1/sd/image-to-image-sd2-1 \  
    --header 'Authorization: Bearer {API_KEY}' \
    --data '{          
      "prompt": "3D pixel retro tiny cute Macintosh computer",
      "init_image": "https://example_image.jpg",
      "webhook": "https://example.com"          
    }'

Response

{
  "id": "JEnEc8EggNl2lcVpK4MGJivu",
  "prompt": "3D pixel retro tiny cute Macintosh computer",
  "negative_prompt": null,
  "init_image": "https://example_image.jpg",
  "started_at": "2023-04-03T14:07:40.052Z",
  "finish_at": null,
  "model": "sd2.1",
  "webhook": null,
  "error": null,
  "aspect_ratio": "square",
}


GET/v1/sd/image-to-image/:id

Get Image to Image Generation

GET request to the Generations endpoint to retrieve a list of all your fine tunes.

Request

GET
/v1/sd/image-to-image/:id
curl -G https://api.bodia.ai/v1/sd/image-to-image/{GENERATION_ID} \
  -H "Authorization: Bearer {API_KEY}"

Response

{
  "id": "kLCk5-M7i69WGEuVXnXY9k6E",
  "prompt": "3D pixel retro tiny cute Macintosh computer",
  "negative_prompt": null,
  "init_image": "https://example_image.jpg",
  "started_at": "2023-04-03T14:07:40.052Z",
  "finish_at": null,
  "model": "sd1.5",
  "webhook": null,
  "error": null,
  "aspect_ratio": "square",
}

POST/v1/sd/control-net

Send ControlNet

This endpoint allows you to Generation a new Model and adds prompts to it.

Required attributes

  • Name
    prompt
    Type
    string
    Description

    The text based for the image generation.

  • Name
    init_image
    Type
    string
    Description

    Inital image to generate variations of.

Optional attributes

  • Name
    negative_prompt
    Type
    string
    Description

    The text that shouldn't appear in the image, this doesn't mean it won't be included in the image but it has more probabilities. Example: hands, desfigured.

  • Name
    image_resolution
    Type
    integer
    Description

    You can choose different resolutions to your output images. By default the image_resolution is 512. Options: 512, 256, 768.

  • Name
    webhook
    Type
    string
    Description

    The URL for us to call when the results are ready, or poll the get a prediction endpoint until it has one of the terminated statuses.

    This is a POST call with the body of the Generation Model. If you don't want to use the webhook, you can ping the GET Text-to-Image endpoint

  • Name
    num_generations
    Type
    integer
    Description

    Number of images generation result, max of 8 images.

  • Name
    metadata
    Type
    JSON
    Description

    You can add metadata info about your Fine-Tune, like user_id, and other information you want to include to integrate it with your system.

Request

POST
/v1/sd/control-net
  curl --request POST \
    --url https://api.bodia.ai/v1/sd/control-net \  
    --header 'Authorization: Bearer {API_KEY}' \
    --data '{          
      "prompt": "3D pixel retro tiny cute Macintosh computer",
      "init_image": "https://example_image.jpg",
      "webhook": "https://example.com"          
    }'

Response

{
  "id": "JEnEc8EggNl2lcVpK4MGJivu",
  "prompt": "3D pixel retro tiny cute Macintosh computer",
  "negative_prompt": null,
  "init_image": "https://example_image.jpg",
  "started_at": "2023-04-03T14:07:40.052Z",
  "finish_at": null,
  "webhook": null,
  "error": null,
  "image_resolution": "512",
}

GET/v1/sd/control-net/:id

Get ControlNet Generation

GET request to the Generations endpoint to retrieve a list of all your fine tunes.

Request

GET
/v1/sd/control-net/:id
curl -G https://api.bodia.ai/v1/sd/control-net/{GENERATION_ID} \
  -H "Authorization: Bearer {API_KEY}"

Response

{
  "id": "kLCk5-M7i69WGEuVXnXY9k6E",
  "prompt": "3D pixel retro tiny cute Macintosh computer",
  "negative_prompt": null,
  "init_image": "https://example_image.jpg",
  "started_at": "2023-04-03T14:07:40.052Z",
  "finish_at": null,
  "webhook": null,
  "error": null,
  "image_resolution": "512",
}