magic_hour 0.9.5__py3-none-any.whl → 0.44.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.
Files changed (264) hide show
  1. magic_hour/README.md +34 -0
  2. magic_hour/__init__.py +1 -1
  3. magic_hour/client.py +8 -17
  4. magic_hour/environment.py +13 -1
  5. magic_hour/helpers/__init__.py +4 -0
  6. magic_hour/helpers/download.py +77 -0
  7. magic_hour/helpers/logger.py +8 -0
  8. magic_hour/resources/v1/README.md +32 -0
  9. magic_hour/resources/v1/ai_clothes_changer/README.md +94 -5
  10. magic_hour/resources/v1/ai_clothes_changer/client.py +161 -16
  11. magic_hour/resources/v1/ai_face_editor/README.md +195 -0
  12. magic_hour/resources/v1/ai_face_editor/__init__.py +4 -0
  13. magic_hour/resources/v1/ai_face_editor/client.py +324 -0
  14. magic_hour/resources/v1/ai_gif_generator/README.md +116 -0
  15. magic_hour/resources/v1/ai_gif_generator/__init__.py +4 -0
  16. magic_hour/resources/v1/ai_gif_generator/client.py +257 -0
  17. magic_hour/resources/v1/ai_headshot_generator/README.md +81 -3
  18. magic_hour/resources/v1/ai_headshot_generator/client.py +167 -18
  19. magic_hour/resources/v1/ai_image_editor/README.md +125 -0
  20. magic_hour/resources/v1/ai_image_editor/__init__.py +4 -0
  21. magic_hour/resources/v1/ai_image_editor/client.py +290 -0
  22. magic_hour/resources/v1/ai_image_generator/README.md +99 -5
  23. magic_hour/resources/v1/ai_image_generator/client.py +170 -24
  24. magic_hour/resources/v1/ai_image_upscaler/README.md +89 -3
  25. magic_hour/resources/v1/ai_image_upscaler/client.py +173 -20
  26. magic_hour/resources/v1/ai_meme_generator/README.md +129 -0
  27. magic_hour/resources/v1/ai_meme_generator/__init__.py +4 -0
  28. magic_hour/resources/v1/ai_meme_generator/client.py +253 -0
  29. magic_hour/resources/v1/ai_photo_editor/README.md +119 -4
  30. magic_hour/resources/v1/ai_photo_editor/client.py +199 -18
  31. magic_hour/resources/v1/ai_qr_code_generator/README.md +84 -3
  32. magic_hour/resources/v1/ai_qr_code_generator/client.py +140 -18
  33. magic_hour/resources/v1/ai_talking_photo/README.md +137 -0
  34. magic_hour/resources/v1/ai_talking_photo/__init__.py +4 -0
  35. magic_hour/resources/v1/ai_talking_photo/client.py +326 -0
  36. magic_hour/resources/v1/ai_voice_cloner/README.md +62 -0
  37. magic_hour/resources/v1/ai_voice_cloner/__init__.py +4 -0
  38. magic_hour/resources/v1/ai_voice_cloner/client.py +272 -0
  39. magic_hour/resources/v1/ai_voice_generator/README.md +112 -0
  40. magic_hour/resources/v1/ai_voice_generator/__init__.py +4 -0
  41. magic_hour/resources/v1/ai_voice_generator/client.py +241 -0
  42. magic_hour/resources/v1/animation/README.md +128 -6
  43. magic_hour/resources/v1/animation/client.py +247 -22
  44. magic_hour/resources/v1/audio_projects/README.md +135 -0
  45. magic_hour/resources/v1/audio_projects/__init__.py +12 -0
  46. magic_hour/resources/v1/audio_projects/client.py +310 -0
  47. magic_hour/resources/v1/audio_projects/client_test.py +520 -0
  48. magic_hour/resources/v1/auto_subtitle_generator/README.md +128 -0
  49. magic_hour/resources/v1/auto_subtitle_generator/__init__.py +4 -0
  50. magic_hour/resources/v1/auto_subtitle_generator/client.py +346 -0
  51. magic_hour/resources/v1/client.py +75 -1
  52. magic_hour/resources/v1/face_detection/README.md +157 -0
  53. magic_hour/resources/v1/face_detection/__init__.py +12 -0
  54. magic_hour/resources/v1/face_detection/client.py +380 -0
  55. magic_hour/resources/v1/face_swap/README.md +137 -9
  56. magic_hour/resources/v1/face_swap/client.py +329 -38
  57. magic_hour/resources/v1/face_swap_photo/README.md +118 -3
  58. magic_hour/resources/v1/face_swap_photo/client.py +199 -14
  59. magic_hour/resources/v1/files/README.md +39 -0
  60. magic_hour/resources/v1/files/client.py +351 -1
  61. magic_hour/resources/v1/files/client_test.py +414 -0
  62. magic_hour/resources/v1/files/upload_urls/README.md +38 -17
  63. magic_hour/resources/v1/files/upload_urls/client.py +38 -34
  64. magic_hour/resources/v1/image_background_remover/README.md +96 -5
  65. magic_hour/resources/v1/image_background_remover/client.py +151 -16
  66. magic_hour/resources/v1/image_projects/README.md +82 -10
  67. magic_hour/resources/v1/image_projects/__init__.py +10 -2
  68. magic_hour/resources/v1/image_projects/client.py +154 -16
  69. magic_hour/resources/v1/image_projects/client_test.py +527 -0
  70. magic_hour/resources/v1/image_to_video/README.md +96 -11
  71. magic_hour/resources/v1/image_to_video/client.py +282 -38
  72. magic_hour/resources/v1/lip_sync/README.md +112 -9
  73. magic_hour/resources/v1/lip_sync/client.py +288 -34
  74. magic_hour/resources/v1/photo_colorizer/README.md +107 -0
  75. magic_hour/resources/v1/photo_colorizer/__init__.py +4 -0
  76. magic_hour/resources/v1/photo_colorizer/client.py +248 -0
  77. magic_hour/resources/v1/text_to_video/README.md +96 -7
  78. magic_hour/resources/v1/text_to_video/client.py +204 -18
  79. magic_hour/resources/v1/video_projects/README.md +81 -9
  80. magic_hour/resources/v1/video_projects/__init__.py +10 -2
  81. magic_hour/resources/v1/video_projects/client.py +151 -14
  82. magic_hour/resources/v1/video_projects/client_test.py +527 -0
  83. magic_hour/resources/v1/video_to_video/README.md +119 -15
  84. magic_hour/resources/v1/video_to_video/client.py +299 -46
  85. magic_hour/types/models/__init__.py +92 -56
  86. magic_hour/types/models/v1_ai_clothes_changer_create_response.py +33 -0
  87. magic_hour/types/models/v1_ai_face_editor_create_response.py +33 -0
  88. magic_hour/types/models/v1_ai_gif_generator_create_response.py +33 -0
  89. magic_hour/types/models/v1_ai_headshot_generator_create_response.py +33 -0
  90. magic_hour/types/models/v1_ai_image_editor_create_response.py +33 -0
  91. magic_hour/types/models/v1_ai_image_generator_create_response.py +33 -0
  92. magic_hour/types/models/v1_ai_image_upscaler_create_response.py +33 -0
  93. magic_hour/types/models/v1_ai_meme_generator_create_response.py +33 -0
  94. magic_hour/types/models/v1_ai_photo_editor_create_response.py +33 -0
  95. magic_hour/types/models/v1_ai_qr_code_generator_create_response.py +33 -0
  96. magic_hour/types/models/v1_ai_talking_photo_create_response.py +35 -0
  97. magic_hour/types/models/v1_ai_voice_cloner_create_response.py +27 -0
  98. magic_hour/types/models/v1_ai_voice_generator_create_response.py +27 -0
  99. magic_hour/types/models/v1_animation_create_response.py +35 -0
  100. magic_hour/types/models/v1_audio_projects_get_response.py +72 -0
  101. magic_hour/types/models/v1_audio_projects_get_response_downloads_item.py +19 -0
  102. magic_hour/types/models/{get_v1_image_projects_id_response_error.py → v1_audio_projects_get_response_error.py} +2 -2
  103. magic_hour/types/models/v1_auto_subtitle_generator_create_response.py +35 -0
  104. magic_hour/types/models/v1_face_detection_create_response.py +25 -0
  105. magic_hour/types/models/v1_face_detection_get_response.py +45 -0
  106. magic_hour/types/models/v1_face_detection_get_response_faces_item.py +25 -0
  107. magic_hour/types/models/v1_face_swap_create_response.py +35 -0
  108. magic_hour/types/models/v1_face_swap_photo_create_response.py +33 -0
  109. magic_hour/types/models/v1_files_upload_urls_create_response.py +24 -0
  110. magic_hour/types/models/{post_v1_files_upload_urls_response_items_item.py → v1_files_upload_urls_create_response_items_item.py} +2 -2
  111. magic_hour/types/models/v1_image_background_remover_create_response.py +33 -0
  112. magic_hour/types/models/{get_v1_image_projects_id_response.py → v1_image_projects_get_response.py} +20 -18
  113. magic_hour/types/models/{get_v1_video_projects_id_response_downloads_item.py → v1_image_projects_get_response_downloads_item.py} +1 -1
  114. magic_hour/types/models/{get_v1_video_projects_id_response_error.py → v1_image_projects_get_response_error.py} +2 -2
  115. magic_hour/types/models/v1_image_to_video_create_response.py +35 -0
  116. magic_hour/types/models/v1_lip_sync_create_response.py +35 -0
  117. magic_hour/types/models/v1_photo_colorizer_create_response.py +33 -0
  118. magic_hour/types/models/v1_text_to_video_create_response.py +35 -0
  119. magic_hour/types/models/{get_v1_video_projects_id_response.py → v1_video_projects_get_response.py} +26 -23
  120. magic_hour/types/models/{get_v1_video_projects_id_response_download.py → v1_video_projects_get_response_download.py} +1 -1
  121. magic_hour/types/models/{get_v1_image_projects_id_response_downloads_item.py → v1_video_projects_get_response_downloads_item.py} +1 -1
  122. magic_hour/types/models/v1_video_projects_get_response_error.py +25 -0
  123. magic_hour/types/models/v1_video_to_video_create_response.py +35 -0
  124. magic_hour/types/params/__init__.py +422 -176
  125. magic_hour/types/params/v1_ai_clothes_changer_create_body.py +40 -0
  126. magic_hour/types/params/v1_ai_clothes_changer_create_body_assets.py +58 -0
  127. magic_hour/types/params/v1_ai_clothes_changer_generate_body_assets.py +33 -0
  128. magic_hour/types/params/v1_ai_face_editor_create_body.py +52 -0
  129. magic_hour/types/params/v1_ai_face_editor_create_body_assets.py +33 -0
  130. magic_hour/types/params/v1_ai_face_editor_create_body_style.py +137 -0
  131. magic_hour/types/params/v1_ai_face_editor_generate_body_assets.py +17 -0
  132. magic_hour/types/params/v1_ai_gif_generator_create_body.py +47 -0
  133. magic_hour/types/params/{post_v1_ai_image_generator_body_style.py → v1_ai_gif_generator_create_body_style.py} +5 -5
  134. magic_hour/types/params/v1_ai_headshot_generator_create_body.py +49 -0
  135. magic_hour/types/params/v1_ai_headshot_generator_create_body_assets.py +33 -0
  136. magic_hour/types/params/v1_ai_headshot_generator_create_body_style.py +27 -0
  137. magic_hour/types/params/v1_ai_headshot_generator_generate_body_assets.py +17 -0
  138. magic_hour/types/params/v1_ai_image_editor_create_body.py +49 -0
  139. magic_hour/types/params/v1_ai_image_editor_create_body_assets.py +47 -0
  140. magic_hour/types/params/v1_ai_image_editor_create_body_style.py +41 -0
  141. magic_hour/types/params/v1_ai_image_editor_generate_body_assets.py +28 -0
  142. magic_hour/types/params/{post_v1_ai_image_generator_body.py → v1_ai_image_generator_create_body.py} +17 -11
  143. magic_hour/types/params/v1_ai_image_generator_create_body_style.py +127 -0
  144. magic_hour/types/params/v1_ai_image_upscaler_create_body.py +59 -0
  145. magic_hour/types/params/v1_ai_image_upscaler_create_body_assets.py +33 -0
  146. magic_hour/types/params/{post_v1_ai_image_upscaler_body_style.py → v1_ai_image_upscaler_create_body_style.py} +4 -4
  147. magic_hour/types/params/v1_ai_image_upscaler_generate_body_assets.py +17 -0
  148. magic_hour/types/params/v1_ai_meme_generator_create_body.py +37 -0
  149. magic_hour/types/params/v1_ai_meme_generator_create_body_style.py +73 -0
  150. magic_hour/types/params/{post_v1_ai_photo_editor_body.py → v1_ai_photo_editor_create_body.py} +15 -15
  151. magic_hour/types/params/v1_ai_photo_editor_create_body_assets.py +33 -0
  152. magic_hour/types/params/{post_v1_ai_photo_editor_body_style.py → v1_ai_photo_editor_create_body_style.py} +20 -4
  153. magic_hour/types/params/v1_ai_photo_editor_generate_body_assets.py +17 -0
  154. magic_hour/types/params/v1_ai_qr_code_generator_create_body.py +45 -0
  155. magic_hour/types/params/{post_v1_ai_qr_code_generator_body_style.py → v1_ai_qr_code_generator_create_body_style.py} +4 -4
  156. magic_hour/types/params/v1_ai_talking_photo_create_body.py +68 -0
  157. magic_hour/types/params/v1_ai_talking_photo_create_body_assets.py +46 -0
  158. magic_hour/types/params/v1_ai_talking_photo_create_body_style.py +44 -0
  159. magic_hour/types/params/v1_ai_talking_photo_generate_body_assets.py +26 -0
  160. magic_hour/types/params/v1_ai_voice_cloner_create_body.py +49 -0
  161. magic_hour/types/params/v1_ai_voice_cloner_create_body_assets.py +33 -0
  162. magic_hour/types/params/v1_ai_voice_cloner_create_body_style.py +28 -0
  163. magic_hour/types/params/v1_ai_voice_cloner_generate_body_assets.py +28 -0
  164. magic_hour/types/params/v1_ai_voice_generator_create_body.py +40 -0
  165. magic_hour/types/params/v1_ai_voice_generator_create_body_style.py +440 -0
  166. magic_hour/types/params/{post_v1_animation_body.py → v1_animation_create_body.py} +16 -16
  167. magic_hour/types/params/{post_v1_animation_body_assets.py → v1_animation_create_body_assets.py} +15 -5
  168. magic_hour/types/params/{post_v1_animation_body_style.py → v1_animation_create_body_style.py} +13 -10
  169. magic_hour/types/params/v1_animation_generate_body_assets.py +39 -0
  170. magic_hour/types/params/v1_auto_subtitle_generator_create_body.py +78 -0
  171. magic_hour/types/params/v1_auto_subtitle_generator_create_body_assets.py +33 -0
  172. magic_hour/types/params/v1_auto_subtitle_generator_create_body_style.py +56 -0
  173. magic_hour/types/params/v1_auto_subtitle_generator_create_body_style_custom_config.py +86 -0
  174. magic_hour/types/params/v1_auto_subtitle_generator_generate_body_assets.py +17 -0
  175. magic_hour/types/params/v1_face_detection_create_body.py +44 -0
  176. magic_hour/types/params/v1_face_detection_create_body_assets.py +33 -0
  177. magic_hour/types/params/v1_face_detection_generate_body_assets.py +17 -0
  178. magic_hour/types/params/v1_face_swap_create_body.py +92 -0
  179. magic_hour/types/params/v1_face_swap_create_body_assets.py +91 -0
  180. magic_hour/types/params/v1_face_swap_create_body_assets_face_mappings_item.py +44 -0
  181. magic_hour/types/params/v1_face_swap_create_body_style.py +33 -0
  182. magic_hour/types/params/v1_face_swap_generate_body_assets.py +56 -0
  183. magic_hour/types/params/v1_face_swap_generate_body_assets_face_mappings_item.py +25 -0
  184. magic_hour/types/params/v1_face_swap_photo_create_body.py +40 -0
  185. magic_hour/types/params/v1_face_swap_photo_create_body_assets.py +76 -0
  186. magic_hour/types/params/v1_face_swap_photo_create_body_assets_face_mappings_item.py +44 -0
  187. magic_hour/types/params/v1_face_swap_photo_generate_body_assets.py +47 -0
  188. magic_hour/types/params/v1_face_swap_photo_generate_body_assets_face_mappings_item.py +25 -0
  189. magic_hour/types/params/v1_files_upload_urls_create_body.py +36 -0
  190. magic_hour/types/params/v1_files_upload_urls_create_body_items_item.py +38 -0
  191. magic_hour/types/params/v1_image_background_remover_create_body.py +40 -0
  192. magic_hour/types/params/v1_image_background_remover_create_body_assets.py +49 -0
  193. magic_hour/types/params/v1_image_background_remover_generate_body_assets.py +27 -0
  194. magic_hour/types/params/v1_image_to_video_create_body.py +101 -0
  195. magic_hour/types/params/v1_image_to_video_create_body_assets.py +33 -0
  196. magic_hour/types/params/v1_image_to_video_create_body_style.py +53 -0
  197. magic_hour/types/params/v1_image_to_video_generate_body_assets.py +17 -0
  198. magic_hour/types/params/v1_lip_sync_create_body.py +100 -0
  199. magic_hour/types/params/{post_v1_lip_sync_body_assets.py → v1_lip_sync_create_body_assets.py} +15 -5
  200. magic_hour/types/params/v1_lip_sync_create_body_style.py +37 -0
  201. magic_hour/types/params/v1_lip_sync_generate_body_assets.py +36 -0
  202. magic_hour/types/params/v1_photo_colorizer_create_body.py +40 -0
  203. magic_hour/types/params/v1_photo_colorizer_create_body_assets.py +33 -0
  204. magic_hour/types/params/v1_photo_colorizer_generate_body_assets.py +17 -0
  205. magic_hour/types/params/v1_text_to_video_create_body.py +78 -0
  206. magic_hour/types/params/v1_text_to_video_create_body_style.py +43 -0
  207. magic_hour/types/params/v1_video_to_video_create_body.py +101 -0
  208. magic_hour/types/params/{post_v1_video_to_video_body_assets.py → v1_video_to_video_create_body_assets.py} +9 -4
  209. magic_hour/types/params/{post_v1_video_to_video_body_style.py → v1_video_to_video_create_body_style.py} +68 -26
  210. magic_hour/types/params/v1_video_to_video_generate_body_assets.py +27 -0
  211. magic_hour-0.44.0.dist-info/METADATA +328 -0
  212. magic_hour-0.44.0.dist-info/RECORD +231 -0
  213. magic_hour/core/__init__.py +0 -52
  214. magic_hour/core/api_error.py +0 -56
  215. magic_hour/core/auth.py +0 -314
  216. magic_hour/core/base_client.py +0 -618
  217. magic_hour/core/binary_response.py +0 -23
  218. magic_hour/core/query.py +0 -106
  219. magic_hour/core/request.py +0 -156
  220. magic_hour/core/response.py +0 -293
  221. magic_hour/core/type_utils.py +0 -28
  222. magic_hour/core/utils.py +0 -55
  223. magic_hour/types/models/post_v1_ai_clothes_changer_response.py +0 -25
  224. magic_hour/types/models/post_v1_ai_headshot_generator_response.py +0 -25
  225. magic_hour/types/models/post_v1_ai_image_generator_response.py +0 -25
  226. magic_hour/types/models/post_v1_ai_image_upscaler_response.py +0 -25
  227. magic_hour/types/models/post_v1_ai_photo_editor_response.py +0 -25
  228. magic_hour/types/models/post_v1_ai_qr_code_generator_response.py +0 -25
  229. magic_hour/types/models/post_v1_animation_response.py +0 -25
  230. magic_hour/types/models/post_v1_face_swap_photo_response.py +0 -25
  231. magic_hour/types/models/post_v1_face_swap_response.py +0 -25
  232. magic_hour/types/models/post_v1_files_upload_urls_response.py +0 -21
  233. magic_hour/types/models/post_v1_image_background_remover_response.py +0 -25
  234. magic_hour/types/models/post_v1_image_to_video_response.py +0 -25
  235. magic_hour/types/models/post_v1_lip_sync_response.py +0 -25
  236. magic_hour/types/models/post_v1_text_to_video_response.py +0 -25
  237. magic_hour/types/models/post_v1_video_to_video_response.py +0 -25
  238. magic_hour/types/params/post_v1_ai_clothes_changer_body.py +0 -40
  239. magic_hour/types/params/post_v1_ai_clothes_changer_body_assets.py +0 -45
  240. magic_hour/types/params/post_v1_ai_headshot_generator_body.py +0 -40
  241. magic_hour/types/params/post_v1_ai_headshot_generator_body_assets.py +0 -28
  242. magic_hour/types/params/post_v1_ai_image_upscaler_body.py +0 -57
  243. magic_hour/types/params/post_v1_ai_image_upscaler_body_assets.py +0 -28
  244. magic_hour/types/params/post_v1_ai_photo_editor_body_assets.py +0 -28
  245. magic_hour/types/params/post_v1_ai_qr_code_generator_body.py +0 -45
  246. magic_hour/types/params/post_v1_face_swap_body.py +0 -72
  247. magic_hour/types/params/post_v1_face_swap_body_assets.py +0 -52
  248. magic_hour/types/params/post_v1_face_swap_photo_body.py +0 -40
  249. magic_hour/types/params/post_v1_face_swap_photo_body_assets.py +0 -36
  250. magic_hour/types/params/post_v1_files_upload_urls_body.py +0 -31
  251. magic_hour/types/params/post_v1_files_upload_urls_body_items_item.py +0 -38
  252. magic_hour/types/params/post_v1_image_background_remover_body.py +0 -40
  253. magic_hour/types/params/post_v1_image_background_remover_body_assets.py +0 -28
  254. magic_hour/types/params/post_v1_image_to_video_body.py +0 -73
  255. magic_hour/types/params/post_v1_image_to_video_body_assets.py +0 -28
  256. magic_hour/types/params/post_v1_image_to_video_body_style.py +0 -37
  257. magic_hour/types/params/post_v1_lip_sync_body.py +0 -80
  258. magic_hour/types/params/post_v1_text_to_video_body.py +0 -57
  259. magic_hour/types/params/post_v1_text_to_video_body_style.py +0 -28
  260. magic_hour/types/params/post_v1_video_to_video_body.py +0 -93
  261. magic_hour-0.9.5.dist-info/METADATA +0 -133
  262. magic_hour-0.9.5.dist-info/RECORD +0 -132
  263. {magic_hour-0.9.5.dist-info → magic_hour-0.44.0.dist-info}/LICENSE +0 -0
  264. {magic_hour-0.9.5.dist-info → magic_hour-0.44.0.dist-info}/WHEEL +0 -0
