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
    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/finetunes

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"
}

--