Guides5 min read

Image Generation with AI Chatbots

Add image generation to your AI bot. Create images via DALL-E, Midjourney, or Stable Diffusion through chat commands.

Published: 27/01/2025

Overview

Give your AI chatbot the ability to create images. Request artwork, generate profile pictures, create diagrams, or visualize ideas - all through simple chat messages.

How It Works

Chat Request: "Generate a sunset over mountains"
    ↓
[Your VPS - OpenClaw]
    ↓
[AI improves prompt]
    ↓
[Image Generation API (DALL-E/SD)]
    ↓
Image sent back to chat

Provider Options

| Provider | Quality | Speed | Cost | |----------|---------|-------|------| | DALL-E 3 | Excellent | Fast | $0.04-0.12/image | | Midjourney | Best artistic | Medium | $10-30/month | | Stable Diffusion | Good | Fast | Free (self-hosted) | | Google Imagen | Excellent | Fast | Pay per image |

Setup Guide

DALL-E 3 (Recommended)

Easiest setup, great quality:

# Image Generation
IMAGE_GENERATION_ENABLED=true
IMAGE_PROVIDER=openai
OPENAI_API_KEY=your-openai-key

# DALL-E Settings
DALLE_MODEL=dall-e-3
DALLE_SIZE=1024x1024
DALLE_QUALITY=standard  # or 'hd'

Stable Diffusion (Self-Hosted)

Free but requires GPU or patience:

IMAGE_PROVIDER=stable-diffusion
SD_API_URL=http://localhost:7860

Run SD locally (requires GPU) or use a hosted API.

Google Imagen

IMAGE_PROVIDER=google
GOOGLE_API_KEY=your-key
IMAGEN_MODEL=imagen-3

Usage Examples

Basic Generation

You: "Generate an image of a cozy coffee shop" Bot: [Sends image] "Here's your cozy coffee shop. Would you like any changes?"

Detailed Prompts

You: "Create a futuristic cityscape at night, cyberpunk style, neon lights, rain-slicked streets" Bot: [Sends detailed cyberpunk cityscape]

AI-Enhanced Prompts

Your bot can improve prompts automatically:

ENHANCE_IMAGE_PROMPTS=true

You: "Make a cat" Bot internally enhances to: "A photorealistic orange tabby cat sitting on a windowsill, soft natural lighting, detailed fur, green eyes, cozy home setting" Bot: [Sends beautiful cat image]

Specific Styles

You: "Draw a castle in watercolor style" You: "Generate my logo in pixel art" You: "Create a portrait in oil painting style"

Bot Self-Portrait

Fun feature - let your bot generate its own avatar:

You: "Create a profile picture for yourself" Bot: "I'll create an avatar that represents me..." [Generates image]

Advanced Features

Image Variations

Request variations of an image:

You: [Sends image] "Create 3 variations of this" Bot: [Sends 3 similar but different images]

Image Editing

Edit existing images:

You: [Sends photo] "Add a santa hat to this person" Bot: [Sends edited image]

Image Analysis + Generation

Combine vision and generation:

You: [Sends room photo] "Generate this room in a minimalist style" Bot: Analyzes the room, then generates a minimalist version.

Batch Generation

You: "Generate 4 logo concepts for a tech startup called 'NexGen'" Bot: [Sends 4 different logo concepts]

Configuration Options

Quality vs Speed

# For best quality (slower, more expensive)
DALLE_QUALITY=hd
DALLE_SIZE=1024x1792

# For quick previews (faster, cheaper)
DALLE_QUALITY=standard
DALLE_SIZE=1024x1024

Size Options

DALL-E 3 sizes:

  • 1024x1024 - Square (default)
  • 1024x1792 - Portrait
  • 1792x1024 - Landscape

Style Presets

IMAGE_STYLE_PRESETS="
photorealistic: Ultra realistic, professional photography, detailed
artistic: Artistic interpretation, painterly, creative
minimal: Clean, minimalist, simple shapes, modern
vintage: Retro style, film grain, muted colors
"

You: "Generate a forest, style: vintage" Bot: [Generates vintage-style forest image]

Content Filtering

# Prevent inappropriate content
IMAGE_SAFETY_FILTER=true
BLOCK_NSFW_REQUESTS=true

Use Cases

Daily Briefing Art

Generate unique artwork for daily briefings:

async function generateBriefingArt() {
  const today = new Date().toLocaleDateString('en-GB', { weekday: 'long' });
  const weather = await getWeather();

  const prompt = `Cheerful illustration for ${today} morning, ${weather}, motivational, warm colors`;

  return await generateImage(prompt);
}

Project Visualization

You: "Visualize our new mobile app concept" Bot: [Generates mockup-style image based on project details in memory]

Infographics

You: "Create an infographic showing my task completion this week" Bot: [Generates visual summary of productivity stats]

Custom Avatars

You: "Generate an avatar for our team Slack channel, we're a fintech startup" Bot: [Generates professional fintech-themed avatar]

Cost Management

Track Usage

IMAGE_MONTHLY_BUDGET=5.00  # GBP
IMAGE_DAILY_LIMIT=10
NOTIFY_AT_BUDGET_PERCENT=80

Bot at 80%: "Monthly image budget is 80% used (£4.00/£5.00). 20 images remaining."

Cost Per Image

| Provider | Size | Quality | Cost | |----------|------|---------|------| | DALL-E 3 | 1024x1024 | Standard | $0.040 | | DALL-E 3 | 1024x1024 | HD | $0.080 | | DALL-E 3 | 1792x1024 | HD | $0.120 |

Typical Monthly Costs

| Usage | Images/month | Cost | |-------|--------------|------| | Light | 50 | ~£2 | | Moderate | 150 | ~£6 | | Heavy | 500 | ~£20 |

Troubleshooting

"Content policy violation"

Some prompts are blocked. Try:

  • More generic descriptions
  • Remove specific names/brands
  • Avoid sensitive topics

Slow generation

  • DALL-E 3 HD takes longer
  • Use standard quality for previews
  • Check API status

Poor quality results

  • Use more detailed prompts
  • Enable prompt enhancement
  • Try different styles

Image not sending

# Check bot logs
pm2 logs openclaw | grep -i "image\|dall"
  • Verify file size limits for Telegram/Discord
  • Check API key validity

Security Notes

Don't Generate

  • Copyrighted characters (without permission)
  • Real people's faces
  • Harmful or illegal content
  • Content that violates platform terms

Logging

# Log image prompts for review
LOG_IMAGE_PROMPTS=true
IMAGE_LOG_PATH=/var/log/image-generation.log

Related Guides

Need Help?

Image generation setup involves API configuration and cost management. Our setup service includes image generation integration with your preferred provider.

Need a VPS for Your Bot?

We recommend Hostinger KVM 2 VPS - reliable, fast, and perfect for AI chatbots. Get started with our recommended setup.

Get Hostinger VPS

Need Help With Setup?

Got your VPS? Let us handle the technical work. Professional setup and maintenance for OpenClaw (formerly Clawd.bot).