πΌοΈ Inline Image Generation
GPT Researcher supports inline image generation for research reports using Google's Gemini image generation models. This feature creates contextually relevant illustrations that are embedded directly within your research reports.
Overviewβ
When enabled, GPT Researcher will:
- Analyze research context after gathering information to identify visualization opportunities
- Pre-generate images before writing the report (for seamless UX)
- Embed images inline as the report is written - no post-processing delays!
Quick Startβ
1. Set Environment Variablesβ
# Required: Enable the feature
IMAGE_GENERATION_ENABLED=true
# Required: Your Google API key
GOOGLE_API_KEY=your_google_api_key_here
# Optional: Specify the model (default shown)
IMAGE_GENERATION_MODEL=models/gemini-2.5-flash-image
# Optional: Maximum images per report (default: 3)
IMAGE_GENERATION_MAX_IMAGES=3
# Optional: Image style - "dark" (default), "light", or "auto"
IMAGE_GENERATION_STYLE=dark
2. Run Researchβ
import asyncio
from gpt_researcher import GPTResearcher
async def main():
researcher = GPTResearcher(
query="What are the key components of a modern solar panel system?",
report_type="research_report"
)
# Images are automatically generated during research
await researcher.conduct_research()
# Report includes embedded images
report = await researcher.write_report()
print(report)
asyncio.run(main())
That's it! Images will be automatically generated and embedded in your report.
How It Worksβ
The Smart Pre-Generation Flowβ
Research Phase Image Planning Report Writing
β β β
βΌ βΌ βΌ
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
β Gather β β LLM analyzes β β Report streams β
β information β β β context for β β β with images β
β from sourcesβ β 2-3 visuals β β already inline! β
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββ
β Generate all β
β images in β
β parallel β
ββββββββββββββββ
Key benefits:
- No waiting - Images are generated during research, not after
- Seamless UX - Report streams with images already embedded
- Context-aware - LLM chooses the best visualization opportunities
Configuration Optionsβ
Environment Variablesβ
| Variable | Default | Description |
|---|---|---|
IMAGE_GENERATION_ENABLED | false | Master switch to enable/disable |
GOOGLE_API_KEY | - | Your Google API key (required) |
IMAGE_GENERATION_MODEL | models/gemini-2.5-flash-image | Gemini model to use |
IMAGE_GENERATION_MAX_IMAGES | 3 | Maximum images per report |
IMAGE_GENERATION_STYLE | dark | Image style: dark, light, auto |
Supported Modelsβ
Free Tier (Gemini):
| Model | Description |
|---|---|
models/gemini-2.5-flash-image | Recommended - fast and free |
gemini-2.0-flash-exp-image-generation | Experimental variant |
Paid Tier (Imagen) - requires Google Cloud billing:
| Model | Description |
|---|---|
imagen-4.0-generate-001 | Highest quality, supports aspect ratios |
imagen-4.0-fast-generate-001 | Faster generation |
Image Stylingβ
Dark Mode (Default)β
Images are generated with styling that matches the GPT Researcher UI:
- Dark background (
#0d1117) - Teal/cyan accents (
#14b8a6) - Glowing, futuristic aesthetic
- Professional infographic style
Light Modeβ
Set IMAGE_GENERATION_STYLE=light for:
- Clean white/light gray backgrounds
- Deep blue and teal accents
- Corporate/professional aesthetic
Auto Modeβ
Set IMAGE_GENERATION_STYLE=auto for neutral styling that works in any context.
Outputβ
Image Storageβ
Generated images are saved to:
outputs/images/{research_id}/img_{hash}_{index}.png
Markdown Embeddingβ
Images are embedded using standard markdown syntax:
## System Architecture

The architecture consists of three main components...
Frontend Displayβ
For the Next.js frontend, images are served via the /outputs/ route which proxies to the backend. Images display at 75% width with teal accent borders.
WebSocket Eventsβ
When using the web interface, these events are emitted:
| Event | Description |
|---|---|
image_planning | Analyzing context for visuals |
image_concepts_identified | Found N visualization opportunities |
image_generating | Generating image X of Y |
images_ready | All images generated successfully |
Best Practicesβ
-
Enable for detailed reports - Works best with
research_reportanddetailed_reporttypes -
Monitor API usage - Free tier has daily quotas. Set
IMAGE_GENERATION_MAX_IMAGES=2to conserve -
Use dark mode - Default styling matches the app and looks professional
-
Review generated images - AI images occasionally need manual review
Troubleshootingβ
Images Not Generatingβ
- Verify
IMAGE_GENERATION_ENABLED=true - Check that
GOOGLE_API_KEYis set and valid - Ensure model name is correct (include
models/prefix for Gemini) - Check logs for API errors
Quota Exceededβ
If you see RESOURCE_EXHAUSTED errors:
- Wait until midnight UTC for daily quota reset
- Reduce
IMAGE_GENERATION_MAX_IMAGES - Enable Google Cloud billing for higher quotas
- Create a new Google Cloud project for fresh quota
Images Not Displaying in Frontendβ
- Ensure Next.js frontend is configured with the
/outputsproxy - Check that backend is serving static files from
outputs/ - Verify image paths in the markdown are correct
Disabling Image Generationβ
To disable completely:
IMAGE_GENERATION_ENABLED=false
Or simply don't set any IMAGE_GENERATION_* variables - the feature is off by default.