Input
   
 POST https://gateway.appypie.com/getImage/v1/getSDXLImage HTTP/1.1
  
  Content-Type: application/json
  Cache-Control: no-cache
  Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
  
  {
    "prompt": "High-resolution, realistic image of a red fox sitting gracefully in a lush, green forest during springtime. The fox's fur should be detailed with natural colors, showcasing its reddish-brown coat and white underbelly. The background should be soft-focused, filled with green foliage and a few wildflowers, creating a serene and peaceful atmosphere. Sunlight should filter through the trees, casting gentle dappled light on the fox.",
    "negative_prompt": "Low-quality, blurry image, with any other animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance_scale": 5,
    "seed": 40
  }
  
 import urllib.request, json
  
  try:
      url = "https://gateway.appypie.com/getImage/v1/getSDXLImage"
  
      hdr ={
      # Request headers
      'Content-Type': 'application/json',
      'Cache-Control': 'no-cache',
      'Ocp-Apim-Subscription-Key': '••••••••••••••••••••••••••••••••',
      }
  
      # Request body
      data =  
      data = json.dumps(data)
      req = urllib.request.Request(url, headers=hdr, data = bytes(data.encode("utf-8")))
  
      req.get_method = lambda: 'POST'
      response = urllib.request.urlopen(req)
      print(response.getcode())
      print(response.read())
      except Exception as e:
      print(e)
  
  
                                    
 // Request body
  const body = {
    "prompt": "High-resolution, realistic image of a red fox sitting gracefully in a lush, green forest during springtime. The fox's fur should be detailed with natural colors, showcasing its reddish-brown coat and white underbelly. The background should be soft-focused, filled with green foliage and a few wildflowers, creating a serene and peaceful atmosphere. Sunlight should filter through the trees, casting gentle dappled light on the fox.",
    "negative_prompt": "Low-quality, blurry image, with any other animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance_scale": 5,
    "seed": 40
  };
  
  fetch('https://gateway.appypie.com/getImage/v1/getSDXLImage', {
          method: 'POST',
          body: JSON.stringify(body),
          // Request headers
          headers: {
              'Content-Type': 'application/json',
              'Cache-Control': 'no-cache',
              'Ocp-Apim-Subscription-Key': '••••••••••••••••••••••••••••••••',}
      })
      .then(response => {
          console.log(response.status);
          console.log(response.text());
      })
      .catch(err => console.error(err));
  
   curl -v -X POST "https://gateway.appypie.com/getImage/v1/getSDXLImage" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••" --data-raw "{
      \"prompt\": \"High-resolution, realistic image of a red fox sitting gracefully in a lush, green forest during springtime. The fox's fur should be detailed with natural colors, showcasing its reddish-brown coat and white underbelly. The background should be soft-focused, filled with green foliage and a few wildflowers, creating a serene and peaceful atmosphere. Sunlight should filter through the trees, casting gentle dappled light on the fox.\",
      \"negative_prompt\": \"Low-quality, blurry image, with any other animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.\",
      \"height\": 1024,
      \"width\": 1024,
      \"num_steps\": 20,
      \"guidance_scale\": 5,
      \"seed\": 40
  }"
  
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;
  import java.net.URLEncoder;
  import java.util.HashMap;
  import java.util.Map;
  import java.io.UnsupportedEncodingException;
  import java.io.DataInputStream;
  import java.io.InputStream;
  import java.io.FileInputStream;
  
  public class HelloWorld {
  
    public static void main(String[] args) {
      try {
          String urlString = "https://gateway.appypie.com/getImage/v1/getSDXLImage";
          URL url = new URL(urlString);
          HttpURLConnection connection = (HttpURLConnection) url.openConnection();
  
          //Request headers
      connection.setRequestProperty("Content-Type", "application/json");
      
      connection.setRequestProperty("Cache-Control", "no-cache");
      connection.setRequestProperty("Ocp-Apim-Subscription-Key", "••••••••••••••••••••••••••••••••");
      
          connection.setRequestMethod("POST");
  
          // Request body
          connection.setDoOutput(true);
          connection
              .getOutputStream()
              .write(
               "{ \"prompt\": \"High-resolution, realistic image of a red fox sitting gracefully in a lush, green forest during springtime. The fox's fur should be detailed with natural colors, showcasing its reddish-brown coat and white underbelly. The background should be soft-focused, filled with green foliage and a few wildflowers, creating a serene and peaceful atmosphere. Sunlight should filter through the trees, casting gentle dappled light on the fox.\", \"negative_prompt\": \"Low-quality, blurry image, with any other animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.\", \"height\": 1024, \"width\": 1024, \"num_steps\": 20, \"guidance_scale\": 5, \"seed\": 40 }".getBytes()
               );
      
          int status = connection.getResponseCode();
          System.out.println(status);
  
          BufferedReader in = new BufferedReader(
              new InputStreamReader(connection.getInputStream())
          );
          String inputLine;
          StringBuffer content = new StringBuffer();
          while ((inputLine = in.readLine()) != null) {
              content.append(inputLine);
          }
          in.close();
          System.out.println(content);
  
          connection.disconnect();
      } catch (Exception ex) {
        System.out.print("exception:" + ex.getMessage());
      }
    }
  }
  
 $url = "https://gateway.appypie.com/getImage/v1/getSDXLImage";
  $curl = curl_init($url);
  
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  
  # Request headers
  $headers = array(
      'Content-Type: application/json',
      'Cache-Control: no-cache',
      'Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••',);
  curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  
  # Request body
  $request_body = '{
    "prompt": "High-resolution, realistic image of a red fox sitting gracefully in a lush, green forest during springtime. The fox's fur should be detailed with natural colors, showcasing its reddish-brown coat and white underbelly. The background should be soft-focused, filled with green foliage and a few wildflowers, creating a serene and peaceful atmosphere. Sunlight should filter through the trees, casting gentle dappled light on the fox.",
    "negative_prompt": "Low-quality, blurry image, with any other animals. Avoid abstract or cartoonish styles, dark or gloomy atmosphere, unnecessary objects or distractions in the background, harsh lighting, and unnatural colors.",
    "height": 1024,
    "width": 1024,
    "num_steps": 20,
    "guidance_scale": 5,
    "seed": 40
  }';
  curl_setopt($curl, CURLOPT_POSTFIELDS, $request_body);
  
  $resp = curl_exec($curl);
  curl_close($curl);
  var_dump($resp);
  