@@ -1,7 +1,13 @@
1
1
  import typing
2
2
  import typing_extensions
3
3
 
4
- from magic_hour.core import (
4
+ from magic_hour.helpers.logger import get_sdk_logger
5
+ from magic_hour.resources.v1.video_projects.client import (
6
+ AsyncVideoProjectsClient,
7
+ VideoProjectsClient,
8
+ )
9
+ from magic_hour.types import models, params
10
+ from make_api_request import (
5
11
  AsyncBaseClient,
6
12
  RequestOptions,
7
13
  SyncBaseClient,
@@ -9,39 +15,128 @@ from magic_hour.core import (
9
15
  to_encodable,
10
16
  type_utils,
11
17
  )
12
- from magic_hour.types import models, params
18
+
19
+
20
+ logger = get_sdk_logger(__name__)
13
21
 
14
22
 
15
23
  class TextToVideoClient:
16
24
  def __init__(self, *, base_client: SyncBaseClient):
17
25
  self._base_client = base_client
18
26
 
27
+ def generate(
28
+ self,
29
+ *,
30
+ end_seconds: float,
31
+ orientation: typing_extensions.Literal["landscape", "portrait", "square"],
32
+ style: params.V1TextToVideoCreateBodyStyle,
33
+ name: typing.Union[
34
+ typing.Optional[str], type_utils.NotGiven
35
+ ] = type_utils.NOT_GIVEN,
36
+ resolution: typing.Union[
37
+ typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
38
+ type_utils.NotGiven,
39
+ ] = type_utils.NOT_GIVEN,
40
+ wait_for_completion: bool = True,
41
+ download_outputs: bool = True,
42
+ download_directory: typing.Optional[str] = None,
43
+ request_options: typing.Optional[RequestOptions] = None,
44
+ ):
45
+ """
46
+ Generate text-to-video (alias for create with additional functionality).
47
+
48
+ Create a Text To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
49
+
50
+ Args:
51
+ name: The name of video. This value is mainly used for your own identification of the video.
52
+ resolution: Controls the output video resolution. Defaults to `720p` if not specified.
53
+ end_seconds: The total duration of the output video in seconds.
54
+ orientation: Determines the orientation of the output video
55
+ style: V1TextToVideoCreateBodyStyle
56
+ wait_for_completion: Whether to wait for the video project to complete
57
+ download_outputs: Whether to download the outputs
58
+ download_directory: The directory to download the outputs to. If not provided, the outputs will be downloaded to the current working directory
59
+ request_options: Additional options to customize the HTTP request
60
+
61
+ Returns:
62
+ V1VideoProjectsGetResponseWithDownloads: The response from the Text-to-Video API with the downloaded paths if `download_outputs` is True.
63
+
64
+ Examples:
65
+ ```py
66
+ response = client.v1.text_to_video.generate(
67
+ end_seconds=5.0,
68
+ orientation="landscape",
69
+ style={"prompt": "a dog running through a meadow"},
70
+ resolution="720p",
71
+ wait_for_completion=True,
72
+ download_outputs=True,
73
+ download_directory="outputs/",
74
+ )
75
+ ```
76
+ """
77
+
78
+ create_response = self.create(
79
+ end_seconds=end_seconds,
80
+ orientation=orientation,
81
+ style=style,
82
+ name=name,
83
+ resolution=resolution,
84
+ request_options=request_options,
85
+ )
86
+ logger.info(f"Text-to-Video response: {create_response}")
87
+
88
+ video_projects_client = VideoProjectsClient(base_client=self._base_client)
89
+ response = video_projects_client.check_result(
90
+ id=create_response.id,
91
+ wait_for_completion=wait_for_completion,
92
+ download_outputs=download_outputs,
93
+ download_directory=download_directory,
94
+ )
95
+
96
+ return response
97
+
19
98
  def create(
20
99
  self,
21
100
  *,
22
101
  end_seconds: float,
23
102
  orientation: typing_extensions.Literal["landscape", "portrait", "square"],
24
- style: params.PostV1TextToVideoBodyStyle,
103
+ style: params.V1TextToVideoCreateBodyStyle,
25
104
  name: typing.Union[
26
105
  typing.Optional[str], type_utils.NotGiven
27
106
  ] = type_utils.NOT_GIVEN,
107
+ resolution: typing.Union[
108
+ typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
109
+ type_utils.NotGiven,
110
+ ] = type_utils.NOT_GIVEN,
28
111
  request_options: typing.Optional[RequestOptions] = None,
29
- ) -> models.PostV1TextToVideoResponse:
112
+ ) -> models.V1TextToVideoCreateResponse:
30
113
  """
31
114
  Text-to-Video
32
115
 
33
116
  Create a Text To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
34
117
 
35
- Get more information about this mode at our [product page](/products/text-to-video).
118
+ Get more information about this mode at our [product page](https://magichour.ai/products/text-to-video).
36
119
 
37
120
 
38
121
  POST /v1/text-to-video
39
122
 
40
123
  Args:
41
- name: The name of video
124
+ name: The name of video. This value is mainly used for your own identification of the video.
125
+ resolution: Controls the output video resolution. Defaults to `720p` if not specified.
126
+
127
+ 480p and 720p are available on Creator, Pro, or Business tiers. However, 1080p require Pro or Business tier.
128
+
129
+ **Options:**
130
+ - `480p` - Supports only 5 or 10 second videos. Output: 24fps. Cost: 120 credits per 5 seconds.
131
+ - `720p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 300 credits per 5 seconds.
132
+ - `1080p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 600 credits per 5 seconds.
42
133
  end_seconds: The total duration of the output video in seconds.
134
+
135
+ The value must be greater than or equal to 5 seconds and less than or equal to 60 seconds.
136
+
137
+ Note: For 480p resolution, the value must be either 5 or 10.
43
138
  orientation: Determines the orientation of the output video
44
- style: PostV1TextToVideoBodyStyle
139
+ style: V1TextToVideoCreateBodyStyle
45
140
  request_options: Additional options to customize the HTTP request
46
141
 
47
142
  Returns:
@@ -56,26 +151,28 @@ class TextToVideoClient:
56
151
  client.v1.text_to_video.create(
57
152
  end_seconds=5.0,
58
153
  orientation="landscape",
59
- style={"prompt": "string"},
154
+ style={"prompt": "a dog running"},
60
155
  name="Text To Video video",
156
+ resolution="720p",
61
157
  )
62
158
  ```
63
159
  """
64
160
  _json = to_encodable(
65
161
  item={
66
162
  "name": name,
163
+ "resolution": resolution,
67
164
  "end_seconds": end_seconds,
68
165
  "orientation": orientation,
69
166
  "style": style,
70
167
  },
71
- dump_with=params._SerializerPostV1TextToVideoBody,
168
+ dump_with=params._SerializerV1TextToVideoCreateBody,
72
169
  )
73
170
  return self._base_client.request(
74
171
  method="POST",
75
172
  path="/v1/text-to-video",
76
173
  auth_names=["bearerAuth"],
77
174
  json=_json,
78
- cast_to=models.PostV1TextToVideoResponse,
175
+ cast_to=models.V1TextToVideoCreateResponse,
79
176
  request_options=request_options or default_request_options(),
80
177
  )
81
178
 
@@ -84,32 +181,119 @@ class AsyncTextToVideoClient:
84
181
  def __init__(self, *, base_client: AsyncBaseClient):
85
182
  self._base_client = base_client
86
183
 
184
+ async def generate(
185
+ self,
186
+ *,
187
+ end_seconds: float,
188
+ orientation: typing_extensions.Literal["landscape", "portrait", "square"],
189
+ style: params.V1TextToVideoCreateBodyStyle,
190
+ name: typing.Union[
191
+ typing.Optional[str], type_utils.NotGiven
192
+ ] = type_utils.NOT_GIVEN,
193
+ resolution: typing.Union[
194
+ typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
195
+ type_utils.NotGiven,
196
+ ] = type_utils.NOT_GIVEN,
197
+ wait_for_completion: bool = True,
198
+ download_outputs: bool = True,
199
+ download_directory: typing.Optional[str] = None,
200
+ request_options: typing.Optional[RequestOptions] = None,
201
+ ):
202
+ """
203
+ Generate text-to-video (alias for create with additional functionality).
204
+
205
+ Create a Text To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
206
+
207
+ Args:
208
+ name: The name of video. This value is mainly used for your own identification of the video.
209
+ resolution: Controls the output video resolution. Defaults to `720p` if not specified.
210
+ end_seconds: The total duration of the output video in seconds.
211
+ orientation: Determines the orientation of the output video
212
+ style: V1TextToVideoCreateBodyStyle
213
+ wait_for_completion: Whether to wait for the video project to complete
214
+ download_outputs: Whether to download the outputs
215
+ download_directory: The directory to download the outputs to. If not provided, the outputs will be downloaded to the current working directory
216
+ request_options: Additional options to customize the HTTP request
217
+
218
+ Returns:
219
+ V1VideoProjectsGetResponseWithDownloads: The response from the Text-to-Video API with the downloaded paths if `download_outputs` is True.
220
+
221
+ Examples:
222
+ ```py
223
+ response = await client.v1.text_to_video.generate(
224
+ end_seconds=5.0,
225
+ orientation="landscape",
226
+ style={"prompt": "a dog running through a meadow"},
227
+ resolution="720p",
228
+ wait_for_completion=True,
229
+ download_outputs=True,
230
+ download_directory="outputs/",
231
+ )
232
+ ```
233
+ """
234
+
235
+ create_response = await self.create(
236
+ end_seconds=end_seconds,
237
+ orientation=orientation,
238
+ style=style,
239
+ name=name,
240
+ resolution=resolution,
241
+ request_options=request_options,
242
+ )
243
+ logger.info(f"Text-to-Video response: {create_response}")
244
+
245
+ video_projects_client = AsyncVideoProjectsClient(base_client=self._base_client)
246
+ response = await video_projects_client.check_result(
247
+ id=create_response.id,
248
+ wait_for_completion=wait_for_completion,
249
+ download_outputs=download_outputs,
250
+ download_directory=download_directory,
251
+ )
252
+
253
+ return response
254
+
87
255
  async def create(
88
256
  self,
89
257
  *,
90
258
  end_seconds: float,
91
259
  orientation: typing_extensions.Literal["landscape", "portrait", "square"],
92
- style: params.PostV1TextToVideoBodyStyle,
260
+ style: params.V1TextToVideoCreateBodyStyle,
93
261
  name: typing.Union[
94
262
  typing.Optional[str], type_utils.NotGiven
95
263
  ] = type_utils.NOT_GIVEN,
264
+ resolution: typing.Union[
265
+ typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
266
+ type_utils.NotGiven,
267
+ ] = type_utils.NOT_GIVEN,
96
268
  request_options: typing.Optional[RequestOptions] = None,
97
- ) -> models.PostV1TextToVideoResponse:
269
+ ) -> models.V1TextToVideoCreateResponse:
98
270
  """
99
271
  Text-to-Video
100
272
 
101
273
  Create a Text To Video video. The estimated frame cost is calculated using 30 FPS. This amount is deducted from your account balance when a video is queued. Once the video is complete, the cost will be updated based on the actual number of frames rendered.
102
274
 
103
- Get more information about this mode at our [product page](/products/text-to-video).
275
+ Get more information about this mode at our [product page](https://magichour.ai/products/text-to-video).
104
276
 
105
277
 
106
278
  POST /v1/text-to-video
107
279
 
108
280
  Args:
109
- name: The name of video
281
+ name: The name of video. This value is mainly used for your own identification of the video.
282
+ resolution: Controls the output video resolution. Defaults to `720p` if not specified.
283
+
284
+ 480p and 720p are available on Creator, Pro, or Business tiers. However, 1080p require Pro or Business tier.
285
+
286
+ **Options:**
287
+ - `480p` - Supports only 5 or 10 second videos. Output: 24fps. Cost: 120 credits per 5 seconds.
288
+ - `720p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 300 credits per 5 seconds.
289
+ - `1080p` - Supports videos between 5-60 seconds. Output: 30fps. Cost: 600 credits per 5 seconds.
110
290
  end_seconds: The total duration of the output video in seconds.
291
+
292
+ The value must be greater than or equal to 5 seconds and less than or equal to 60 seconds.
293
+
294
+ Note: For 480p resolution, the value must be either 5 or 10.
111
295
  orientation: Determines the orientation of the output video
112
- style: PostV1TextToVideoBodyStyle
296
+ style: V1TextToVideoCreateBodyStyle
113
297
  request_options: Additional options to customize the HTTP request
114
298
 
115
299
  Returns:
@@ -124,25 +308,27 @@ class AsyncTextToVideoClient:
124
308
  await client.v1.text_to_video.create(
125
309
  end_seconds=5.0,
126
310
  orientation="landscape",
127
- style={"prompt": "string"},
311
+ style={"prompt": "a dog running"},
128
312
  name="Text To Video video",
313
+ resolution="720p",
129
314
  )
130
315
  ```
131
316
  """
