Skip to content

Image Generation

Iris can generate images from text descriptions using OpenAI's GPT Image model. Ask for artwork, illustrations, diagrams, or any visual content.

Features

  • Text-to-Image: Generate images from natural language
  • Multiple Sizes: Square, landscape, or portrait
  • High Quality: Uses GPT Image with high quality settings
  • Inline Display: Images appear directly in chat
  • Persistent Storage: Images are saved and accessible later

Setup

Image generation requires an OpenAI API key. Verify your .env includes:

bash
OPENAI_API_KEY=your-openai-key

That's it -image generation is automatically available. The generate_image tool uses the same API key configured for embeddings.

Usage

Simply ask Iris to create an image:

You: "Create an image of a sunset over mountains"

Iris: [generates and displays image]

"Here's a sunset over mountains. Would you like me to adjust anything?"

Being Specific

The more detail you provide, the better the results:

You: "Generate a watercolor painting of a cozy coffee shop with warm lighting, wooden furniture, plants on the windowsill, and a cat sleeping on a chair"

Style Guidance

Specify artistic styles to get the look you want:

StyleExample prompt
Minimalist"A minimalist line art portrait of a woman with flowing hair"
Pixel art"A pixel art scene of a forest at night with fireflies"
Photorealistic"A photorealistic image of a modern kitchen with marble countertops"
Watercolor"A watercolor painting of a sailboat at sunset"
Oil painting"An oil painting of a mountain landscape in the style of the Hudson River School"
Digital art"Digital art of a futuristic cityscape with neon lights"

Available Sizes

SizeOrientationUse Case
1024x1024SquareGeneral purpose, icons, avatars
1536x1024LandscapeScenes, backgrounds, banners
1024x1536PortraitCharacters, posters, mobile wallpapers

If you don't specify a size, Iris defaults to 1024x1024. You can request a size naturally:

"Create a landscape banner of a beach scene" → Uses 1536x1024 "Generate a portrait-oriented poster design" → Uses 1024x1536

How It Works

  1. Request: Iris interprets your request and formulates a detailed prompt
  2. Generation: The prompt is sent to GPT Image via OpenAI's API
  3. Download: The generated image is downloaded from OpenAI's temporary URL
  4. Storage: The image is saved locally as an attachment linked to the conversation
  5. Display: The image appears inline in the chat

Storage Details

Generated images are stored as attachments with:

  • Path: Saved in local storage (configurable via Laravel's filesystem)
  • Type: Marked as generated (vs upload for user-uploaded images)
  • Description: The prompt used to generate the image
  • Conversation link: Associated with the message that requested it

Prompt Enhancement

Iris often enhances your prompts for better results:

You: "Draw a cat"

Becomes: "A photorealistic image of a domestic cat with soft fur, sitting in natural lighting, detailed eyes, high quality"

You can override this by being very specific or asking for exactly what you described:

"Generate exactly this: a simple sketch of a cat, no details, just basic outlines"

Limitations and Constraints

Content Policy

OpenAI's content policy applies. Requests that violate the policy will be rejected:

  • No realistic images of public figures
  • No violent, adult, or harmful content
  • No content that could be used for deception

If a request is rejected, Iris will explain why and suggest alternatives.

Quality Considerations

  • Text in images: GPT Image can include text, but it may be imperfect. For text-heavy designs, consider post-processing.
  • Specific details: Very specific requests (exact layouts, precise proportions) may not render exactly as described.
  • Consistency: Multiple requests for "the same" thing will produce variations. There's no way to get identical outputs.

Rate Limits and Costs

Image generation uses OpenAI API credits:

TierImages per minuteCost per image
Free tierVery limited-
Pay-as-you-goHigher limits~$0.04-0.08 depending on size

Check your OpenAI dashboard for current pricing and usage. If you hit rate limits, Iris will report the error.

Troubleshooting

"OpenAI API key not configured": Add OPENAI_API_KEY to your .env file.

"Content policy violation": The prompt was rejected by OpenAI's safety filters. Rephrase your request.

Image not appearing: Check that the storage disk is configured correctly and writable. Images are stored using Laravel's default disk.

Slow generation: Image generation typically takes 5-15 seconds. Very complex prompts may take longer.

Disabling Image Generation

If you don't need image generation, disable the tool:

php
// config/iris-custom.php
return [
    'disabled_tools' => [
        App\Tools\GenerateImageTool::class,
    ],
];