ollama - 💡(How to fix) Fix Add text-to-image generation support via API

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Fix Action

Fix / Workaround

  1. Unified AI platform: Ollama would become a complete solution for all AI model types
  2. Local-first: Users can run image generation models locally without cloud dependencies
  3. Privacy: No need to send image generation requests to third-party APIs
  4. Developer experience: Consistent API design across all model types
  5. Community demand: Many users are already running custom image models via workarounds

Current workaround

Code Example

{
  "model": "stable-diffusion",
  "prompt": "A beautiful sunset over mountains",
  "stream": false,
  "format": "image"
}

---

{
  "model": "stable-diffusion",
  "created_at": "2025-01-15T10:30:00Z",
  "image": "base64-encoded-image-data",
  "mime_type": "image/png",
  "done": true,
  "total_duration": 5000000000,
  "load_duration": 2000000000,
  "eval_duration": 3000000000
}

---

{
  "model": "stable-diffusion",
  "prompt": "A cat playing in the garden",
  "size": "1024x1024",
  "format": "png"
}
RAW_BUFFERClick to expand / collapse

Is your feature request related to a problem?

Currently, Ollama excels at running language models and embedding models, but it does not support text-to-image generation through its API. Many developers who use Ollama for their AI infrastructure would benefit from having native image generation capabilities.

Describe the solution you'd like

Add text-to-image generation support to Ollama's API, similar to how it currently handles text generation via the /api/generate endpoint.

Proposed API Design

Endpoint: POST /api/generate (existing endpoint, extended)

Request:

{
  "model": "stable-diffusion",
  "prompt": "A beautiful sunset over mountains",
  "stream": false,
  "format": "image"
}

Response:

{
  "model": "stable-diffusion",
  "created_at": "2025-01-15T10:30:00Z",
  "image": "base64-encoded-image-data",
  "mime_type": "image/png",
  "done": true,
  "total_duration": 5000000000,
  "load_duration": 2000000000,
  "eval_duration": 3000000000
}

Alternative: New Endpoint

Or create a dedicated endpoint:

Endpoint: POST /api/image

Request:

{
  "model": "stable-diffusion",
  "prompt": "A cat playing in the garden",
  "size": "1024x1024",
  "format": "png"
}

Why this would be valuable

  1. Unified AI platform: Ollama would become a complete solution for all AI model types
  2. Local-first: Users can run image generation models locally without cloud dependencies
  3. Privacy: No need to send image generation requests to third-party APIs
  4. Developer experience: Consistent API design across all model types
  5. Community demand: Many users are already running custom image models via workarounds

Current workaround

Currently, users who want to use Ollama with image generation have to:

  • Use external services (DALL-E, Stable Diffusion WebUI, etc.)
  • Implement custom API wrappers
  • Switch between different tools for different AI tasks

Popular image generation models that could run on Ollama

  • Stable Diffusion variants
  • FLUX
  • Other open-source image generation models

Additional context

I am a developer building an AI code generation tool (AiCoder) using Ollama for language models. Having native image generation support would allow me to provide a complete AI experience through a single service.

Would the Ollama team be interested in adding this capability? I would be happy to help with testing or documentation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

ollama - 💡(How to fix) Fix Add text-to-image generation support via API