132
317
  _json = to_encodable(
133
318
  item={
134
319
  "name": name,
320
+ "resolution": resolution,
135
321
  "end_seconds": end_seconds,
136
322
  "orientation": orientation,
137
323
  "style": style,
138
324
  },
139
- dump_with=params._SerializerPostV1TextToVideoBody,
325
+ dump_with=params._SerializerV1TextToVideoCreateBody,
140
326
  )
141
327
  return await self._base_client.request(
142
328
  method="POST",
143
329
  path="/v1/text-to-video",
144
330
  auth_names=["bearerAuth"],
145
331
  json=_json,
146
- cast_to=models.PostV1TextToVideoResponse,
332
+ cast_to=models.V1TextToVideoCreateResponse,
147
333
  request_options=request_options or default_request_options(),
148
334
  )
@@ -1,11 +1,66 @@
1
+ # v1.video_projects
1
2
 
2
- ### delete <a name="delete"></a>
3
- Delete video
3
+ ## Module Functions
4
+
5
+ <!-- CUSTOM DOCS START -->
6
+
7
+ ### Check results <a name="check-result"></a>
8
+
9
+ Poll the details API to check on the status of the rendering. Optionally can also download the output
10
+
11
+ #### Parameters
12
+
13
+ | Parameter | Required | Description | Example |
14
+ | --------------------- | :------: | ---------------------------------------------------------------------------------------------------- | ---------------- |
15
+ | `id` | ✓ | Unique ID of the video project. This value is returned by all of the POST APIs that create an video. | `"cuid-example"` |
16
+ | `wait_for_completion` | ✗ | Whether to wait for the project to complete. | `True` |
17
+ | `download_outputs` | ✗ | Whether to download the generated files | `True` |
18
+ | `download_directory` | ✗ | Directory to save downloaded files (defaults to current directory) | `"./outputs"` |
19
+
20
+ #### Synchronous Client
21
+
22
+ ```python
23
+ from magic_hour import Client
24
+ from os import getenv
25
+
26
+ client = Client(token=getenv("API_TOKEN"))
27
+ res = client.v1.video_projects.check_result(
28
+ id="cuid-example",
29
+ wait_for_completion=True,
30
+ download_outputs=True,
31
+ download_directory="outputs",
32
+ )
33
+ ```
34
+
35
+ #### Asynchronous Client
36
+
37
+ ```python
38
+ from magic_hour import AsyncClient
39
+ from os import getenv
40
+
41
+ client = AsyncClient(token=getenv("API_TOKEN"))
42
+ res = await client.v1.video_projects.check_result(
43
+ id="cuid-example",
44
+ wait_for_completion=True,
45
+ download_outputs=True,
46
+ download_directory="outputs",
47
+ )
48
+ ```
49
+
50
+ <!-- CUSTOM DOCS END -->
51
+
52
+ ### Delete video <a name="delete"></a>
4
53
 
