# Mirage Avatar X

> The Avatar X API offers access to Mirage's most advanced generation model yet, delivering
industry-leading identity preservation and expressivity in AI video


## Overview

- **Endpoint**: `https://fal.run/mirage-api/avatar-x/reference-to-video`
- **Model ID**: `mirage-api/avatar-x/reference-to-video`
- **Category**: image-to-video
- **Kind**: inference
**Tags**: avatar, lipsync, talking-head



## Pricing

- **Price**: $0.3 per seconds

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:


- **`audio_url`** (`string`, _required_):
  Publicly fetchable HTTPS URL of the driving audio; no cookies or authorization headers. Supports MP3, PCM WAV or AIFF, AAC or ALAC, Opus or Vorbis, and FLAC audio from 3 to 180 seconds and up to 64 MiB, with one mono or stereo stream sampled from 8 to 48 kHz. The generated video follows this audio.
  - Examples: "https://v3b.fal.media/files/b/0aa596e6/ko0yoMiCNRRAnMU5PQAHK_mirage-avatar-x-luke-reference-audio.wav"

- **`video_reference_url`** (`string`, _optional_):
  Publicly fetchable HTTPS URL of the reference video; no cookies or authorization headers. Takes precedence over image_reference_url when both are supplied. Supports H.264, H.265/HEVC, or ProRes in .mp4, .mov, or .m4v and VP8 or VP9 in .webm, from 1 to 120 seconds and up to 1 GiB, with exactly one video stream and a 9:16 or 16:9 display aspect ratio (within 5%). The video must contain a usable one-second reference window; any audio track is ignored.
  - Examples: "https://v3b.fal.media/files/b/0aa596d5/q8taheXQ-KlmtoC-uKViG_mirage-avatar-x-luke-reference-to-video-demo.mp4"

- **`avatar`** (`Enum`, _optional_):
  Stock visual that can be used instead of an image or video reference; it does not supply audio. Browse the [actor catalog](https://captions.ai/help/docs/api/actor-catalog) to preview the available visuals and copy the exact Avatar value. Default and None both mean no avatar. Any supplied image or video reference overrides the selection, and audio always comes from audio_url.
  - Options: `"None"`, `"Ayesha"`, `"Ayesha (16:9)"`, `"Diane (News)"`, `"Farhan"`, `"Farhan (16:9)"`, `"Giulia"`, `"Giulia (16:9)"`, `"Jasmine"`, `"Jasmine (16:9)"`, `"Luke"`, `"Luke (16:9)"`, `"Marcus (News)"`, `"Maya"`, `"Maya (16:9)"`, `"Michael"`, `"Michael (16:9)"`, `"Neha"`, `"Neha (16:9)"`, `"Stephanie (News)"`, `"Tariq"`, `"Tariq (16:9)"`, `"Tom (News)"`, `"Valerie"`, `"Valerie (16:9)"`

- **`image_reference_url`** (`string`, _optional_):
  Publicly fetchable HTTPS URL of the reference image; no cookies or authorization headers. Ignored when video_reference_url is also supplied. Supports one static .jpg, .jpeg, .png, or .webp image up to 25 MiB, with a short edge of at least 512 px, no edge over 8192 px, at most 25 megapixels, and a 9:16 or 16:9 aspect ratio (within 5%).



**Required Parameters Example**:

```json
{
  "audio_url": "https://v3b.fal.media/files/b/0aa596e6/ko0yoMiCNRRAnMU5PQAHK_mirage-avatar-x-luke-reference-audio.wav"
}
```

**Full Example**:

```json
{
  "audio_url": "https://v3b.fal.media/files/b/0aa596e6/ko0yoMiCNRRAnMU5PQAHK_mirage-avatar-x-luke-reference-audio.wav",
  "video_reference_url": "https://v3b.fal.media/files/b/0aa596d5/q8taheXQ-KlmtoC-uKViG_mirage-avatar-x-luke-reference-to-video-demo.mp4"
}
```


### Output Schema

The API returns the following output format:

- **`video`** (`Video`, _required_)
  - Examples: {"file_size":11833398,"content_type":"video/mp4","url":"https://v3b.fal.media/files/b/0aa596d5/q8taheXQ-KlmtoC-uKViG_mirage-avatar-x-luke-reference-to-video-demo.mp4","file_name":"mirage-avatar-x-luke-reference-to-video-demo.mp4"}



**Example Response**:

```json
{
  "video": {
    "file_size": 11833398,
    "content_type": "video/mp4",
    "url": "https://v3b.fal.media/files/b/0aa596d5/q8taheXQ-KlmtoC-uKViG_mirage-avatar-x-luke-reference-to-video-demo.mp4",
    "file_name": "mirage-avatar-x-luke-reference-to-video-demo.mp4"
  }
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/mirage-api/avatar-x/reference-to-video \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "audio_url": "https://v3b.fal.media/files/b/0aa596e6/ko0yoMiCNRRAnMU5PQAHK_mirage-avatar-x-luke-reference-audio.wav"
   }'
```

### 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(
    "mirage-api/avatar-x/reference-to-video",
    arguments={
        "audio_url": "https://v3b.fal.media/files/b/0aa596e6/ko0yoMiCNRRAnMU5PQAHK_mirage-avatar-x-luke-reference-audio.wav"
    },
    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("mirage-api/avatar-x/reference-to-video", {
  input: {
    audio_url: "https://v3b.fal.media/files/b/0aa596e6/ko0yoMiCNRRAnMU5PQAHK_mirage-avatar-x-luke-reference-audio.wav"
  },
  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/mirage-api/avatar-x/reference-to-video)
- [API Documentation](https://fal.ai/models/mirage-api/avatar-x/reference-to-video/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=mirage-api/avatar-x/reference-to-video)

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