Image Generation

Generate an Image

30

Result

Your generated image will appear here

Generating image...

cURL
Python
JavaScript
bash
curl -X POST https://aireclast.umiteski.workers.dev/api/image/generate \ -H "Content-Type: application/json" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d '{ "prompt": "A cyberpunk cat in a neon city", "model": "@cf/stabilityai/stable-diffusion-xl-base-1.0", "width": 640, "height": 640, "steps": 30 }'
python
import requests import json url = "https://aireclast.umiteski.workers.dev/api/image/generate" headers = { "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY" } data = { "prompt": "A cyberpunk cat in a neon city", "model": "@cf/stabilityai/stable-diffusion-xl-base-1.0", "width": 640, "height": 640, "steps": 30 } response = requests.post(url, headers=headers, data=json.dumps(data)) # Save the image if response.status_code == 200: with open("generated_image.png", "wb") as f: f.write(response.content) print("Image saved as generated_image.png") else: print(f"Error: {response.status_code}") print(response.text)
javascript
async function generateImage() { const url = 'https://aireclast.umiteski.workers.dev/api/image/generate'; const data = { prompt: "A cyberpunk cat in a neon city", model: "@cf/stabilityai/stable-diffusion-xl-base-1.0", width: 640, height: 640, steps: 30 }; try { const response = await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer YOUR_API_KEY' }, body: JSON.stringify(data) }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } // Get the image as a blob const imageBlob = await response.blob(); // Create an object URL for the blob const imageUrl = URL.createObjectURL(imageBlob); // Display the image const img = document.createElement('img'); img.src = imageUrl; document.body.appendChild(img); } catch (error) { console.error('Error generating image:', error); } } generateImage();