5
54
  Permanently delete the rendered video. This action is not reversible, please be sure before deleting.
6
55
 
7
56
  **API Endpoint**: `DELETE /v1/video-projects/{id}`
8
57
 
58
+ #### Parameters
59
+
60
+ | Parameter | Required | Description | Example |
61
+ | --------- | :------: | --------------------------------------------------------------------------------------------------- | ---------------- |
62
+ | `id` | ✓ | Unique ID of the video project. This value is returned by all of the POST APIs that create a video. | `"cuid-example"` |
63
+
9
64
  #### Synchronous Client
10
65
 
11
66
  ```python
@@ -13,7 +68,7 @@ from magic_hour import Client
13
68
  from os import getenv
14
69
 
15
70
  client = Client(token=getenv("API_TOKEN"))
16
- res = client.v1.video_projects.delete(id="cm6pvghix03bvyz0zwash6noj")
71
+ res = client.v1.video_projects.delete(id="cuid-example")
17
72
  ```
18
73
 
19
74
  #### Asynchronous Client
@@ -23,15 +78,15 @@ from magic_hour import AsyncClient
23
78
  from os import getenv
24
79
 
25
80
  client = AsyncClient(token=getenv("API_TOKEN"))
26
- res = await client.v1.video_projects.delete(id="cm6pvghix03bvyz0zwash6noj")
81
+ res = await client.v1.video_projects.delete(id="cuid-example")
27
82
  ```
28
83
 
29
- ### get <a name="get"></a>
30
- Get video details
84
+ ### Get video details <a name="get"></a>
31
85
 
32
86
  Get the details of a video project. The `downloads` field will be empty unless the video was successfully rendered.
33
87
 
34
88
  The video can be one of the following status
89
+
35
90
  - `draft` - not currently used
36
91
  - `queued` - the job is queued and waiting for a GPU
37
92
  - `rendering` - the generation is in progress
@@ -39,9 +94,14 @@ The video can be one of the following status
39
94
  - `error` - an error occurred during rendering
40
95
  - `canceled` - video render is canceled by the user
41
96
 
42
-
43
97
  **API Endpoint**: `GET /v1/video-projects/{id}`
44
98
 
99
+ #### Parameters
100
+
101
+ | Parameter | Required | Description | Example |
102
+ | --------- | :------: | --------------------------------------------------------------------------------------------------- | ---------------- |
103
+ | `id` | ✓ | Unique ID of the video project. This value is returned by all of the POST APIs that create a video. | `"cuid-example"` |
104
+
45
105
  #### Synchronous Client
46
106
 
47
107
  ```python
