curl --location "https://randomseed.lol/v1/txt2img" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer $RANDOMSEED_API_KEY" \
  --data '{
      "txt2img": {
          "prompt": "Cute cat",
          "negative_prompt": "ugly, out of frame",
          "width": "512",
          "height": "512",
          "number_of_images": "1",
          "steps": "20",
          "cfg_scale": 7,
          "sampler_name": "Euler a",
          "model_name": "realistic_vision_v4",
          "webhook": "..." //replace with your own webhook url,
          "track_id": 1,
          "seed": "-1",
      }
  }'
{
  "message": "image generation in progress",
  "result": {
    "id": "...", // request id you're going to use for polling if webhook url is not provided
    "status": "IN_QUEUE"
  }
}

API key

Create your account on RandomSeed & grab your api key

Headers

Authorization
string

Your API key. This is required by most endpoints to access our API programatically. You can get your api key by clicking on ‘API reference’ tab under your profile icon.

Body

prompt
string
required

This is the text prompt for the image you want generated. Loras can be used by adding this in the prompt <lora:LORA_NAME:weight> where LORA_NAME is the name of the lora model and weight can be from 0 to 1, with decimal values supported.

negative_prompt
string
default:""

This is the text prompt describing what you don’t want to see in the image.

width
string
default:"512"

This is the width of the image

height
string
default:"512"

This is the height of the image

number_of_images
string
default:"1"

Number of images you want to generate

steps
string
default:"50"

This is the number of the denoising steps used by the AI model when generating an image from the text prompt. A higher number results in a longer generation time, and does not necessarily guarantee higher image quality.

cfg_scale
float
default:"7.0"

This is the number of the number you specify to control how closely AI model should follow the text prompt. 7 or 7.5 usually works best. You can increase the value if the generated image doesn’t match your prompt. Increment it by 0.5.

sampler_name
string
required

This is the name of the sampler method you will be using to generate an image. Image output varies slightly depending on the method. You can pick one of the following methods

model_name
string
required

Specify the name of the model you’d like to use. You can find the model names here

highres_fix_method
string

Refer to the following table for supported methods.

image_strength
float
default:"0.7"

Make sure to set this value when you’re using this when passing in the highres fix method.

webhook
string

This is the callback url where you want to receive your response.

track_id
string

You can specify any value here to track the request that’s received on your webhook’s end.

seed
string
default:"-1"

This is the value that determines the output of a random number generator. You can get ALMOST the same image if you provide the same parameters and the seed.

Response

message
string

image generation in progress

curl --location "https://randomseed.lol/v1/txt2img" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer $RANDOMSEED_API_KEY" \
  --data '{
      "txt2img": {
          "prompt": "Cute cat",
          "negative_prompt": "ugly, out of frame",
          "width": "512",
          "height": "512",
          "number_of_images": "1",
          "steps": "20",
          "cfg_scale": 7,
          "sampler_name": "Euler a",
          "model_name": "realistic_vision_v4",
          "webhook": "..." //replace with your own webhook url,
          "track_id": 1,
          "seed": "-1",
      }
  }'
{
  "message": "image generation in progress",
  "result": {
    "id": "...", // request id you're going to use for polling if webhook url is not provided
    "status": "IN_QUEUE"
  }
}