Skip to main content

Flux Models Guide

Overview

The Flux family of models provides fast and efficient image generation with optional LoRA support for customization.

Available Models

Basic Usage

Flux Schnell Fast

from flymyai import client
import base64

fma_client = client(apikey="fly-***")

response = fma_client.predict(
model="flymyai/flux-schnell-fast",
payload={
"prompt": "A magical forest with glowing mushrooms and fairies",
"height": 1024,
"width": 1024,
"num_inference_steps": 4,
"seed": 42
}
)

image_data = base64.b64decode(response.output_data["sample"][0])
with open("output.jpg", "wb") as f:
f.write(image_data)

Flux Dev Fast

from flymyai import client
import base64

fma_client = client(apikey="fly-***")

response = fma_client.predict(
model="flymyai/flux-dev-fast",
payload={
"prompt": "A photorealistic portrait of an astronaut on Mars",
"height": 1024,
"width": 1024,
"num_inference_steps": 4,
"seed": 42
}
)

image_data = base64.b64decode(response.output_data["sample"][0])
with open("output.jpg", "wb") as f:
f.write(image_data)

Parameters

ParameterDescription
promptText description of the image you want to generate
heightImage height in pixels
widthImage width in pixels
num_inference_stepsNumber of denoising steps
guidance_scaleHow closely to follow the prompt
seedRandom seed for reproducibility
lora_urlURL of the LoRA model to apply (for LoRA variants)
lora_scaleStrength of the LoRA effect (0.0 to 1.0)

LoRA Support

Flux LoRA variants allow you to apply custom LoRA models to influence the generation style. Provide a publicly accessible URL to a .safetensors file:

from flymyai import client
import base64

fma_client = client(apikey="fly-***")

response = fma_client.predict(
model="flymyai/flux-schnell-lora",
payload={
"prompt": "a robotic cat with a cyberpunk style",
"height": 1024,
"width": 1024,
"num_inference_steps": 4,
"guidance_scale": "0",
"seed": 1654,
"lora_url": "https://civitai.com/api/download/models/730973?type=Model&format=SafeTensor",
"lora_scale": "0.9"
}
)

image_data = base64.b64decode(response.output_data["sample"][0])
with open("lora_output.jpg", "wb") as f:
f.write(image_data)