@@ -49,7 +109,7 @@ from magic_hour import Client
49
109
  from os import getenv
50
110
 
51
111
  client = Client(token=getenv("API_TOKEN"))
52
- res = client.v1.video_projects.get(id="cm6pvghix03bvyz0zwash6noj")
112
+ res = client.v1.video_projects.get(id="cuid-example")
53
113
  ```
54
114
 
55
115
  #### Asynchronous Client
@@ -59,5 +119,17 @@ from magic_hour import AsyncClient
59
119
  from os import getenv
60
120
 
61
121
  client = AsyncClient(token=getenv("API_TOKEN"))
62
- res = await client.v1.video_projects.get(id="cm6pvghix03bvyz0zwash6noj")
122
+ res = await client.v1.video_projects.get(id="cuid-example")
123
+ ```
124
+
125
+ #### Response
126
+
127
+ ##### Type
128
+
129
+ [V1VideoProjectsGetResponse](/magic_hour/types/models/v1_video_projects_get_response.py)
130
+
131
+ ##### Example
132
+
133
+ ```python
134
+ {"created_at": "1970-01-01T00:00:00", "credits_charged": 450, "download": {"expires_at": "2024-10-19T05:16:19.027Z", "url": "https://videos.magichour.ai/id/output.mp4"}, "downloads": [{"expires_at": "2024-10-19T05:16:19.027Z", "url": "https://videos.magichour.ai/id/output.mp4"}], "enabled": True, "end_seconds": 15.0, "error": {"code": "no_source_face", "message": "Please use an image with a detectable face"}, "fps": 30.0, "height": 960, "id": "cuid-example", "name": "Example Name", "start_seconds": 0.0, "status": "complete", "total_frame_cost": 450, "type_": "FACE_SWAP", "width": 512}
63
135
  ```
@@ -1,4 +1,12 @@
1
- from .client import AsyncVideoProjectsClient, VideoProjectsClient
1
+ from .client import (
2
+ AsyncVideoProjectsClient,
3
+ V1VideoProjectsGetResponseWithDownloads,
4
+ VideoProjectsClient,
5
+ )
2
6
 
3
7
 
4
- __all__ = ["AsyncVideoProjectsClient", "VideoProjectsClient"]
8
+ __all__ = [
9
+ "AsyncVideoProjectsClient",
10
+ "V1VideoProjectsGetResponseWithDownloads",
11
+ "VideoProjectsClient",
12
+ ]