Generate images with AI models.
Using the Grid
The fastest way to generate images:
- Go to Apps
- Find
stable-diffusionorflux - Enter a prompt
- Click Run
Example Prompts
| Style | Prompt |
|---|---|
| Photorealistic | "Professional headshot of a woman, studio lighting, 4k" |
| Illustration | "Cute cartoon fox in a forest, children's book style" |
| Abstract | "Flowing waves of blue and purple, digital art" |
| Product | "White sneakers on marble surface, product photography" |
With Python SDK
python
1from inferencesh import inference2 3client = inference(api_key="inf_your_key")4 5result = client.run({6 "app": "infsh/stable-diffusion",7 "input": {8 "prompt": "A serene Japanese garden with cherry blossoms",9 "negative_prompt": "blurry, low quality",10 "num_images": 1,11 "size": "1024x1024"12 }13})14 15image_url = result["output"]["images"][0]["uri"]16print(f"Generated: {image_url}")With JavaScript SDK
typescript
1import { inference } from '@inferencesh/sdk';2 3const client = inference({ apiKey: 'inf_your_key' });4 5const result = await client.run({6 app: 'infsh/stable-diffusion',7 input: {8 prompt: 'A serene Japanese garden with cherry blossoms',9 negative_prompt: 'blurry, low quality',10 num_images: 1,11 size: '1024x1024'12 }13});14 15console.log('Generated:', result.output.images[0].uri);With Agent
Create an agent with stable-diffusion as a tool:
code
1You: Generate a logo for a coffee shop called "Morning Brew"2 3Agent: I'll create a logo for Morning Brew.4 [Calling stable-diffusion...]5 6 Here's your logo! I generated a warm, inviting design7 with a coffee cup and sunrise motif.8 9 Would you like variations or a different style?Popular Image Apps
| App | Best For |
|---|---|
stable-diffusion | General purpose, flexible |
flux | High quality, detailed |
dalle | Creative, artistic |
sdxl-turbo | Fast generation |
controlnet | Guided generation (pose, edge) |
Model Configuration
Use setup parameters to load specific checkpoints or change precision:
python
1client.run({2 "app": "infsh/stable-diffusion",3 "setup": {4 "model_id": "stabilityai/stable-diffusion-xl-base-1.0",5 "precision": "fp16"6 },7 "input": { ... }8})Tips
Be specific:
code
1❌ "a dog"2✓ "Golden retriever puppy playing in autumn leaves, warm sunlight, shallow depth of field"Use negative prompts:
code
1negative_prompt: "blurry, low quality, distorted, ugly, duplicate"Try different models:
- SDXL for quality
- Turbo for speed
- Flux for details