Output
SDXL API

Stable Diffusion Model: Text-to-Image Model

meta

The Stable Diffusion model is an advanced latent diffusion model designed for generating high-quality images from textual descriptions. This Text-to-Image Model utilizes cutting-edge machine learning techniques to create photo-realistic images in just a few seconds, transforming simple text prompts into stunning visuals. The latest version, Stable Diffusion XL, further enhances these capabilities, enabling the generation of even more intricate and detailed images. The model works by encoding the text input into a latent space, where it progressively refines the image through a denoising process, eventually producing a coherent and high-quality output that aligns perfectly with the given prompt. The Stable Diffusion model offers exceptional prompt understanding, delivering high-quality image modifications and unmatched creative image transformations.

By using the Stable Diffusion API, developers can easily integrate this powerful technology to generate visuals from text descriptions. The API enables users to leverage AI Image Inpainting and Text-to-Image Editing for a variety of creative tasks, such as art generation, design, and content creation. Its flexibility allows the model to adapt to different styles, themes, and even specific user preferences, making it a versatile tool for high-quality image creation. The Stable Diffusion API simplifies the process of implementing this model into applications, providing a scalable solution without the need for extensive GPU resources. This makes the Stable Diffusion API an increasingly popular choice among creators, artists, and developers looking for innovative ways to produce customized images and enhance user experiences.

How to Generate Images using Stable Diffusion API

Generating images with the Stable Diffusion API is a straightforward process that involves creating a prompt, setting parameters, sending an API request, and processing the response. Here’s a step-by-step guide to help you through this process:

generate_01

Get Access to the Stable Diffusion API

To begin, obtain access to the Stable Diffusion API by signing up on the platform that provides it. You'll need an API key for authentication, which is crucial for accessing features like high-resolution image generation.

generate_02

Set Up Environment and Configure Parameters

Choose your preferred programming language, such as Python or JavaScript, and set up your development environment to handle HTTP requests. Customize your API settings by adjusting parameters such as prompt, negative prompt num_steps, guidance_scale, seed, and size to fit your desired output.

generate_03

Send Your API Request

Using your chosen language, create an HTTP request to the Stable Diffusion API endpoint. Include the prompt and the configured parameters. This request will be processed to generate the desired image.

generate_04

Handle the Response

Once the request is processed, the API will return a response containing the generated image(s) or a URL to access the image. Download and save the image as needed for your project.

Use Cases for the Stable Diffusion API

Stability AI's Stable Diffusion API provides versatile solutions for developers, artists, and businesses seeking to leverage AI-generated images. Here are some key applications:

cases_1

Text-to-Image Generation

The primary feature of the Stable Diffusion API is its ability to convert text descriptions into high-quality images. This functionality allows users to quickly visualize concepts, create artwork, and generate custom content based on specific prompts.

cases_2

Custom Avatar Creation

By utilizing specific datasets, the Stable Diffusion API can create personalized avatars and characters from text descriptions. This capability is valuable for applications in gaming, virtual environments, and generating unique profile pictures.

cases_3

Design Variations

The Stable Diffusion API enables developers to generate multiple design variations from a single prompt. This feature speeds up the ideation process and facilitates rapid prototyping of visual concepts, making it a powerful tool for designers.

cases_4

AI-Powered Applications

The Stable Diffusion API can be integrated into a variety of applications to provide AI-generated image functionality. This includes creative tools, e-commerce platforms, social media applications, and productivity software, enhancing user experience and engagement.

cases_5

High-Quality Prints

With its ability to produce high-resolution, photorealistic images, the Stable Diffusion API is ideal for creating prints suitable for art, merchandise, and marketing materials, ensuring that generated visuals maintain their quality in print form.

cases_6

Content Creation and Marketing

The Stable Diffusion API is a valuable asset for content creators and marketers. It can generate engaging visuals for social media posts, blog articles, advertisements, and more. By automating image creation, businesses can maintain a consistent brand presence.

Top Trending Generative AI APIs

 

Maximize the potential of your projects with our Generative AI APIs. From video generation & image creation to text generation, animation, 3D modeling, prompt generation, image restoration, and code generation, our advanced APIs cover all aspects of generative AI to meet your needs.