Stable Diffusion API
Complete documentation for GoAPI's Stable Diffusion API
Using our Stable Diffusion API helps you generate images without the need for:
- An expensive desktop computer with high-end GPUs
- Deploying Automatic 1111 WebUI locally
- Downloading CheckPoint and/or LoRA models
You can use any public models from our lists of available CheckPoints and LoRA models. If you would like to use other models from websites such as Civitai, Huggingface, or your own models, please contact us using the form on our website.
Images processed via the API are stored for 7 days post-processing for user downloads. Please download any necessary images within this period.
Available Endpoints
- txt2img
- img2img
- fetch
- upscale
- controlnet
txt2img
Sample Request
curl -X POST \ -H "X-API-KEY: YOUR_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model_id": "midjourney", "prompt": "a cat", "negative_prompt": "best quality, masterpiece, (photorealistic:1.4), 1girl, light smile, shirt with collars, waist up, dramatic lighting, from below", "width": "512", "height": "512", "seed": null, "lora_model": null, "lora_strength": null }' \ https://api.midjourneyapi.xyz/sd/txt2img
Sample Response
{
"status": "success",
"generationTime": 6.530880689620972,
"id": 28225389,
"output": [
"https://img.midjourneyapi.xyz/sd/0-6b2f25d9-8b06-4853-a99e-379b06bb156e.png"
],
"meta": {
"prompt": "mdjrny-v4 style a cat",
"model_id": "midjourney",
"negative_prompt": "best quality, masterpiece, (photorealistic:1.4), 1girl, light smile, shirt with collars, waist up, dramatic lighting, from below",
"W": 512,
"H": 512,
"seed": 4107109214,
"steps": 30,
"lora": ""
}
}
img2img
Sample Request
curl -X POST \ -H "X-API-KEY: YOUR_API_KEY " \ -H "Content-Type: application/json" \ -d '{ "model_id": "anything-v5", "prompt": "best quality, masterpiece, (photorealistic:1.4), 1girl, light smile, shirt with collars, waist up, dramatic lighting, from below", "negative_prompt": "bad quality,low details,watermark,hands", "init_image": "https://img.midjourneyapi.xyz/sd/0-6b2f25d9-8b06-4853-a99e-379b06bb156e.png", "strength": 0.8, "width": "512", "height": "512", "seed": null, "lora_model": null, "lora_strength": null }' \ "https://api.midjourneyapi.xyz/sd/img2img"
Sample Response
{
"status": "success",
"generationTime": 2.630248785018921,
"id": 30589866,
"output": [
"https://img.midjourneyapi.xyz/sd/0-eabe6b9a-6e3a-4a10-95e5-4f198c126b01.png"
],
"meta": {
"prompt": " best quality, masterpiece, (photorealistic:1.4), 1girl, light smile, shirt with collars, waist up, dramatic lighting, from below",
"model_id": "anything-v5",
"negative_prompt": "bad quality,low details,watermark,hands",
"init_image": "https://img.midjourneyapi.xyz/sd/0-77b8a8cf-c624-435f-95f2-482c041c3fa6.png",
"strength": 0.8,
"W": 512,
"H": 512,
"seed": 820764456,
"steps": 30,
"lora": ""
}
}
Fetch
Sample Request
curl -X POST -H "Content-Type: application/json" -d '{ "id": 30588303 }' "https://api.midjourneyapi.xyz/sd/fetch"
Sample Response
{
"id": 28227262,
"output": [
"https://img.midjourneyapi.xyz/sd/0-dfeac4f8-4fa3-4b4d-a5f2-ba8349b7dac6.png"
],
"status": "success"
}
Upscale
Sample Request
curl -X POST -H "X-API-KEY: YOUR_API_KEY" -H "Content-Type: application/json" -d '{ "url": "https://img.midjourneyapi.xyz/sd/0-77b8a8cf-c624-435f-95f2-482c041c3fa6.png", "scale": 2 }' "https://api.midjourneyapi.xyz/sd/upscale"
Sample Response
{
"generationTime": 7.332714319229126,
"id": 30591185,
"output": "https://cdn.stablediffusionapi.com/generations/1690188415_out.png",
"status": "success"
}
ControlNet
controlnet_type and controlnet_model accept the same value
API Request
curl -X POST -H "X-API-KEY: YOUR_API_KEY" -H "Content-Type: application/json" -d '{ "model_id": "ghostmix", "prompt": "best quality, masterpiece, (photorealistic:1.4), 1girl, light smile, shirt with collars, waist up, dramatic lighting, from below", "negative_prompt": "bad quality,low details,watermark,hands", "init_image": "https://i.imgur.com/X17rXVy.png", "control_image": "https://i.imgur.com/X17rXVy.png", "mask_image": "https://i.imgur.com/X17rXVy.png", "width": "512", "height": "512", "controlnet_model": "canny", "controlnet_type": "canny", "strength": 0.8, "controlnet_conditioning_scale": 1 }' "https://api.midjourneyapi.xyz/sd/controlnet"
Response
{
"status": "processing",
"eta": 65.3969803776,
"id": 30592845,
"messege": "Try to fetch request after seconds estimated",
"meta": {
"prompt": " best quality, masterpiece, (photorealistic:1.4), 1girl, light smile, shirt with collars, waist up, dramatic lighting, from below",
"model_id": "ghostmix",
"controlnet_model": "canny",
"controlnet_type": "canny",
"negative_prompt": "bad quality,low details,watermark,hands",
"guess_mode": "no",
"init_image": "https://i.imgur.com/X17rXVy.png",
"control_image": "",
"mask_image": "https://i.imgur.com/X17rXVy.png",
"strength": "1",
"W": 512,
"H": 512,
"seed": 2504314064,
"steps": 30,
"lora": ""
}
}