AI & LLM Tools

AnythingLLM Image Generation: Setup Guide

J
James Eriksson
··11 min read
Learn how to set up AnythingLLM image generation with OpenAI, OpenRouter, Ollama, or Lemonade. Compare costs, privacy, and features for teams.
TL;DR
  • AnythingLLM supports four image generation providers: OpenAI DALL-E 3 ($0.080/image), OpenRouter ($0.008-0.024), Ollama (local, free), and Lemonade (edge compute).
  • Enable via Settings > AI Providers > Image Generation, enter your API key, then use the /img command to generate images in chat.
  • Generated images can be used as context in follow-up messages only if your chat model supports vision input (GPT-4V, Claude 3, LLaVA).
  • Team instances need cost controls; AnythingLLM doesn't split API charges by user, so heavy usage can add up quickly across your workspace.
  • Ollama is privacy-first but slow (30-60 seconds per image); cloud providers are faster but send prompts to external servers.

AnythingLLM has built-in image generation powered by external providers or local models. You can generate new images, edit existing ones, and use them as context in follow-up messages. This guide walks you through which providers work best, how to set them up, and what privacy and cost tradeoffs matter for teams.

What Is Image Generation in AnythingLLM?

AnythingLLM's image generation feature lets you create images directly within chat using the /img command. Instead of copying text between your chat and an external image tool, you generate images on the fly, attach them to messages, and reference them in subsequent prompts. This works because the platform integrates with providers like OpenAI's DALL-E, OpenRouter, Ollama (local), and Lemonade (edge compute).

The feature is marked as experimental, meaning the API or supported providers may change. But it's stable enough for production workflows and commonly used in agent skills to automate image-heavy tasks.

