Quickstart: Flux LoRA Inference

Together AI now provides a high-speed endpoint for the FLUX.1 [dev] model with integrated LoRA support. This enables swift and high-quality image generation using pre-trained LoRA adaptations for personalized outputs, unique styles, brand identities, and product-specific visualizations.

Fine-tuning for FLUX LoRA is not yet available.

Generating an image using Flux LoRAs

Some Flux LoRA fine-tunes need to be activated using a trigger phrases that can be used in the prompt and can typically be found in the model cards. For example with: https://huggingface.co/multimodalart/flux-tarot-v1, you should use in the style of TOK a trtcrd tarot style to trigger the image generation.

You can add up to 2 LoRAs per image to combine the style from the different fine-tunes. The scale parameter allows you to specify the strength of each LoRA. Typically values of 0.3-1.2 will produce good results.

from together import Together

client = Together()
response = client.images.generate(
    prompt="a BLKLGHT image of man walking outside on rainy day",
    model="black-forest-labs/FLUX.1-dev-lora",
    width=1024,
    height=768,
    steps=28,
    n=1,
    response_format="url",
    image_loras=[
        {"path": "https://replicate.com/fofr/flux-black-light", "scale": 0.8},
        {"path": "https://huggingface.co/XLabs-AI/flux-RealismLora", "scale": 0.8},
    ],
)
print(response.data[0].url)
curl -X POST "https://api.together.xyz/v1/images/generations"
-H "Authorization: Bearer $TOGETHER_API_KEY"
-H "Content-Type: application/json"
-d '{
    "model": "black-forest-labs/FLUX.1-dev-lora",
    "prompt": "cute dog",
    "width": 1024,
    "height": 768,
    "steps": 28,
    "n": 1,
    "response_format": "url",
    "image_loras": [{"path":"https://huggingface.co/XLabs-AI/flux-RealismLora","scale":1},
        {"path": "https://huggingface.co/XLabs-AI/flux-RealismLora", "scale": 0.8}]
   }'

Acceptable LoRA URL formats

You can point to any URL that has a .safetensors file with a valid Flux LoRA fine-tune.

*Note: the HuggingFace web page for a file (https://huggingface.co/XLabs-AI/flux-lora-collection/blob/main/anime_lora.safetensors) will NOT work

If the safetensors file has incompatible keys, you'll get the message " has unused keys <keys...>". This will happen if you pass a finetune of a non-flux model or an otherwise invalid file.

Examples

The example below produces a realistic tarot card of a panda:

prompt = "a baby panda eating bamboo in the style of TOK a trtcrd tarot style"

response = client.images.generate(
    prompt=prompt,
    model="black-forest-labs/FLUX.1-dev-lora",
    width=1024,
    height=768,
    steps=28,
    n=1,
    response_format="url",
    image_loras=[
        {"path": "https://huggingface.co/multimodalart/flux-tarot-v1", "scale": 1},
        {
            "path": "https://huggingface.co/Shakker-Labs/FLUX.1-dev-LoRA-add-details",
            "scale": 0.8,
        },
    ],
)

Pricing

Your request costs $0.035 per megapixel. For $1, you can run this model approximately 29 times. Image charges are calculated by rounding up to the nearest megapixel.