Skip to main content

litellm-free-image-providers

CI Release Please PyPI version License: MIT Python

Custom LiteLLM providers for two genuinely free image-generation APIs that LiteLLM has no built-in support for:

  • Pollinations.ai — a fast, unauthenticated, synchronous API. Good as a primary provider.
  • AI Horde — a free, crowdsourced-worker API (submit a job, poll until a volunteer worker finishes it). Good as a fallback — it hides the submit-then-poll dance behind the same blocking image_generation/aimage_generation contract LiteLLM expects, so callers of /images/generations see one call either way.

Both are commonly wired as a primary/fallback pair (Pollinations first, AI Horde behind it) in LiteLLM's router fallbacks config.

Why this exists

LiteLLM's /images/generations endpoint has no native provider for either of these APIs. LiteLLM does support registering custom providers via litellm.custom_provider_map + the litellm.llms.custom_llm.CustomLLM base class — that's a first-class, public LiteLLM extension mechanism, not a fork. This package packages that up as an installable dependency instead of code you'd otherwise have to copy-paste into your own deployment.

Installation

pip install litellm-free-image-providers

Usage

LiteLLM only picks up custom providers registered before a request for that provider is dispatched — typically via code that runs at process startup. The standard way to do that without touching LiteLLM's own source is a sitecustomize.py on the Python path: the interpreter's site module imports it automatically at startup, before your main program runs.

sitecustomize.py:

from litellm_free_image_providers import register_all

register_all()

Or register just one:

from litellm_free_image_providers import register_pollinations

register_pollinations()

Then reference them in your LiteLLM config.yaml like any other custom provider — the model string must be <provider>/<anything> (LiteLLM's async image-generation path needs the custom_llm_provider prefix baked into the model string itself, not just set via litellm_params.custom_llm_provider, since it doesn't forward that field through on the image-generation path):

model_list:
  - model_name: pollinations-image
    litellm_params:
      model: pollinations_image_custom/flux
      custom_llm_provider: pollinations_image_custom
      timeout: 45
      num_retries: 0

  - model_name: ai-horde-image
    litellm_params:
      model: ai_horde_image_custom/stable_diffusion
      custom_llm_provider: ai_horde_image_custom
      timeout: 180
      num_retries: 0

router_settings:
  fallbacks:
    - pollinations-image: ["pollinations-image", "ai-horde-image"]

num_retries: 0 on both is deliberate: LiteLLM's router retries the same deployment before ever falling back to the next one in the chain, so without this a failing pollinations-image call would burn a second attempt before AI Horde is even tried — worse latency for no benefit once a request has already failed once.

Development

python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

License

MIT

Metadata

Release files for litellm-free-image-providers 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for litellm-free-image-providers 0.1.1
File Size Uploaded
litellm_free_image_providers-0.1.1.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for litellm-free-image-providers 0.1.1
File Interpreter ABI Platform
litellm_free_image_providers-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.7 kB

Release files / litellm_free_image_providers-0.1.1.tar.gz

Download URL litellm_free_image_providers-0.1.1.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2548b52c90f7c8a3e1a965274497d4968050e35ce3a55c505a35414a43f66098
BLAKE2b-256 checksum
How to use checksums
bf0e26cb2aa4ee98a9b16e711e6c66848cd83eda4740963292965924a76b13df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release files / litellm_free_image_providers-0.1.1-py3-none-any.whl

Download URL litellm_free_image_providers-0.1.1-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a04d2929d59ee53edc5ba7008a7bd1101822ecf58bfe68b8bfc6e8c8ba9a545e
BLAKE2b-256 checksum
How to use checksums
d822582ce14825d83251b9d38f39a76bd93c67f888552dcc5efddf2e206e40be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page