magic_hour 0.34.0__py3-none-any.whl → 0.36.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of magic_hour might be problematic. Click here for more details.

Files changed (97) hide show
  1. magic_hour/README.md +35 -0
  2. magic_hour/core/base_client.py +6 -5
  3. magic_hour/core/query.py +12 -6
  4. magic_hour/core/request.py +3 -3
  5. magic_hour/core/response.py +18 -14
  6. magic_hour/core/utils.py +3 -3
  7. magic_hour/environment.py +1 -1
  8. magic_hour/helpers/__init__.py +3 -0
  9. magic_hour/helpers/download.py +75 -0
  10. magic_hour/resources/v1/README.md +33 -0
  11. magic_hour/resources/v1/ai_clothes_changer/README.md +73 -0
  12. magic_hour/resources/v1/ai_clothes_changer/client.py +146 -0
  13. magic_hour/resources/v1/ai_face_editor/README.md +110 -0
  14. magic_hour/resources/v1/ai_face_editor/client.py +168 -0
  15. magic_hour/resources/v1/ai_gif_generator/README.md +59 -0
  16. magic_hour/resources/v1/ai_gif_generator/client.py +119 -0
  17. magic_hour/resources/v1/ai_headshot_generator/README.md +60 -0
  18. magic_hour/resources/v1/ai_headshot_generator/client.py +140 -0
  19. magic_hour/resources/v1/ai_image_editor/README.md +64 -0
  20. magic_hour/resources/v1/ai_image_editor/client.py +136 -0
  21. magic_hour/resources/v1/ai_image_generator/README.md +66 -0
  22. magic_hour/resources/v1/ai_image_generator/client.py +139 -0
  23. magic_hour/resources/v1/ai_image_upscaler/README.md +67 -0
  24. magic_hour/resources/v1/ai_image_upscaler/client.py +150 -0
  25. magic_hour/resources/v1/ai_meme_generator/README.md +71 -0
  26. magic_hour/resources/v1/ai_meme_generator/client.py +127 -0
  27. magic_hour/resources/v1/ai_photo_editor/README.md +98 -7
  28. magic_hour/resources/v1/ai_photo_editor/client.py +174 -0
  29. magic_hour/resources/v1/ai_qr_code_generator/README.md +63 -0
  30. magic_hour/resources/v1/ai_qr_code_generator/client.py +123 -0
  31. magic_hour/resources/v1/ai_talking_photo/README.md +74 -0
  32. magic_hour/resources/v1/ai_talking_photo/client.py +170 -0
  33. magic_hour/resources/v1/animation/README.md +100 -0
  34. magic_hour/resources/v1/animation/client.py +218 -0
  35. magic_hour/resources/v1/auto_subtitle_generator/README.md +69 -0
  36. magic_hour/resources/v1/auto_subtitle_generator/client.py +178 -0
  37. magic_hour/resources/v1/face_detection/README.md +59 -0
  38. magic_hour/resources/v1/face_detection/__init__.py +10 -2
  39. magic_hour/resources/v1/face_detection/client.py +179 -0
  40. magic_hour/resources/v1/face_swap/README.md +105 -12
  41. magic_hour/resources/v1/face_swap/client.py +262 -28
  42. magic_hour/resources/v1/face_swap_photo/README.md +84 -0
  43. magic_hour/resources/v1/face_swap_photo/client.py +172 -0
  44. magic_hour/resources/v1/files/README.md +6 -0
  45. magic_hour/resources/v1/files/client.py +350 -0
  46. magic_hour/resources/v1/files/client_test.py +414 -0
  47. magic_hour/resources/v1/files/upload_urls/README.md +8 -0
  48. magic_hour/resources/v1/image_background_remover/README.md +68 -0
  49. magic_hour/resources/v1/image_background_remover/client.py +130 -0
  50. magic_hour/resources/v1/image_projects/README.md +8 -0
  51. magic_hour/resources/v1/image_projects/__init__.py +10 -2
  52. magic_hour/resources/v1/image_projects/client.py +138 -0
  53. magic_hour/resources/v1/image_projects/client_test.py +527 -0
  54. magic_hour/resources/v1/image_to_video/README.md +77 -9
  55. magic_hour/resources/v1/image_to_video/client.py +210 -8
  56. magic_hour/resources/v1/lip_sync/README.md +87 -13
  57. magic_hour/resources/v1/lip_sync/client.py +230 -28
  58. magic_hour/resources/v1/photo_colorizer/README.md +59 -0
  59. magic_hour/resources/v1/photo_colorizer/client.py +130 -0
  60. magic_hour/resources/v1/text_to_video/README.md +68 -0
  61. magic_hour/resources/v1/text_to_video/client.py +151 -0
  62. magic_hour/resources/v1/video_projects/README.md +8 -0
  63. magic_hour/resources/v1/video_projects/__init__.py +10 -2
  64. magic_hour/resources/v1/video_projects/client.py +137 -0
  65. magic_hour/resources/v1/video_projects/client_test.py +527 -0
  66. magic_hour/resources/v1/video_to_video/README.md +98 -14
  67. magic_hour/resources/v1/video_to_video/client.py +242 -28
  68. magic_hour/types/params/__init__.py +58 -0
  69. magic_hour/types/params/v1_ai_clothes_changer_generate_body_assets.py +33 -0
  70. magic_hour/types/params/v1_ai_face_editor_generate_body_assets.py +17 -0
  71. magic_hour/types/params/v1_ai_headshot_generator_generate_body_assets.py +17 -0
  72. magic_hour/types/params/v1_ai_image_editor_generate_body_assets.py +17 -0
  73. magic_hour/types/params/v1_ai_image_upscaler_generate_body_assets.py +17 -0
  74. magic_hour/types/params/v1_ai_photo_editor_generate_body_assets.py +17 -0
  75. magic_hour/types/params/v1_ai_talking_photo_generate_body_assets.py +26 -0
  76. magic_hour/types/params/v1_animation_generate_body_assets.py +39 -0
  77. magic_hour/types/params/v1_auto_subtitle_generator_generate_body_assets.py +17 -0
  78. magic_hour/types/params/v1_face_detection_generate_body_assets.py +17 -0
  79. magic_hour/types/params/v1_face_swap_create_body.py +24 -14
  80. magic_hour/types/params/v1_face_swap_create_body_style.py +33 -0
  81. magic_hour/types/params/v1_face_swap_generate_body_assets.py +56 -0
  82. magic_hour/types/params/v1_face_swap_generate_body_assets_face_mappings_item.py +25 -0
  83. magic_hour/types/params/v1_face_swap_photo_generate_body_assets.py +47 -0
  84. magic_hour/types/params/v1_face_swap_photo_generate_body_assets_face_mappings_item.py +25 -0
  85. magic_hour/types/params/v1_image_background_remover_generate_body_assets.py +27 -0
  86. magic_hour/types/params/v1_image_to_video_create_body.py +14 -6
  87. magic_hour/types/params/v1_image_to_video_generate_body_assets.py +17 -0
  88. magic_hour/types/params/v1_lip_sync_create_body.py +12 -14
  89. magic_hour/types/params/v1_lip_sync_generate_body_assets.py +36 -0
  90. magic_hour/types/params/v1_photo_colorizer_generate_body_assets.py +17 -0
  91. magic_hour/types/params/v1_video_to_video_create_body.py +12 -14
  92. magic_hour/types/params/v1_video_to_video_generate_body_assets.py +27 -0
  93. magic_hour-0.36.0.dist-info/METADATA +303 -0
  94. {magic_hour-0.34.0.dist-info → magic_hour-0.36.0.dist-info}/RECORD +96 -68
  95. magic_hour-0.34.0.dist-info/METADATA +0 -166
  96. {magic_hour-0.34.0.dist-info → magic_hour-0.36.0.dist-info}/LICENSE +0 -0
  97. {magic_hour-0.34.0.dist-info → magic_hour-0.36.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,17 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1AiImageUpscalerGenerateBodyAssets(typing_extensions.TypedDict):
6
+ """
7
+ Provide the assets for upscaling
8
+ """
9
+
10
+ image_file_path: typing_extensions.Required[str]
11
+ """
12
+ The image to upscale. This value is either
13
+ - a direct URL to the image file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
@@ -0,0 +1,17 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1AiPhotoEditorGenerateBodyAssets(typing_extensions.TypedDict):
6
+ """
7
+ Provide the assets for photo editor
8
+ """
9
+
10
+ image_file_path: typing_extensions.Required[str]
11
+ """
12
+ The image used to generate the output. This value is either
13
+ - a direct URL to the image file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
@@ -0,0 +1,26 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1AiTalkingPhotoGenerateBodyAssets(typing_extensions.TypedDict):
6
+ """
7
+ Provide the assets for creating a talking photo
8
+ """
9
+
10
+ audio_file_path: typing_extensions.Required[str]
11
+ """
12
+ The audio file to sync with the image. This value is either
13
+ - a direct URL to the video file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
18
+
19
+ image_file_path: typing_extensions.Required[str]
20
+ """
21
+ The source image to animate. This value is either
22
+ - a direct URL to the video file
23
+ - a path to a local file
24
+
25
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
26
+ """
@@ -0,0 +1,39 @@
1
+ import pydantic
2
+ import typing
3
+ import typing_extensions
4
+
5
+
6
+ class V1AnimationGenerateBodyAssets(typing_extensions.TypedDict):
7
+ """
8
+ Provide the assets for animation.
9
+ """
10
+
11
+ audio_file_path: typing_extensions.NotRequired[str]
12
+ """
13
+ The path of the input audio. This field is required if `audio_source` is `file`. This value is either
14
+ - a direct URL to the video file
15
+ - a path to a local file
16
+
17
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
18
+ """
19
+
20
+ audio_source: typing_extensions.Required[
21
+ typing_extensions.Literal["file", "none", "youtube"]
22
+ ]
23
+ """
24
+ Optionally add an audio source if you'd like to incorporate audio into your video
25
+ """
26
+
27
+ image_file_path: typing_extensions.NotRequired[str]
28
+ """
29
+ An initial image to use a the first frame of the video. This value is either
30
+ - a direct URL to the image file
31
+ - a path to a local file
32
+
33
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
34
+ """
35
+
36
+ youtube_url: typing_extensions.NotRequired[str]
37
+ """
38
+ Using a youtube video as the input source. This field is required if `audio_source` is `youtube`
39
+ """
@@ -0,0 +1,17 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1AutoSubtitleGeneratorGenerateBodyAssets(typing_extensions.TypedDict):
6
+ """
7
+ Provide the assets for auto subtitle generator
8
+ """
9
+
10
+ video_file_path: typing_extensions.Required[str]
11
+ """
12
+ This is the video used to add subtitles. This value is either
13
+ - a direct URL to the video file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
@@ -0,0 +1,17 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1FaceDetectionGenerateBodyAssets(typing_extensions.TypedDict):
6
+ """
7
+ Provide the assets for face detection
8
+ """
9
+
10
+ target_file_path: typing_extensions.Required[str]
11
+ """
12
+ This is the image or video where the face will be detected. This value is either
13
+ - a direct URL to the image file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
@@ -6,6 +6,10 @@ from .v1_face_swap_create_body_assets import (
6
6
  V1FaceSwapCreateBodyAssets,
7
7
  _SerializerV1FaceSwapCreateBodyAssets,
8
8
  )
9
+ from .v1_face_swap_create_body_style import (
10
+ V1FaceSwapCreateBodyStyle,
11
+ _SerializerV1FaceSwapCreateBodyStyle,
12
+ )
9
13
 
10
14
 
11
15
  class V1FaceSwapCreateBody(typing_extensions.TypedDict):
@@ -23,16 +27,15 @@ class V1FaceSwapCreateBody(typing_extensions.TypedDict):
23
27
  The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds.
24
28
  """
25
29
 
26
- height: typing_extensions.NotRequired[int]
30
+ height: typing_extensions.NotRequired[typing.Optional[int]]
27
31
  """
28
- Used to determine the dimensions of the output video.
29
-
30
- * If height is provided, width will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio.
31
- * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio.
32
+ `height` is deprecated and no longer influences the output video's resolution.
32
33
 
33
- Note: if the video's original resolution is less than the maximum, the video will not be resized.
34
+ Output resolution is determined by the **minimum** of:
35
+ - The resolution of the input video
36
+ - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
34
37
 
35
- See our [pricing page](https://magichour.ai/pricing) for more details.
38
+ This field is retained only for backward compatibility and will be removed in a future release.
36
39
  """
37
40
 
38
41
  name: typing_extensions.NotRequired[str]
@@ -45,16 +48,20 @@ class V1FaceSwapCreateBody(typing_extensions.TypedDict):
45
48
  The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.
46
49
  """
47
50
 
48
- width: typing_extensions.NotRequired[int]
51
+ style: typing_extensions.NotRequired[V1FaceSwapCreateBodyStyle]
52
+ """
53
+ Style of the face swap video.
49
54
  """
50
- Used to determine the dimensions of the output video.
51
-
52
- * If width is provided, height will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio.
53
- * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio.
55
+
56
+ width: typing_extensions.NotRequired[typing.Optional[int]]
57
+ """
58
+ `width` is deprecated and no longer influences the output video's resolution.
54
59
 
55
- Note: if the video's original resolution is less than the maximum, the video will not be resized.
60
+ Output resolution is determined by the **minimum** of:
61
+ - The resolution of the input video
62
+ - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
56
63
 
57
- See our [pricing page](https://magichour.ai/pricing) for more details.
64
+ This field is retained only for backward compatibility and will be removed in a future release.
58
65
  """
59
66
 
60
67
 
@@ -79,4 +86,7 @@ class _SerializerV1FaceSwapCreateBody(pydantic.BaseModel):
79
86
  start_seconds: float = pydantic.Field(
80
87
  alias="start_seconds",
81
88
  )
89
+ style: typing.Optional[_SerializerV1FaceSwapCreateBodyStyle] = pydantic.Field(
90
+ alias="style", default=None
91
+ )
82
92
  width: typing.Optional[int] = pydantic.Field(alias="width", default=None)
@@ -0,0 +1,33 @@
1
+ import pydantic
2
+ import typing
3
+ import typing_extensions
4
+
5
+
6
+ class V1FaceSwapCreateBodyStyle(typing_extensions.TypedDict):
7
+ """
8
+ Style of the face swap video.
9
+ """
10
+
11
+ version: typing_extensions.NotRequired[
12
+ typing_extensions.Literal["default", "v1", "v2"]
13
+ ]
14
+ """
15
+ * `v1` - May preserve skin detail and texture better, but weaker identity preservation.
16
+ * `v2` - Faster, sharper, better handling of hair and glasses. stronger identity preservation. (Recommended)
17
+ * `default` - Use the version we recommend, which will change over time. This is recommended unless you need a specific earlier version. This is the default behavior.
18
+ """
19
+
20
+
21
+ class _SerializerV1FaceSwapCreateBodyStyle(pydantic.BaseModel):
22
+ """
23
+ Serializer for V1FaceSwapCreateBodyStyle handling case conversions
24
+ and file omissions as dictated by the API
25
+ """
26
+
27
+ model_config = pydantic.ConfigDict(
28
+ populate_by_name=True,
29
+ )
30
+
31
+ version: typing.Optional[typing_extensions.Literal["default", "v1", "v2"]] = (
32
+ pydantic.Field(alias="version", default=None)
33
+ )
@@ -0,0 +1,56 @@
1
+ import pydantic
2
+ import typing
3
+ import typing_extensions
4
+
5
+ from .v1_face_swap_generate_body_assets_face_mappings_item import (
6
+ V1FaceSwapGenerateBodyAssetsFaceMappingsItem,
7
+ )
8
+
9
+
10
+ class V1FaceSwapGenerateBodyAssets(typing_extensions.TypedDict):
11
+ """
12
+ Provide the assets for face swap. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used
13
+ """
14
+
15
+ face_mappings: typing_extensions.NotRequired[
16
+ typing.List[V1FaceSwapGenerateBodyAssetsFaceMappingsItem]
17
+ ]
18
+ """
19
+ This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`.
20
+ """
21
+
22
+ face_swap_mode: typing_extensions.NotRequired[
23
+ typing_extensions.Literal["all-faces", "individual-faces"]
24
+ ]
25
+ """
26
+ The mode of face swap.
27
+ * `all-faces` - Swap all faces in the target image or video. `source_file_path` is required.
28
+ * `individual-faces` - Swap individual faces in the target image or video. `source_faces` is required.
29
+ """
30
+
31
+ image_file_path: typing_extensions.NotRequired[str]
32
+ """
33
+ The path of the input image with the face to be swapped. The value is required if `face_swap_mode` is `all-faces`. This value is either
34
+ - a direct URL to the image file
35
+ - a path to a local file
36
+
37
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
38
+ """
39
+
40
+ video_file_path: typing_extensions.NotRequired[str]
41
+ """
42
+ Required if `video_source` is `file`. This value is either
43
+ - a direct URL to the image file
44
+ - a path to a local file
45
+
46
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
47
+ """
48
+
49
+ video_source: typing_extensions.Required[
50
+ typing_extensions.Literal["file", "youtube"]
51
+ ]
52
+
53
+ youtube_url: typing_extensions.NotRequired[str]
54
+ """
55
+ Using a youtube video as the input source. This field is required if `video_source` is `youtube`
56
+ """
@@ -0,0 +1,25 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1FaceSwapGenerateBodyAssetsFaceMappingsItem(typing_extensions.TypedDict):
6
+ """
7
+ V1FaceSwapGenerateBodyAssetsFaceMappingsItem
8
+ """
9
+
10
+ new_face: typing_extensions.Required[str]
11
+ """
12
+ The face image that will be used to replace the face in the `original_face`. This value is either
13
+ - a direct URL to the image file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
18
+
19
+ original_face: typing_extensions.Required[str]
20
+ """
21
+ The face detected from the image in `target_file_path`. The file name is in the format of `<face_frame>-<face_index>.png`. This value is corresponds to the response in the [face detection API](https://docs.magichour.ai/api-reference/files/get-face-detection-details).
22
+
23
+ * The face_frame is the frame number of the face in the target image. For images, the frame number is always 0.
24
+ * The face_index is the index of the face in the target image, starting from 0 going left to right.
25
+ """
@@ -0,0 +1,47 @@
1
+ import pydantic
2
+ import typing
3
+ import typing_extensions
4
+
5
+ from .v1_face_swap_photo_generate_body_assets_face_mappings_item import (
6
+ V1FaceSwapPhotoGenerateBodyAssetsFaceMappingsItem,
7
+ )
8
+
9
+
10
+ class V1FaceSwapPhotoGenerateBodyAssets(typing_extensions.TypedDict):
11
+ """
12
+ Provide the assets for face swap photo
13
+ """
14
+
15
+ face_mappings: typing_extensions.NotRequired[
16
+ typing.List[V1FaceSwapPhotoGenerateBodyAssetsFaceMappingsItem]
17
+ ]
18
+ """
19
+ This is the array of face mappings used for multiple face swap. The value is required if `face_swap_mode` is `individual-faces`.
20
+ """
21
+
22
+ face_swap_mode: typing_extensions.NotRequired[
23
+ typing_extensions.Literal["all-faces", "individual-faces"]
24
+ ]
25
+ """
26
+ The mode of face swap.
27
+ * `all-faces` - Swap all faces in the target image or video. `source_file_path` is required.
28
+ * `individual-faces` - Swap individual faces in the target image or video. `source_faces` is required.
29
+ """
30
+
31
+ source_file_path: typing_extensions.NotRequired[str]
32
+ """
33
+ This is the image from which the face is extracted. The value is required if `face_swap_mode` is `all-faces`. This value is either
34
+ - a direct URL to the image file
35
+ - a path to a local file
36
+
37
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
38
+ """
39
+
40
+ target_file_path: typing_extensions.Required[str]
41
+ """
42
+ This is the image where the face from the source image will be placed. This value is either
43
+ - a direct URL to the image file
44
+ - a path to a local file
45
+
46
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
47
+ """
@@ -0,0 +1,25 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1FaceSwapPhotoGenerateBodyAssetsFaceMappingsItem(typing_extensions.TypedDict):
6
+ """
7
+ V1FaceSwapPhotoGenerateBodyAssetsFaceMappingsItem
8
+ """
9
+
10
+ new_face: typing_extensions.Required[str]
11
+ """
12
+ The face image that will be used to replace the face in the `original_face`. This value is either
13
+ - a direct URL to the image file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
18
+
19
+ original_face: typing_extensions.Required[str]
20
+ """
21
+ The face detected from the image in `target_file_path`. The file name is in the format of `<face_frame>-<face_index>.png`. This value is corresponds to the response in the [face detection API](https://docs.magichour.ai/api-reference/files/get-face-detection-details).
22
+
23
+ * The face_frame is the frame number of the face in the target image. For images, the frame number is always 0.
24
+ * The face_index is the index of the face in the target image, starting from 0 going left to right.
25
+ """
@@ -0,0 +1,27 @@
1
+ import pydantic
2
+ import typing
3
+ import typing_extensions
4
+
5
+
6
+ class V1ImageBackgroundRemoverGenerateBodyAssets(typing_extensions.TypedDict):
7
+ """
8
+ Provide the assets for background removal
9
+ """
10
+
11
+ background_image_file_path: typing_extensions.NotRequired[str]
12
+ """
13
+ The image used as the new background for the image_file_path. This image will be resized to match the image in image_file_path. Please make sure the resolution between the images are similar. This value is either
14
+ - a direct URL to the image file
15
+ - a path to a local file
16
+
17
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
18
+ """
19
+
20
+ image_file_path: typing_extensions.Required[str]
21
+ """
22
+ The image to remove the background. This value is either
23
+ - a direct URL to the image file
24
+ - a path to a local file
25
+
26
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
27
+ """
@@ -27,11 +27,15 @@ class V1ImageToVideoCreateBody(typing_extensions.TypedDict):
27
27
  The total duration of the output video in seconds.
28
28
  """
29
29
 
30
- height: typing_extensions.NotRequired[int]
30
+ height: typing_extensions.NotRequired[typing.Optional[int]]
31
31
  """
32
- This field does not affect the output video's resolution. The video's orientation will match that of the input image.
32
+ `height` is deprecated and no longer influences the output video's resolution.
33
33
 
34
- It is retained solely for backward compatibility and will be deprecated in the future.
34
+ Output resolution is determined by the **minimum** of:
35
+ - The resolution of the input video
36
+ - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
37
+
38
+ This field is retained only for backward compatibility and will be removed in a future release.
35
39
  """
36
40
 
37
41
  name: typing_extensions.NotRequired[str]
@@ -58,11 +62,15 @@ class V1ImageToVideoCreateBody(typing_extensions.TypedDict):
58
62
  Attributed used to dictate the style of the output
59
63
  """
60
64
 
61
- width: typing_extensions.NotRequired[int]
65
+ width: typing_extensions.NotRequired[typing.Optional[int]]
62
66
  """
63
- This field does not affect the output video's resolution. The video's orientation will match that of the input image.
67
+ `width` is deprecated and no longer influences the output video's resolution.
68
+
69
+ Output resolution is determined by the **minimum** of:
70
+ - The resolution of the input video
71
+ - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
64
72
 
65
- It is retained solely for backward compatibility and will be deprecated in the future.
73
+ This field is retained only for backward compatibility and will be removed in a future release.
66
74
  """
67
75
 
68
76
 
@@ -0,0 +1,17 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1ImageToVideoGenerateBodyAssets(typing_extensions.TypedDict):
6
+ """
7
+ Provide the assets for image-to-video.
8
+ """
9
+
10
+ image_file_path: typing_extensions.Required[str]
11
+ """
12
+ The path of the image file. This value is either
13
+ - a direct URL to the image file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
@@ -23,16 +23,15 @@ class V1LipSyncCreateBody(typing_extensions.TypedDict):
23
23
  The end time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.1, and more than the start_seconds.
24
24
  """
25
25
 
26
- height: typing_extensions.NotRequired[int]
26
+ height: typing_extensions.NotRequired[typing.Optional[int]]
27
27
  """
28
- Used to determine the dimensions of the output video.
29
-
30
- * If height is provided, width will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio.
31
- * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio.
28
+ `height` is deprecated and no longer influences the output video's resolution.
32
29
 
33
- Note: if the video's original resolution is less than the maximum, the video will not be resized.
30
+ Output resolution is determined by the **minimum** of:
31
+ - The resolution of the input video
32
+ - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
34
33
 
35
- See our [pricing page](https://magichour.ai/pricing) for more details.
34
+ This field is retained only for backward compatibility and will be removed in a future release.
36
35
  """
37
36
 
38
37
  max_fps_limit: typing_extensions.NotRequired[float]
@@ -50,16 +49,15 @@ class V1LipSyncCreateBody(typing_extensions.TypedDict):
50
49
  The start time of the input video in seconds. This value is used to trim the input video. The value must be greater than 0.
51
50
  """
52
51
 
53
- width: typing_extensions.NotRequired[int]
52
+ width: typing_extensions.NotRequired[typing.Optional[int]]
54
53
  """
55
- Used to determine the dimensions of the output video.
56
-
57
- * If width is provided, height will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio.
58
- * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio.
54
+ `width` is deprecated and no longer influences the output video's resolution.
59
55
 
60
- Note: if the video's original resolution is less than the maximum, the video will not be resized.
56
+ Output resolution is determined by the **minimum** of:
57
+ - The resolution of the input video
58
+ - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
61
59
 
62
- See our [pricing page](https://magichour.ai/pricing) for more details.
60
+ This field is retained only for backward compatibility and will be removed in a future release.
63
61
  """
64
62
 
65
63
 
@@ -0,0 +1,36 @@
1
+ import pydantic
2
+ import typing
3
+ import typing_extensions
4
+
5
+
6
+ class V1LipSyncGenerateBodyAssets(typing_extensions.TypedDict):
7
+ """
8
+ Provide the assets for lip-sync. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used
9
+ """
10
+
11
+ audio_file_path: typing_extensions.Required[str]
12
+ """
13
+ The path of the audio file. This value is either
14
+ - a direct URL to the video file
15
+ - a path to a local file
16
+
17
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
18
+ """
19
+
20
+ video_file_path: typing_extensions.NotRequired[str]
21
+ """
22
+ Required if `video_source` is `file`. This value is either
23
+ - a direct URL to the video file
24
+ - a path to a local file
25
+
26
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
27
+ """
28
+
29
+ video_source: typing_extensions.Required[
30
+ typing_extensions.Literal["file", "youtube"]
31
+ ]
32
+
33
+ youtube_url: typing_extensions.NotRequired[str]
34
+ """
35
+ Using a youtube video as the input source. This field is required if `video_source` is `youtube`
36
+ """
@@ -0,0 +1,17 @@
1
+ import pydantic
2
+ import typing_extensions
3
+
4
+
5
+ class V1PhotoColorizerGenerateBodyAssets(typing_extensions.TypedDict):
6
+ """
7
+ Provide the assets for photo colorization
8
+ """
9
+
10
+ image_file_path: typing_extensions.Required[str]
11
+ """
12
+ The image used to generate the colorized image. This value is either
13
+ - a direct URL to the image file
14
+ - a path to a local file
15
+
16
+ Note: if the path begins with `api-assets`, it will be assumed to already be uploaded to Magic Hour's storage, and will not be uploaded again.
17
+ """
@@ -36,16 +36,15 @@ class V1VideoToVideoCreateBody(typing_extensions.TypedDict):
36
36
  * `HALF` - the result video will have half the FPS as the input video
37
37
  """
38
38
 
39
- height: typing_extensions.NotRequired[int]
39
+ height: typing_extensions.NotRequired[typing.Optional[int]]
40
40
  """
41
- Used to determine the dimensions of the output video.
42
-
43
- * If height is provided, width will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio.
44
- * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio.
41
+ `height` is deprecated and no longer influences the output video's resolution.
45
42
 
46
- Note: if the video's original resolution is less than the maximum, the video will not be resized.
43
+ Output resolution is determined by the **minimum** of:
44
+ - The resolution of the input video
45
+ - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
47
46
 
48
- See our [pricing page](https://magichour.ai/pricing) for more details.
47
+ This field is retained only for backward compatibility and will be removed in a future release.
49
48
  """
50
49
 
51
50
  name: typing_extensions.NotRequired[str]
@@ -60,16 +59,15 @@ class V1VideoToVideoCreateBody(typing_extensions.TypedDict):
60
59
 
61
60
  style: typing_extensions.Required[V1VideoToVideoCreateBodyStyle]
62
61
 
63
- width: typing_extensions.NotRequired[int]
62
+ width: typing_extensions.NotRequired[typing.Optional[int]]
64
63
  """
65
- Used to determine the dimensions of the output video.
66
-
67
- * If width is provided, height will also be required. The larger value between width and height will be used to determine the maximum output resolution while maintaining the original aspect ratio.
68
- * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio.
64
+ `width` is deprecated and no longer influences the output video's resolution.
69
65
 
70
- Note: if the video's original resolution is less than the maximum, the video will not be resized.
66
+ Output resolution is determined by the **minimum** of:
67
+ - The resolution of the input video
68
+ - The maximum resolution allowed by your subscription tier. See our [pricing page](https://magichour.ai/pricing) for more details.
71
69
 
72
- See our [pricing page](https://magichour.ai/pricing) for more details.
70
+ This field is retained only for backward compatibility and will be removed in a future release.
73
71
  """
74
72
 
75
73