The Grapefruit model from Stable Diffusion allows users to generate ultra-realistic images based on prompts. This guide will help you navigate the process of obtaining an API key, crafting your request, and troubleshooting common issues.
Step 1: Obtain Your API Key
First things first, you need an API key to access the Grapefruit model. Follow these instructions:
- Visit the Stable Diffusion API website.
- Sign up for an account (no payment is required).
- Once registered, navigate to your dashboard and retrieve your API key.
Step 2: Setup Your API Request
With your API key in hand, you’re ready to make requests! The following code snippet illustrates how you can do this using Python:
import requests
import json
url = "https://stablediffusionapi.com/api/v4/dreambooth"
payload = json.dumps({
"key": "your_api_key",
"model_id": "grapefruit-hentai-mo",
"prompt": "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner)), blue eyes, shaved side haircut, hyper detail, cinematic lighting, magic neon, dark red city, Canon EOS R3, nikon, f1.4, ISO 200, 1160s, 8K, RAW, unedited, symmetrical balance, in-frame, 8K",
"negative_prompt": "painting, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, skinny, glitchy, double torso, extra arms, extra hands, mangled fingers, missing lips, ugly face, distorted face, extra legs, anime",
"width": 512,
"height": 512,
"samples": 1,
"num_inference_steps": 30,
"safety_checker": "no",
"enhance_prompt": "yes",
"seed": None,
"guidance_scale": 7.5,
"multi_lingual": "no",
"panorama": "no",
"self_attention": "no",
"upscale": "no",
"embeddings": "embeddings_model_id",
"lora": "lora_model_id",
"webhook": None,
"track_id": None
})
headers = {
"Content-Type": "application/json"
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
This code is akin to a chef following a recipe to create a delicate dish. Here’s how it breaks down:
- The import requests portion is like gathering your kitchen tools.
- url serves as your recipe book – it points to where you’ll get your special ingredients (images).
- payload is the detailed list of what you’re cooking up. It specifies your desires (the prompt) and any things you want to avoid (the negative prompt).
- headers are like the cooking instructions, ensuring you use the right format.
- Finally, calling response = requests.request() is where the magic happens, much like putting your finished dish in the oven.
Step 3: Execute Your Request
Once your request is set, simply run your Python script. If all goes well, you’ll receive a response containing your generated image data!
Troubleshooting
Here are some common issues and solutions:
- Invalid API Key: Ensure that you have copied the key accurately without additional spaces.
- Request Timeout: Double-check your internet connection. If the server is busy, consider retrying after a few minutes.
- Image Quality Not Satisfactory: Experiment with different prompts and negative prompts to refine the output.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Try it Out!
Don’t forget that you can try the model for free at Generate Images or learn more from the View docs.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

