khoj/documentation/docs/features/image_generation.md
omahs 36bdaedd2d
Some checks are pending
dockerize / Publish Khoj Docker Images (push) Waiting to run
dockerize / manifest (push) Blocked by required conditions
build and deploy github pages for documentation / deploy (push) Waiting to run
pre-commit / Setup Application and Lint (push) Waiting to run
pypi / Publish Python Package to PyPI (push) Waiting to run
test / Run Tests (push) Waiting to run
Fix typos in Khoj Docs (#1033)
2025-01-07 15:55:57 +07:00

1.9 KiB

Image Generation

You can use Khoj to generate images from text prompts. You can get deeper into the details of our image generation flow in this blog post: https://blog.khoj.dev/posts/how-khoj-generates-images/.

To generate images, you just need to provide a prompt to Khoj in which the image generation is in the instructions. Khoj will automatically detect the image generation intent, augment your generation prompt, and then create the image. Here are some examples:

Prompt Image
Paint a picture of the plants I got last month, pixar-animation plants
Create a picture of my dream house, based on my interests house

Setup (Self-Hosting)

You have a couple of image generation options.

Image Generation Models

We support most state of the art image generation models, including Ideogram, Flux, and Stable Diffusion. These will run using Replicate. Here's how to set them up:

  1. Get a Replicate API key here.
  2. Create a new Text to Image Model. Set the type to Replicate. Use any of the model names you see on this list. We recommend the model name black-forest-labs/flux-1.1-pro from Replicate.

OpenAI

  1. Get an OpenAI API key.
  2. Setup your OpenAI API key, if you haven't already. See instructions here
  3. Create a text to image config at http://localhost:42110/server/admin/database/texttoimagemodelconfig/. Use model name dall-e-3 to use openai for image generation. Make sure to set the Ai model api field to the OpenAI AI model api you setup in step 2.