A picture generated from a description can stay alongside the messages that prompted it. In AnythingLLM, an administrator connects an image provider so workspace users can generate pictures in chat with /img.

Generated image in an AnythingLLM workspace conversation

The image provider applies to the whole instance. With LocalAI selected, AnythingLLM sends image requests to your LocalAI server, while each workspace keeps its own text model selection.

Start with an administrator account, an existing AnythingLLM workspace, and a LocalAI server with an image model installed.

Steps to configure image generation in AnythingLLM:

  1. Click the Open settings wrench at the bottom of the workspace sidebar. Open settings wrench at the bottom of the workspace sidebar
  2. Expand AI Providers in the Instance Settings sidebar if the group is collapsed. Collapsed AI Providers group in Instance Settings
  3. Open Image Generation under AI Providers. Image Generation entry under AI Providers
  4. Select LocalAI from the Image Generation Provider menu. LocalAI option in the image provider menu
  5. Enter your LocalAI API URL, including /v1, in LocalAI Base URL. LocalAI Base URL with the API Key field blank

    The URL must be reachable from AnythingLLM. When AnythingLLM can reach LocalAI on its own loopback interface, the URL is http://localhost:8080/v1. The API Key field can stay blank if your LocalAI server allows requests without a key.

  6. Select an installed image model such as sd-1.5-ggml from Model. Model selector showing sd-1.5-ggml

    An empty model list can mean the URL is unreachable from AnythingLLM or LocalAI has no image model installed.

  7. Set Image Dimensions to 512×512 for sd-1.5-ggml. Image Dimensions selector showing 512 by 512
  8. Click Save changes. LocalAI form ready to save
  9. Confirm that the saved LocalAI settings match your selections. Saved LocalAI image generation settings

    The form shows the saved base URL, model and dimensions. The Save changes button disappears.

  10. Click the AnythingLLM logo at the top of the settings sidebar to return to the workspace list. AnythingLLM logo at the top of Instance Settings
  11. Open an existing workspace, such as Design Studio, from the chat sidebar. Design Studio workspace in the chat sidebar
  12. Send /img An orange fox on a snowy hill in the workspace chat with Enter. Image request in the workspace chat composer

    The chat shows Generating your image… while LocalAI works. On a CPU, generation can take several minutes.

  13. Check that the generated image appears below the /img message. Image displayed inline below the original request
  14. Reload the current conversation in your browser. The open workspace conversation before a browser reload
  15. Confirm that the same image still appears below the original /img message after the reload. Same image visible in the reloaded conversation
Share this guide