- Python SDK: Your code connects directly to the Lumenfall API. Recommended if you just want to use media models, as Lumenfall unifies all models and providers to correctly work with the LiteLLM SDK.
- Proxy server: You can use any OpenAI-compatible SDK to connect to the LiteLLM proxy. The proxy then calls the Lumenfall API. This mode makes sense if you are already using the proxy or want to use other providers alongside Lumenfall, especially for text models.
Connecting Lumenfall to LiteLLM
LiteLLM uses a provider prefix on the model name (e.g.,openai/gpt-image-1.5, vertex_ai/gemini-2.5-flash-image) to determine which backend to route a request to. Lumenfall is not a built-in LiteLLM provider, so we need to add a prefix to make sure requests are routed to Lumenfall.
There are three integration approaches:
| Approach | Model format | Status |
|---|---|---|
openai/ prefix | openai/gemini-3-pro-image | Recommended - works for generation and editing (minor limitations) |
hosted_vllm/ prefix | hosted_vllm/gemini-3-pro-image | Generation only - no image_edit support |
Custom lumenfall/ provider | lumenfall/gemini-3-pro-image | Not yet working - upstream bugs |
The LiteLLM provider prefix (e.g.,
openai/, hosted_vllm/) is not the same as a Lumenfall provider prefix (e.g., fal/, replicate/). The LiteLLM prefix tells LiteLLM which client to use for the request. The Lumenfall provider prefix tells Lumenfall which backend provider to route to. They are independent - for example, openai/fal/flux.2-max uses the LiteLLM openai/ client to send a request to Lumenfall, which then routes to fal.ai.openai/ prefix throughout. See Provider prefix options at the end for details on the alternatives.
Installation
Configuration
Set your Lumenfall credentials once so you don’t need to pass them on every call:Python SDK
Generate images
Uselitellm.image_generation() to create images:
Lumenfall handles parameter transformation on the backend. When you request
size="1024x1024" for a model that uses different dimensions or even only supports different parameters such as aspect ratio, Lumenfall automatically maps it to the closest supported size.Generation options
Useextra_body to pass additional parameters that aren’t part of LiteLLM’s function signature directly to the Lumenfall API.
openai/ prefix, response_format and style must go through extra_body because LiteLLM validates parameters against its built-in OpenAI model configs, which don’t include these for non-OpenAI models. Standard parameters like n and size can be passed directly.
Edit images
Uselitellm.image_edit() to edit existing images:
Async support
Useaimage_generation() and aimage_edit() for async operations:
Forcing a Lumenfall provider
Lumenfall routes requests to underlying providers like OpenAI, Vertex AI, Replicate, and fal.ai. By default, Lumenfall selects the best provider automatically. You can force a specific provider by prefixing the model name with the provider slug:Per-call configuration
You can passapi_key and api_base on individual calls instead of using environment variables:
Proxy server
The LiteLLM Proxy is a server that exposes an OpenAI-compatible API. You configure Lumenfall models once in a YAML file, then any OpenAI client can use them without knowing about provider prefixes or base URLs. Add this to yourlitellm_config.yaml:
The
os.environ/LUMENFALL_API_KEY syntax tells the proxy to read the API key from an environment variable at runtime, so you don’t hardcode secrets in the config file.Provider prefix options
This section provides more detail on the trade-offs of each approach.openai/ (recommended)
Theopenai/ prefix works for both image generation and editing. LiteLLM validates parameters against its OpenAI image configs, which blocks response_format and style for models that aren’t dall-e-2, dall-e-3, or gpt-image-*. You can work around this by passing blocked parameters via extra_body:
image_edit, where response_format is supported directly.
hosted_vllm/ (generation only)
Thehosted_vllm/ prefix provides full parameter passthrough with no validation - useful if you need response_format or style without the extra_body workaround.
hosted_vllm provider does not support the image_edit endpoint. If you need image editing, use openai/ instead.
Custom lumenfall/ provider
LiteLLM supports registering custom providers via a JSON file, which would allow a cleanerlumenfall/model-name syntax without api_base on every call. This would be the ideal approach, but it currently has upstream bugs for image endpoints:
- Image generation returns empty results (
data=[]) despite the request succeeding upstream (related: #18961, #6513) - Image editing fails with a provider validation error (related: #7575)