Stable Diffusion 1.5
The optimised base model of SD 1.5 designed to create high quality images for few preset options. You can achieve these results with basic prompt description
- Python
- JavaScript
- php
import requests
import json
url = "https://api.imagepipeline.io/generate/v1"
headers = {
"API-Key": "Your API Key"
}
data = {
"prompt": "cat wizard, gandalf, lord of the rings, detailed, fantasy, cute, adorable, Pixar, Disney, 8k",
"style" : "realistic_portrait"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
const url = "https://api.imagepipeline.io/generate/v1";
const headers = {
"API-Key": "Your API Key",
"Content-Type": "application/json"
};
const data = {
"prompt": "cat wizard, gandalf, lord of the rings, detailed, fantasy, cute, adorable, Pixar, Disney, 8k",
"style" : "realistic_portrait"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch((error) => console.error('Error:', error));
<?php
$url = "https://api.imagepipeline.io/generate/v1";
$headers = array(
"API-Key: Your-API-Key",
"Content-Type: application/json"
);
$data = array(
"prompt" => "cat wizard, gandalf, lord of the rings, detailed, fantasy, cute, adorable, Pixar, Disney, 8k",
"style" => "realistic_portrait"
);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$response = curl_exec($ch);
if($response === FALSE){
die(curl_error($ch));
}
$responseData = json_decode($response, TRUE);
curl_close($ch);
var_dump($responseData);
?>
Available JSON Parameters for Control
Parameter | Permissible values | Notes |
---|---|---|
prompt | string | Required. Check our Prompt Guide for tips. |
style | string | Default: realistic_portrait , fantasy_art , cartoon_anime |
negative_prompt | string | Check our Prompt Guide for tips. |
model_id | string | Default: 0b397287-3449-4801-9a86-536465f6189f . |
num_inference_steps | integer | Default: 20 . Integer numbers. Ideal value: 20-30. |
samples | integer | Max: 4 . Default: 1 . Generates a maximum of 4 samples per API call. |
clip_skip | integer | Max: 12 . Integer numbers. |
strength | number | Max: 1 . Default: 0.8 . Optional denoise strength. |
guidance_scale | number | Max: 20 . Default: 7.5 . Higher guidance scale prioritizes text prompt relevance. |
height | integer | Max: 1536 . Default: 512 . Optional image height. |
width | integer | Max: 1536 . Default: 512 . Optional image width. |
lora_models | array string[] | Default: [] . Optional LoRa models (comma separated). |
lora_weights | array number[] | Default: [] . Optional LoRa weights (comma separated). |
embeddings | array string[] | Default: [] . Optional embeddings (comma separated). |
seed | integer | Default: -1 . Controlling the seed can help generate reproducible images. |
safety_checker | boolean | Checks for NSFW images and filters explicit images. |
base64 | boolean | If base64 output is needed. |
upscale | string | To upscale the image by 2x, set to 2x . |
webhook | string | Generated image will be sent to this webhook. |
server_id | string | Optional server_id to use enterprise subscription. Load-balance with any or specific id. |
scheduler | allOf | Choose an appropriate scheduler. Valid values: |
- EulerDiscreteScheduler | ||
- DDIMScheduler | ||
- DDPMScheduler | ||
- HeunDiscreteScheduler | ||
- UniPCMultistepScheduler | ||
- DPMSolverMultistepScheduler | ||
- DEISMultistepScheduler | ||
- PNDMScheduler | ||
- EulerAncestralDiscreteScheduler | ||
- KDPM2DiscreteScheduler | ||
- LCMScheduler | ||
- DPMSolverMultistepSchedulerSDE | ||
ip_adapter_style_images | array string[] | Default: [] . Reference images for multi-ip-adapter. |
ip_adapter_image | string | Reference image for ip-adapter. |
ip_adapter | array string[] | Default: [] . Valid values: |
- ip-adapter_sd15_light | ||
- ip-adapter_sd15 | ||
- ip-adapter-plus_sd15 | ||
- ip-adapter-plus-face_sd15 | ||
ip_adapter_scale | array number[] | Default: [] . Adjust the text prompt and image prompt condition ratio. |
hires | boolean | Fixes small imperfections and upscales image. |
hidiffusion | boolean | Applies hidiffusion. |
direct_link | boolean | Fetches the friendly URL in PNG format. |
batch_id | string | Adds a batch_id. |
file_prefix | string | Adds a file_prefix. |
queued_image_urls | boolean | Returns the links of the images prematurely. The link will have the image once completed. |
Status
Your response will include a status
.
- If the
status
=SUCCESS
, you will also havedownload_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 aid
. You can use the status endpoint to fetch your image using theid
. - If the
status
=FAILURE
, you will receive only an error message.
Endpoint:
https://api.imagepipeline.io/generate/v1/status/{{id}}
Pass the API-Key as the authorization in the header.