1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# v1.ai_talking_photo
## Module Functions
### AI Talking Photo <a name="create"></a>
Create a talking photo video from an image and an audio file.
**API Endpoint**: `POST /v1/ai-talking-photo`
#### Parameters
| Parameter | Required | Deprecated | Description | Example |
| -------------------- | :------: | :--------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `assets` | ✓ | ✗ | Provide the assets for creating a talking photo | `V1AiTalkingPhotoCreateBodyAssets {audio_file_path: "api-assets/id/1234.mp3".to_string(), image_file_path: "api-assets/id/1234.png".to_string()}` |
| `└─ audio_file_path` | ✓ | — | The audio file to sync with the image. This value is either - a direct URL to the file. The URL path must end in a supported file extension. - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.mp3".to_string()` |
| `└─ image_file_path` | ✓ | — | The source image to animate. This value is either - a direct URL to the file. The URL path must end in a supported file extension. - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.png".to_string()` |
| `end_seconds` | ✓ | ✗ | The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 300s, prompted 60s. | `5.0` |
| `start_seconds` | ✓ | ✗ | The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 300s, prompted 60s. | `0.0` |
| `max_resolution` | ✗ | ✓ | Deprecated: use `resolution`. Still accepted as a larger-dimension cap, limited by your plan. Ignored when `resolution` is provided. After plan capping: * Below 1280 maps to `480p` (intermediate values round down). * 1280 or above maps to `720p`. | `123` |
| `name` | ✗ | ✗ | Give your video a custom name for easy identification. | `"My Talking Photo video".to_string()` |
| `resolution` | ✗ | ✗ | Output preset. Overrides `max_resolution`. Defaults to 480p in prompted mode; realistic mode uses the mapped plan maximum. | `V1AiTalkingPhotoCreateBodyResolutionEnum::Enum480p` |
| `style` | ✗ | ✗ | Attributes used to dictate the style of the output | `V1AiTalkingPhotoCreateBodyStyle {generation_mode: Some(V1AiTalkingPhotoCreateBodyStyleGenerationModeEnum::Realistic), prompt: Some("A person smiling and speaking naturally to the camera".to_string()), ..Default::default()}` |
| `└─ generation_mode` | ✗ | — | Controls overall motion style. * `realistic` - Maintains likeness well, high quality, and reliable. * `prompted` - Slightly lower likeness; allows option to prompt scene. **Deprecated values (maintained for backward compatibility):** * `pro` - Deprecated: use `realistic` * `standard` - Deprecated: use `prompted` * `stable` - Deprecated: use `realistic` * `expressive` - Deprecated: use `prompted` | `V1AiTalkingPhotoCreateBodyStyleGenerationModeEnum::Realistic` |
| `└─ intensity` | ✗ | ✓ | Note: this value is only applicable when generation_mode is `expressive`. The value can include up to 2 decimal places. * Lower values yield more stability but can suppress mouth movement. * Higher values increase motion and expressiveness, with a higher risk of distortion. | `123.0` |
| `└─ prompt` | ✗ | — | A text prompt to guide the generation. Only applicable when generation_mode is `prompted`. This field is ignored for other modes. | `"A person smiling and speaking naturally to the camera".to_string()` |
#### Example Snippet
```rust
let client = magic_hour::Client::default()
.with_bearer_auth(&std::env::var("API_TOKEN").unwrap());
let res = client
.v1()
.ai_talking_photo()
.create(magic_hour::resources::v1::ai_talking_photo::CreateRequest {
assets: magic_hour::models::V1AiTalkingPhotoCreateBodyAssets {
audio_file_path: "api-assets/id/1234.mp3".to_string(),
image_file_path: "api-assets/id/1234.png".to_string(),
},
end_seconds: 5.0,
name: Some("My Talking Photo video".to_string()),
resolution: Some(
magic_hour::models::V1AiTalkingPhotoCreateBodyResolutionEnum::Enum480p,
),
start_seconds: 0.0,
..Default::default()
})
.await;
```
#### Response
##### Type
[V1AiTalkingPhotoCreateResponse](/src/models/v1_ai_talking_photo_create_response.rs)
##### Example
```rust
V1AiTalkingPhotoCreateResponse {credits_charged: 450, estimated_frame_cost: 123, id: "cuid-example".to_string()}
```