# Flux Models Guide

## Overview

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

## Available Models

- [Flux Dev Fast](https://app.flymy.ai/flymyai/flux-dev-fast) - Fast development-quality image generation
- [Flux Schnell Fast](https://app.flymy.ai/flymyai/flux-schnell-fast) - Ultra-fast image generation
- [Flux Dev LoRA](https://app.flymy.ai/flymyai/flux-dev-lora) - Development version with LoRA support
- [Flux Schnell LoRA](https://app.flymy.ai/flymyai/flux-schnell-lora) - Fast version with LoRA support

## Basic Usage

### Flux Schnell Fast

```python
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

```python
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

| Parameter | Description |
|-----------|-------------|
| `prompt` | Text description of the image you want to generate |
| `height` | Image height in pixels |
| `width` | Image width in pixels |
| `num_inference_steps` | Number of denoising steps |
| `guidance_scale` | How closely to follow the prompt |
| `seed` | Random seed for reproducibility |
| `lora_url` | URL of the LoRA model to apply (for LoRA variants) |
| `lora_scale` | Strength 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:

```python
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)
```

## Related Guides

- [Image Generation](https://docs.flymy.ai/guides/generate-images.md)
- [Video Generation](https://docs.flymy.ai/guides/generate-videos.md)
- [API Reference](https://docs.flymy.ai/api/overview.md)
