Create Generation

POST

/v1/image/generation/create

This endpoint is for generating images. Although it supports many parameters, in its simplest form, you just need to send a prompt and the system will use the defaults for the rest.

Request Example

Below is the simplest example of generating an image. You just send a prompt and the system will use the defaults for the rest.

Response

{

"outputs": [···],

"remaining_credits": 1392,

"settings": {···}

}

Request Headers

Authorization required

string

Send your API key as the value of this header in the following form:
Authorization: Bearer <YOUR_STABLECOG_API_KEY>.

Request Body

prompt required

string

Tell the model what image to generate.

model_id

(enum) TGenerationModelID

The model that will be used for generating the image.

width

min256  max1024 | int

The width of the image. The value should be a multiple of 8 and follow this formula:
width * height * inference steps <= 1024 * 1024 * 30.

height

min256  max1024 | int

The height of the image. The value should be a multiple of 8 and follow this formula:
height * width * inference steps <= 1024 * 1024 * 30.

negative_prompt

string

Tell the model what to avoid or exclude when generating the image. The opposite of the prompt.

num_outputs

min1  max4 | int

The number of images to generate.

guidance_scale

min1  max20 | float

How similar the image will be to your prompt. Higher values make the image closer to your prompt and provides less creative freedom to the model.

inference_steps

min10  max50 | int

How many steps will be taken to generate the image. Higher values usually provide more details (which isn't always a good thing) but take longer to generate. The value should follow this formula:
inference steps * width * height < 50 * 640 * 640.

scheduler_id

(enum) TGenerationSchedulerID

Schedulers define the entire denoising process during diffusion.

seed

int

To get repeatable results. Same seed combined with same settings will generate the same image.

init_image_url

string

An image URL to base the generation on. The generations using this parameter are often called img2img or image to image generations.

prompt_strength

min0  max1 | float

How the model should prioritize init_image_url and prompt. Higher value will follow the prompt more closely, lower value will follow the init_image_url more closely.

Response Body

outputs

array of TOutput

Generated images.

remaining_credits

float

Your remaining credits after this request.

settings

(object) TGenerationSettings

Settings for the generation. Useful if you are using the defaults and want to know what they are.

© 2024 Stablecog, Inc.