Two important constraints: first, you need API credentials for the provider you choose (unless you're running Ollama locally). Second, follow-up messages can only use generated images as context if your chat model supports vision input. If it doesn't, you can still view the image, but it won't inform the model's next response.

Supported Image Generation Providers: OpenAI, OpenRouter, Ollama, and Lemonade

AnythingLLM currently supports four image generation backends:

OpenAI DALL-E 3 charges $0.080 per image (1024x1024). It produces highly detailed, photorealistic outputs and supports style refinement. No local compute required. Best for teams that already use OpenAI for LLM access and don't mind per-image costs.

OpenRouter bundles multiple image models under a single API: Stable Diffusion 3, FLUX, and others. Pricing varies by model; Stable Diffusion 3 costs roughly $0.008 per image, FLUX around $0.024. You get provider flexibility without switching credentials. Best for cost-conscious setups.

Ollama (Local) runs open-source image models on your own hardware: SDXL, Flux, and others. Zero API charges, but you need a machine with enough VRAM (typically 6-8GB minimum). Slower than cloud providers (minutes vs seconds), but privacy-first. Best for self-hosted deployments or when you want full control over data.

Lemonade is an edge-compute provider that runs image models closer to your geography. It's faster than Ollama on most setups and cheaper than OpenAI, but less widely documented in AnythingLLM communities. Worth testing if you have latency concerns.

ProviderCost (per image)SpeedPrivacyLocal?Best For
OpenAI$0.080Fast (~5s)CloudNoHigh-quality, production-grade
OpenRouter$0.008-0.024Fast (~3-8s)CloudNoCost control, model choice
Ollama$0Slow (30-60s)Full localYesSelf-hosted, no API keys
Lemonade$0.02-0.04 (est)Medium (~8-15s)EdgeNoLatency-sensitive workflows

How to Enable Image Generation: Step-by-Step Setup

Here's how to turn on image generation for your workspace:

  1. Open Settings: In AnythingLLM, navigate to Settings (gear icon) > Workspace Settings > AI Providers.
  2. Select Image Generation Provider: Scroll to the Image Generation section. Choose your provider from the dropdown (OpenAI, OpenRouter, Ollama, Lemonade).
  3. Enter API Key: If using a cloud provider, paste your API key. For OpenAI, log into your account and generate a new API key in the account settings. For OpenRouter, sign up at https://openrouter.ai and follow their onboarding. For Ollama, you need it running locally--pull a model like ollama pull sdxl.
  4. Choose a Model: Some providers offer multiple models. OpenAI offers DALL-E 3 only. OpenRouter lists available models in the dropdown. Ollama auto-detects locally installed models.
  5. Set Generation Parameters (optional): Image size (typically 1024x1024 or 512x512) and quality settings if available. Most defaults are sensible.
  6. Test: Type /img a red barn at sunset in a chat and press Enter. If it returns an image, you're set.

For Ollama users: first, download and install Ollama from https://ollama.ai (then restart your terminal). Run ollama serve in a terminal and pull an image model like ollama pull sdxl. AnythingLLM will auto-detect it in the provider dropdown.

Generating Images: The /img Command

Once enabled, use /img followed by your prompt. Examples:

/img a minimalist logo for a cloud backup startup
/img cyberpunk city street at night, neon signs, 4k
/img flat icon of a gear and wrench

AnythingLLM sends your text to the provider and returns a URL (cloud) or embedded image (Ollama). The image appears in the chat thread and is saved with the conversation.

If you reference a placeholder in your prompt like [image], AnythingLLM understands you're asking for something conceptual. However, if your chat model doesn't support vision, it won't actually "see" that placeholder; the image is visual-only for you.

For teams running agents: use /img inside agent skills to automate image creation. For example, an agent that generates weekly social media graphics could call /img generate a LinkedIn post image about [topic] as part of its workflow.

Editing Generated Images with References

After generating an image, you can prompt the model to edit it in follow-up messages, but only if your chat model supports vision input. Here's the workflow:

  1. Generate an image: /img red barn at sunset.
  2. In the next message, attach the image or reference it: "can you modify the barn to be blue instead of red?" (if your model can see images, it will refine the concept; it won't actually edit the file).
  3. Generate a new version: /img blue barn at sunset, same composition as the previous one.

Note: AnythingLLM doesn't offer pixel-level editing like Photoshop. Instead, you generate new variations by describing the changes and using /img again. This workflow is slower but gives the model full creative control.

Editing support depends on your provider's capabilities. Stable Diffusion (via OpenRouter) and DALL-E support inpainting (localized edits) if the provider exposes it, but AnythingLLM's interface currently treats all providers as text-to-image only. Workaround: use the provider's native API directly for inpainting, then reference the result in AnythingLLM.

Privacy and Cost Considerations for Teams

Teams running multi-user AnythingLLM instances should think through these tradeoffs:

Cost Attribution: Each user hitting /img on a cloud provider (OpenAI, OpenRouter, Lemonade) incurs charges, but AnythingLLM doesn't split costs by user by default. You see total API spend in your provider dashboard, but not per-person breakdowns. If your team has heavy image generators, this gets expensive fast: 50 images daily at OpenAI rates ($0.080 each) = $120/month. You may want to set per-workspace quotas or use OpenRouter's tiered models to control spend.

Data Handling: When you call OpenAI or OpenRouter, your prompts go to their servers. They don't store images permanently (they delete after 30 days), but prompts are logged. For sensitive work (e.g., generating internal product mockups), read the provider's terms. If privacy is critical, Ollama running locally is your only real option: nothing leaves your server.

Ollama on a Team Server: Running Ollama on a shared server works, but the model only loads into memory once. If two users generate images simultaneously, the second user waits for the first to finish (or the model unloads and reloads, slowing both). For high concurrency, deploy multiple Ollama instances or use a cloud provider.

Role-Based Access: AnythingLLM doesn't have granular image-generation permissions. If a user has access to a workspace, they can generate images if the provider is configured. No per-user on/off switch. Workaround: create separate workspaces for teams with different access levels.

For a managed solution that handles multi-user image generation without these manual tradeoffs, consider Opsily's hosted AnythingLLM, which manages quotas, cost tracking, and scaling automatically.

Vision Model Requirements and Context Usage

If you want the chat model to use generated images as context in follow-up messages, your LLM must support vision input. Examples of models that do: GPT-4V (OpenAI), Claude 3 (Anthropic), LLaVA (open-source, runs locally). Models that don't: GPT-3.5, Llama 2 base.

When you generate an image and follow up with a question, AnythingLLM checks whether your chat model has vision capability. If yes, the image is included in the context window. If no, the image appears in the chat UI but the model doesn't see it.

Example workflow:

  • Chat model: Claude 3 Opus (supports vision).
  • You: /img a website mockup for an e-commerce site.
  • You: "What's the main CTA button, and should we change the color?"
  • Result: Claude analyzes the generated image and suggests improvements.

If you were using GPT-3.5:

  • You: /img a website mockup for an e-commerce site.
  • You: "What's the main CTA button, and should we change the color?"
  • Result: GPT-3.5 has no idea what image you generated. The prompt fails or returns generic advice.

Check your model's capabilities before relying on vision-based image workflows. Most enterprise models now support vision, but many open-source ones don't. For pure image generation without context usage, vision support doesn't matter.

Common Issues and Troubleshooting

"Image generation is not enabled for this workspace": Verify you've set an API key in Settings > AI Providers > Image Generation. If using Ollama, ensure the service is running (ollama serve in a terminal). Test with a simple prompt first: /img a cat.

Ollama timeouts or "connection refused": By default, Ollama listens on localhost:11434 for local connections. If AnythingLLM is in Docker or a different network, it can't reach localhost. Solution: run Ollama on the same machine or in the same Docker network, or expose Ollama's port and use the full IP address in AnythingLLM settings.

API key errors (OpenAI, OpenRouter): Double-check that your key is valid and has image generation permissions enabled in the provider's dashboard. Some keys are restricted to text-only models. If using OpenRouter, verify you've set a budget and payment method.

Generated images are blurry or low-quality: Check the image size setting. Smaller sizes (512x512) are faster but less detailed. Also verify you're using a capable model (DALL-E 3 or FLUX produce better results than older Stable Diffusion versions). Describe your scene more precisely in the prompt.

High costs with team usage: If your bill is climbing, audit which users are generating the most images. Set a monthly provider budget in your API dashboard to block overages. Or switch to OpenRouter and use cheaper models (Stable Diffusion 3 instead of DALL-E 3).

Vision model not seeing generated images: Verify your chat model supports vision. Check the model's spec sheet on the provider's website. If it does and AnythingLLM still isn't using images, update AnythingLLM to the latest version.

Frequently Asked Questions

What image generation models can AnythingLLM use?

AnythingLLM supports DALL-E 3 (OpenAI), Stable Diffusion 3 and FLUX (OpenRouter), SDXL and Flux (Ollama local), and Lemonade's proprietary models. You choose based on your provider. Most cloud providers rotate through the latest open-source models, so options change quarterly.

Can AnythingLLM generate images locally without an API key?

Yes, with Ollama. Install Ollama, pull a model like ollama pull sdxl, run ollama serve, and select Ollama in AnythingLLM's image generation settings. No API charges, but requires local GPU/CPU and is slower than cloud providers.

What is the best image generation provider for AnythingLLM?

There's no single best. OpenAI DALL-E 3 excels at realism and detail; cost is high ($0.080 per image). OpenRouter balances quality and cost. Ollama is best for privacy and zero cost but slower. Choose based on your budget, speed requirements, and data sensitivity.

Does AnythingLLM support Stable Diffusion image generation?

Yes. Via OpenRouter, you can use Stable Diffusion 3 ($0.008 per image). Or run it locally with Ollama for free. AnythingLLM doesn't have a dedicated Stable Diffusion provider, but it integrates with OpenRouter and Ollama, both of which offer Stable Diffusion models.

How do I use AnythingLLM image generation in AI agents?

Add /img commands to agent skills. For example, an agent that creates social media posts could call /img generate a LinkedIn graphic about [topic] as part of its workflow. The image is generated and attached to the agent's response.

What are the costs of image generation in AnythingLLM?

OpenAI: $0.080 per image. OpenRouter: $0.008-0.024 depending on model. Ollama: $0 (hardware cost only). Lemonade: estimated $0.02-0.04. Total cost scales with image count and model choice. For 100 images/month at OpenAI rates: $8. At OpenRouter's cheapest: $0.80.

How do I set up Ollama image generation with AnythingLLM?

First, download and install Ollama from https://ollama.ai (then set up the service). Run ollama serve in a terminal. Pull an image model: ollama pull sdxl. Then in AnythingLLM Settings > AI Providers > Image Generation, select Ollama. AnythingLLM auto-detects your installed models. Test with /img a test image.

Can I edit generated images in AnythingLLM?

You can generate variations by describing changes in follow-up prompts and calling /img again. AnythingLLM doesn't offer pixel-level editing; instead, the model re-renders based on your description. Some providers support inpainting, but you'd use their native API for that level of control.

The Bottom Line

AnythingLLM's image generation is mature enough for production, with four solid provider options covering cost, speed, and privacy. Most teams start with OpenAI or OpenRouter for simplicity, then shift to Ollama if costs spiral or data sensitivity increases. For multi-user instances, watch your API spend and keep tabs on per-team usage; AnythingLLM doesn't track it granularly by default.

If managing image generation infrastructure sounds like overhead, Opsily's managed AnythingLLM hosting handles provider setup, cost tracking, and scaling, so you focus on building agents instead of debugging Ollama connections.

Host AnythingLLM without setup overhead
Opsily manages image generation providers, multi-user quotas, and infrastructure scaling so you focus on building agents.
Get Started Free

Ready to self-host your own apps?

One server. Multiple apps. No per-app fees.

Get started →