# MiniMax H3 Text to Video LoRA Trainer

> Train a MiniMax H3 LoRA on your own captioned clips for pure text-to-video generation with matching audio.


## Overview

- **Endpoint**: `https://fal.run/minimax/h3/t2v/trainer`
- **Model ID**: `minimax/h3/t2v/trainer`
- **Category**: training
- **Kind**: training
**Tags**: utility, editing



## Pricing

The cost of training depends on the number of steps. The formula is: 0.005 * steps. With 1000 steps, your request will cost **$5.00**.

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:


- **`training_data_url`** (`string`, _required_):
  URL to zip archive with videos or images. Try to use at least 10 files, although more is better.
  
  **Supported video formats:** .mp4, .mov, .avi, .mkv
  **Supported image formats:** .png, .jpg, .jpeg
  
  Note: The dataset must contain ONLY videos OR ONLY images - mixed datasets are not supported.
  
  The archive can also contain text files with captions. Each text file should have the same name as the media file it corresponds to.

- **`rank`** (`RankEnum`, _optional_):
  The rank of the LoRA adaptation. Higher values increase capacity but use more memory. Default value: `"32"`
  - Default: `32`
  - Options: `8`, `16`, `32`, `64`, `128`
  - Examples: 32

- **`number_of_steps`** (`integer`, _optional_):
  The number of training steps. Default value: `2000`
  - Default: `2000`
  - Range: `1` to `6000`
  - Examples: 2000

- **`learning_rate`** (`float`, _optional_):
  Learning rate for optimization. Higher values can lead to faster training but may cause overfitting. Default value: `0.0002`
  - Default: `0.0002`
  - Range: `0.000001` to `1`
  - Examples: 0.0002

- **`number_of_frames`** (`integer`, _optional_):
  Number of frames per training sample. Must satisfy frames % 17 == 5 (e.g., 22, 39, 56, 73, 90, 107, 124). Default value: `73`
  - Default: `73`
  - Range: `22` to `124`
  - Examples: 73

- **`frame_rate`** (`integer`, _optional_):
  Target frames per second for the video. Default value: `24`
  - Default: `24`
  - Range: `8` to `60`
  - Examples: 24

- **`resolution`** (`ResolutionEnum`, _optional_):
  Resolution to use for training. Higher resolutions require more memory. Default value: `"medium"`
  - Default: `"medium"`
  - Options: `"low"`, `"medium"`, `"high"`
  - Examples: "medium"

- **`aspect_ratio`** (`AspectRatioEnum`, _optional_):
  Aspect ratio to use for training. Matches the aspect ratios supported by the MiniMax H3 API. Default value: `"16:9"`
  - Default: `"16:9"`
  - Options: `"21:9"`, `"16:9"`, `"4:3"`, `"1:1"`, `"3:4"`, `"9:16"`
  - Examples: "16:9"

- **`trigger_phrase`** (`string`, _optional_):
  A phrase that will trigger the LoRA style. Will be prepended to captions during training. Default value: `""`
  - Default: `""`
  - Examples: ""

- **`first_frame_conditioning_p`** (`float`, _optional_):
  Fixed at 0: this endpoint trains the pure text-to-video-audio objective. Use the image-to-video-audio or first-last-frame endpoints for keyframe conditioning.
  - Default: `0`
  - Range: `0` to `0`

- **`auto_scale_input`** (`boolean`, _optional_):
  If true, videos will be automatically scaled to the target frame count and fps. This option has no effect on image datasets.
  - Default: `false`
  - Examples: false

- **`split_input_into_scenes`** (`boolean`, _optional_):
  If true, videos above a certain duration threshold will be split into scenes. Default value: `true`
  - Default: `true`
  - Examples: true

- **`split_input_duration_threshold`** (`float`, _optional_):
  The duration threshold in seconds. If a video is longer than this, it will be split into scenes. Default value: `30`
  - Default: `30`
  - Range: `1` to `60`
  - Examples: 30

- **`debug_dataset`** (`boolean`, _optional_):
  When enabled, the trainer returns a downloadable archive of your preprocessed training data for manual inspection. Use this to verify that your videos, images, and captions were processed correctly before committing to a full training run.
  - Default: `false`

- **`strict_dataset`** (`boolean`, _optional_):
  Reject dataset-quality fallbacks during preprocessing, including captions that would use a blank prompt, missing sidecar keyframes, and videos without a readable audio track. By default these cases are reported in logs and use the documented blank-prompt, clip-frame, or silence fallback.
  - Default: `false`
  - Examples: false



**Required Parameters Example**:

```json
{
  "training_data_url": ""
}
```

**Full Example**:

```json
{
  "training_data_url": "",
  "rank": 32,
  "number_of_steps": 2000,
  "learning_rate": 0.0002,
  "number_of_frames": 73,
  "frame_rate": 24,
  "resolution": "medium",
  "aspect_ratio": "16:9",
  "trigger_phrase": "",
  "auto_scale_input": false,
  "split_input_into_scenes": true,
  "split_input_duration_threshold": 30,
  "strict_dataset": false
}
```


### Output Schema

The API returns the following output format:

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

- **`config_file`** (`File`, _required_):
  Configuration used for setting up inference endpoints.

- **`debug_dataset`** (`File`, _optional_):
  A downloadable archive containing the preprocessed training data. Only present when `debug_dataset` is enabled in the input.



**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/minimax/h3/t2v/trainer \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "training_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(
    "minimax/h3/t2v/trainer",
    arguments={
        "training_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("minimax/h3/t2v/trainer", {
  input: {
    training_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/minimax/h3/t2v/trainer)
- [API Documentation](https://fal.ai/models/minimax/h3/t2v/trainer/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=minimax/h3/t2v/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`
