# FLUX 3 Klein LoRA Trainer

> Fine-tune FLUX 3 Image Klein with your own images to teach it a subject, a product or a style.


## Overview

- **Endpoint**: `https://fal.run/blackforestlabs/flux-3/klein/base/trainer`
- **Model ID**: `blackforestlabs/flux-3/klein/base/trainer`
- **Category**: training
- **Kind**: training
**Description**: Train a LoRA on the FLUX 3 Image Klein base model from a .zip of images. Each image ROOT.png/jpg/jpeg/webp can ship a caption ROOT.txt; images without one use trigger_phrase. Options: steps 100-10000 (default 1000), learning_rate (default 1e-4), resolution 512, 768 or 1024 (default 1024, aspect ratio kept). Returns lora_file (safetensors) and config_file. Use the LoRA on FLUX 3 Klein LoRA endpoints (base recommended). Billed per training step, minimum 100 steps.

**Tags**: flux, lora, fine-tuning



## Pricing

Your request will cost **$0.0043** per training step (minimum 100 steps). The default 1000 steps cost **$4.30**.

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`images_data_url`** (`string`, _required_):
  URL to a .zip archive of training images (PNG/JPG/JPEG/WebP). An image named ROOT.EXT pairs with an optional caption file ROOT.txt; images without one use `trigger_phrase` as their caption.

- **`trigger_phrase`** (`string`, _optional_):
  Caption for every image that ships no caption file. Required when any image lacks one. Default value: `""`
  - Default: `""`

- **`steps`** (`integer`, _optional_):
  Number of training steps. Default value: `1000`
  - Default: `1000`
  - Range: `100` to `10000`

- **`learning_rate`** (`float`, _optional_):
  Learning rate of the LoRA parameters. Default value: `0.0001`
  - Default: `0.0001`
  - Range: `0.000001` to `0.01`

- **`resolution`** (`ResolutionEnum`, _optional_):
  Training resolution. Images keep their aspect ratio and are resized to about resolution x resolution pixels. Default value: `"1024"`
  - Default: `1024`
  - Options: `512`, `768`, `1024`



**Required Parameters Example**:

```json
{
  "images_data_url": ""
}
```

**Full Example**:

```json
{
  "images_data_url": "",
  "steps": 1000,
  "learning_rate": 0.0001,
  "resolution": 1024
}
```


### Output Schema

The API returns the following output format:

- **`lora_file`** (`File`, _required_):
  URL to the trained LoRA weights.

- **`config_file`** (`File`, _required_):
  URL to the training configuration.



**Example Response**:

```json
{
  "lora_file": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  },
  "config_file": {
    "url": "",
    "content_type": "image/png",
    "file_name": "z9RV14K95DvU.png",
    "file_size": 4404019
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/blackforestlabs/flux-3/klein/base/trainer \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "images_data_url": ""
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "blackforestlabs/flux-3/klein/base/trainer",
    arguments={
        "images_data_url": ""
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("blackforestlabs/flux-3/klein/base/trainer", {
  input: {
    images_data_url: ""
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/blackforestlabs/flux-3/klein/base/trainer)
- [API Documentation](https://fal.ai/models/blackforestlabs/flux-3/klein/base/trainer/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=blackforestlabs/flux-3/klein/base/trainer)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
