Skip to main content
Khoj can generate custom images from text prompts using state-of-the-art AI image models. From illustrations to concept art, create visuals that bring your ideas to life.

Prompt: Paint a picture of the plants I got last month, pixar-animation
Pixar-style plants illustration

Prompt: Create a picture of my dream house, based on my interests
Dream house illustration

How to Generate Images

Just describe what you want in your chat message:
Create an image of a serene mountain landscape at sunset
Draw a diagram showing the water cycle
Make a logo for my coffee shop called "Bean There"
Khoj automatically detects image generation intent and creates the image.

Prompt Engineering

Craft better prompts for higher quality images:
Instead of:
A dog
Try:
A golden retriever puppy playing in a meadow, sunny day, 
photorealistic style
Include:
  • Subject details
  • Setting/environment
  • Lighting conditions
  • Art style
  • Mood/atmosphere
Reference artistic styles for consistent results:
  • Photorealistic: “professional photography”, “DSLR”, “8k”
  • Illustration: “digital art”, “concept art”, “artstation”
  • Painting: “oil painting”, “watercolor”, “impressionist”
  • 3D: “3D render”, “octane render”, “unreal engine”
  • Cartoon: “pixar style”, “anime”, “comic book art”
  • Vintage: “1970s photography”, “retro poster”, “film grain”
Example:
/image A spaceship, retro 1950s sci-fi poster style
Add adjectives for atmosphere:
A cozy cottage in an enchanted forest, warm golden hour light, 
mist rising from the ground, magical atmosphere, fantasy art
  • Lighting: golden hour, dramatic shadows, soft diffused light
  • Mood: peaceful, energetic, mysterious, whimsical
  • Colors: vibrant, muted, pastel, monochromatic
  • Quality: detailed, intricate, minimalist, abstract
Khoj can use context from your documents:
Based on my travel journal entry about Kyoto, create an 
illustration of the temple I visited
Generate a character portrait based on the description in 
my story notes
Follow up to improve results:
  1. “Create a mountain landscape”
  2. “Make it more dramatic with storm clouds”
  3. “Add a small cabin in the foreground”
  4. “Change the time to sunset”
Each iteration refines the image.

Use Cases

Character Design:
/image A space explorer character, orange spacesuit, 
friendly face, concept art style
Scene Visualization:
Create a scene from my novel: a bustling medieval marketplace 
at dawn, merchants setting up stalls, fantasy illustration
Mood Boards:
Generate 4 different color palette concepts for my website, 
modern and professional

Self-Hosting Setup

Configure image generation for your self-hosted Khoj:
1

Get API Key

Sign up at replicate.com and get your API token from account settings
2

Choose a Model

Replicate supports multiple image models. Recommended:
  • Flux 1.1 Pro (best quality): black-forest-labs/flux-1.1-pro
  • Flux Schnell (fastest): black-forest-labs/flux-schnell
  • Stable Diffusion XL (balanced): stability-ai/sdxl
  • Ideogram (text in images): ideogram-ai/ideogram-v2
Browse all models →
3

Create Model Config

Navigate to: http://localhost:42110/server/admin/database/texttoimagemodelconfig/Click “Add Text to Image Model Config”
4

Configure Settings

  • Model name: black-forest-labs/flux-1.1-pro (or your choice)
  • Type: Replicate
  • Api key: Your Replicate API token
  • Ai model api: Select your configured AI model API (or leave blank for default)
5

Save and Test

Save the configuration and try generating an image in chat
Pricing: Replicate charges per image generation. See pricing details.

Option 2: OpenAI DALL-E

1

Get OpenAI API Key

Generate an API key at platform.openai.com
2

Configure OpenAI API

Ensure you have an OpenAI API configured in Khoj.See setup guide →
3

Create Image Model Config

Navigate to: http://localhost:42110/server/admin/database/texttoimagemodelconfig/Add new configuration:
  • Model name: dall-e-3
  • Type: OpenAI
  • Ai model api: Select your OpenAI API config
4

Save

Save and restart Khoj if needed
DALL-E 3 is simpler to set up if you already use OpenAI for chat, but may be more expensive per image than Replicate.

Model Comparison

ModelQualitySpeedCostBest For
Flux 1.1 ProExcellentMedium$$$Professional work
Flux SchnellGoodVery Fast$Quick iterations
DALL-E 3ExcellentMedium$$$Text in images
SDXLGoodFast$$General use
IdeogramVery GoodMedium$$Typography

Advanced Techniques

Refine images through conversation:
You: Create a forest scene
Khoj: [generates image]

You: Add a deer in the clearing
Khoj: [generates updated image]

You: Make it autumn with orange leaves
Khoj: [generates final version]
Apply artistic styles to concepts:
/image My office space, but in the style of Van Gogh's Starry Night
The Eiffel Tower as a cyberpunk scene with neon lights
Use online search for reference:
/online What does a bioluminescent jellyfish look like?
[Review results]
/image Create an illustration of a bioluminescent jellyfish, 
realistic underwater photography style
Request variations:
Generate 3 different logo concepts for a bakery called 
"The Bread Basket" - one vintage, one modern minimalist, 
one playful and colorful

Image Generation in Workflows

1
Write article or blog post
2
Ask Khoj to suggest image concepts
3
Generate hero image and supporting visuals
4
Download and use in publication

Best Practices

Clear Descriptions

Be specific about subjects, style, and mood

Iterate

Refine through conversation rather than one perfect prompt

Save Prompts

Keep track of prompts that work well for reuse

Ethical Use

Respect copyrights and use generated images responsibly

Limitations

Current constraints:
  • Text in images: Can be inconsistent (use Ideogram or DALL-E 3 for better text)
  • Specific people: Cannot reliably generate real individuals
  • Complex scenes: Very detailed multi-element scenes may need iteration
  • Fine details: Small text or intricate patterns may be imperfect
  • Consistency: Generated images of same subject will vary

Troubleshooting

Self-hosted:
  • Verify API key is correct
  • Check model config exists and is active
  • Review server logs for errors
  • Ensure sufficient API credits
Cloud:
  • Feature should work automatically
  • Try explicit /image command
  • Report issue if persistent
Try:
  • Use more descriptive prompts
  • Specify art style explicitly
  • Reference high-quality examples
  • Switch to higher-quality model (Flux Pro, DALL-E 3)
Reasons:
  • High-quality models take longer
  • API service load
Solutions:
  • Use faster model (Flux Schnell)
  • Be patient (typically 10-30 seconds)
Solutions:
  • Be more explicit about desired style
  • Include negative prompts (“not cartoonish”)
  • Reference specific artists or movements
  • Try different model better suited to your style

Ethical Considerations

Please use image generation responsibly:
  • Don’t create misleading or deceptive content
  • Respect copyright and don’t replicate specific artworks
  • Avoid generating harmful or offensive imagery
  • Give credit when sharing AI-generated art
  • Follow platform guidelines and laws

Saving and Using Images

1

Download

Right-click the generated image and select “Save Image As…”
2

Edit (Optional)

Use image editing software to refine or adjust
3

Attribution

When sharing publicly, consider noting it’s AI-generated
4

Integration

Use in documents, presentations, websites, or social media

Next Steps

Create Diagrams

Use /diagram command for Excalidraw-style diagrams

Automate Image Tasks

Schedule automated image generation

Learn More Prompting

Read the detailed blog post about image generation

Build docs developers (and LLMs) love