Stable Diffusion Inpainting API Documentation

Get Image - Request Code

POST https://gateway-stable-diffusion-v1-5-inpainting.appypie.workers.dev/getImage Ocp-Apim-Subscription-Key: your-subscription-key-here Content-Type: application/json { "prompt": "Change to a lion", "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png", "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png", "negative_prompt": "watermark", "height": 1024, "width": 1024, "num_steps": 20, "guidance": 5, "seed": 42 }
import requests url = "https://gateway-stable-diffusion-v1-5-inpainting.appypie.workers.dev/getImage" headers = { "Ocp-Apim-Subscription-Key": "your-subscription-key-here", "Content-Type": "application/json" } data = { "prompt": "Change to a lion", "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png", "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png", "negative_prompt": "watermark", "height": 1024, "width": 1024, "num_steps": 20, "guidance": 5, "seed": 42 } response = requests.post(url, headers=headers, json=data) print(response.json())
const url = 'https://gateway-stable-diffusion-v1-5-inpainting.appypie.workers.dev/getImage'; const headers = { 'Ocp-Apim-Subscription-Key': 'your-subscription-key-here', 'Content-Type': 'application/json' }; const data = { prompt: 'Change to a lion', imageUrl: 'https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png', maskUrl: 'https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png', negative_prompt: 'watermark', height: 1024, width: 1024, num_steps: 20, guidance: 5, seed: 42 }; 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));
curl -X POST 'https://gateway-stable-diffusion-v1-5-inpainting.appypie.workers.dev/getImage' \ -H 'Ocp-Apim-Subscription-Key: your-subscription-key-here' \ -H 'Content-Type: application/json' \ -d '{ "prompt": "Change to a lion", "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png", "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png", "negative_prompt": "watermark", "height": 1024, "width": 1024, "num_steps": 20, "guidance": 5, "seed": 42 }'
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; public class ApiExample { public static void main(String[] args) throws Exception { String url = "https://gateway-stable-diffusion-v1-5-inpainting.appypie.workers.dev/getImage"; String json = """ { "prompt": "Change to a lion", "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png", "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png", "negative_prompt": "watermark", "height": 1024, "width": 1024, "num_steps": 20, "guidance": 5, "seed": 42 } """; HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Ocp-Apim-Subscription-Key", "your-subscription-key-here") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
<?php $url = 'https://gateway-stable-diffusion-v1-5-inpainting.appypie.workers.dev/getImage'; $headers = [ 'Ocp-Apim-Subscription-Key: your-subscription-key-here', 'Content-Type: application/json' ]; $data = json_encode([ 'prompt' => 'Change to a lion', 'imageUrl' => 'https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png', 'maskUrl' => 'https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png', 'negative_prompt' => 'watermark', 'height' => 1024, 'width' => 1024, 'num_steps' => 20, 'guidance' => 5, 'seed' => 42 ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); echo $response; ?>

Output

Successful API response:

{ "imageUrl": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/sdxl_lightning/prompt-355182775-1724841428119-422172.png" }

Request Body - Get Image

Parameters for /getImage:

ParameterRequiredTypeDescription
PromptYesStringThe main instruction for the image transformation ("Change to a lion").
imageUrlNoURLThe URL of the initial image to be transformed ([Link](https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png)).
maskUrlNoURLThe URL of the mask image ([Link](https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png)).
Negative PromptNoStringA prompt to specify what should be avoided in the image ("watermark").
HeightNoIntegerThe height of the output image (1024).
WidthNoIntegerThe width of the output image (1024).
Num StepsNoIntegerThe number of steps for the transformation process (20).
GuidanceNoIntegerThe guidance scale for the transformation (5).
SeedNoIntegerThe seed value for random number generation to ensure reproducibility (42).

Example Request - Get Image

JSON
{ "prompt": "Change to a lion", "imageUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog.png", "maskUrl": "https://pub-1fb693cb11cc46b2b2f656f51e015a2c.r2.dev/dog-mask.png", "negative_prompt": "watermark", "height": 1024, "width": 1024, "num_steps": 20, "guidance": 5, "seed": 42 }

Response - Get Image

JSON
{ "imageUrl": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/sdxl_lightning/prompt-355182775-1724841428119-422172.png" }

Request Headers

HeaderDescription
Ocp-Apim-Subscription-KeySubscription key for authentication.
Content-TypeMust be set to application/json.

Response Handling

The Stable Diffusion-v1-5 Inpainting returns specific HTTP status codes and response bodies to indicate the success or failure of a request. Developers should implement error handling in their applications to manage these responses effectively.

Common Status Codes and Responses

Status CodeDescriptionResponse Body
200Success - The request was successfully processed.{ "success": true, ... }
Bad Request - The request contains invalid parameters or missing fields.{ "error": "Invalid request parameters" }
401Unauthorized - The provided subscription key is missing or invalid.{ "error": "Invalid or missing authentication" }
403Forbidden - The subscription does not have access to this API or action.{ "error": "Access denied for this operation" }
404Not Found - The requested resource or endpoint could not be found.{ "error": "Endpoint not found" }
Too Many Requests - The request rate limit has been exceeded.{ "error": "Rate limit exceeded, please retry later" }
500Internal Server Error - An unexpected error occurred on the server.{ "error": "An unexpected error occurred, please try again later" }

Example Error Response

{ "error": "Invalid parameters" }

Retrieving Image Result and URL

After submitting your request, use this endpoint to check status and retrieve results.

Endpoint

POST https://gateway.pixazo.ai/ai-model-api-polling/getGenerationResults

Request Body

{ "job_set_id": "your-job-set-id-here" }

Example Request

JSON
{ "job_set_id": "jobset_abc123xyz" }

Example Response

JSON
{ "status": "succeeded", "results": [ { "imageUrl": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/sdxl_lightning/prompt-355182775-1724841428119-422172.png", "job_id": "job_123" } ], "job_set_id": "jobset_abc123xyz" }

Code Examples

POST https://gateway.pixazo.ai/ai-model-api-polling/getGenerationResults Ocp-Apim-Subscription-Key: your-subscription-key-here Content-Type: application/json { "job_set_id": "jobset_abc123xyz" }
import requests url = "https://gateway.pixazo.ai/ai-model-api-polling/getGenerationResults" headers = { "Ocp-Apim-Subscription-Key": "your-subscription-key-here", "Content-Type": "application/json" } data = { "job_set_id": "jobset_abc123xyz" } response = requests.post(url, headers=headers, json=data) print(response.json())
const url = 'https://gateway.pixazo.ai/ai-model-api-polling/getGenerationResults'; const headers = { 'Ocp-Apim-Subscription-Key': 'your-subscription-key-here', 'Content-Type': 'application/json' }; const data = { job_set_id: 'jobset_abc123xyz' }; 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));
curl -X POST 'https://gateway.pixazo.ai/ai-model-api-polling/getGenerationResults' \ -H 'Ocp-Apim-Subscription-Key: your-subscription-key-here' \ -H 'Content-Type: application/json' \ -d '{ "job_set_id": "jobset_abc123xyz" }'
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; public class PollingExample { public static void main(String[] args) throws Exception { String url = "https://gateway.pixazo.ai/ai-model-api-polling/getGenerationResults"; String json = """ { "job_set_id": "jobset_abc123xyz" } """; HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Ocp-Apim-Subscription-Key", "your-subscription-key-here") .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
<?php $url = 'https://gateway.pixazo.ai/ai-model-api-polling/getGenerationResults'; $headers = [ 'Ocp-Apim-Subscription-Key: your-subscription-key-here', 'Content-Type: application/json' ]; $data = json_encode([ 'job_set_id' => 'jobset_abc123xyz' ]); $ch = curl_init($url); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); echo $response; ?>

Stable Diffusion Inpainting API (Free) Pricing

Resolution Price (USD)
All ResolutionFree