# Image Generation Guide

## Overview

This guide covers image generation using the FlyMyAI platform. We'll walk through available models, parameters, and how to get the best results.

## Available Models

- [SDXLTurbo](https://app.flymy.ai/flymyai/SDXLTurbo) - Ultra-fast image generation
- [NanoBananaPro](https://app.flymy.ai/flymyai/nano-banana-pro) - High-quality image generation
- [Flux Dev Fast](https://app.flymy.ai/flymyai/flux-dev-fast) - Fast development-quality generation
- [Flux Schnell Fast](https://app.flymy.ai/flymyai/flux-schnell-fast) - Ultra-fast Flux generation
- [Flux Schnell LoRA](https://app.flymy.ai/flymyai/flux-schnell-lora) - Fast customizable generation with LoRA support
- [Flux Dev LoRA](https://app.flymy.ai/flymyai/flux-dev-lora) - Customizable image generation with LoRA support

## Basic Usage

### SDXLTurbo (fastest)

```python
from flymyai import client
import base64

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

response = fma_client.predict(
    model="flymyai/SDXLTurbo",
    payload={
        "prompt": "A beautiful sunset over mountains, digital art",
        "negative_prompt": "blurry, low quality",
    }
)

# SDXLTurbo returns base64 image under the "sample" key
image_data = base64.b64decode(response.output_data["sample"][0])
with open("output.jpg", "wb") as f:
    f.write(image_data)
```

### NanoBananaPro

```python
from flymyai import client
import base64

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

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

# NanoBananaPro returns base64 image under the "image" key
image_data = base64.b64decode(response.output_data["image"][0])
with open("output.png", "wb") as f:
    f.write(image_data)
```

> **Note**
>
> Different models return output under different keys (e.g. `sample`, `image`). Check the model page on [FlyMy.AI](https://app.flymy.ai) for the exact output schema.

## Parameters

| Parameter | Description |
|-----------|-------------|
| `prompt` | Text description of the image you want to generate |
| `negative_prompt` | Elements you want to avoid in the generated image |
| `width` | Image width in pixels |
| `height` | Image height in pixels |
| `num_inference_steps` | Number of denoising steps (higher = better quality but slower) |
| `guidance_scale` | How closely to follow the prompt (higher = more faithful) |
| `seed` | Random seed for reproducibility |

Not all parameters are supported by every model. Check the model page for the exact parameters available.

## Best Practices

1. Be specific in your prompts
2. Use negative prompts to avoid unwanted elements
3. Experiment with different parameters
4. Use appropriate image dimensions for your use case
5. Save your seeds for reproducible results

## Related Guides

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