magic_hour 0.24.0__py3-none-any.whl → 0.25.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 (42) hide show
  1. magic_hour/client.py +2 -2
  2. magic_hour/core/__init__.py +6 -10
  3. magic_hour/core/auth.py +136 -96
  4. magic_hour/environment.py +1 -1
  5. magic_hour/resources/v1/ai_clothes_changer/README.md +13 -5
  6. magic_hour/resources/v1/ai_face_editor/README.md +14 -6
  7. magic_hour/resources/v1/ai_gif_generator/README.md +13 -5
  8. magic_hour/resources/v1/ai_headshot_generator/README.md +14 -6
  9. magic_hour/resources/v1/ai_image_editor/README.md +52 -0
  10. magic_hour/resources/v1/ai_image_editor/__init__.py +4 -0
  11. magic_hour/resources/v1/ai_image_editor/client.py +125 -0
  12. magic_hour/resources/v1/ai_image_generator/README.md +15 -7
  13. magic_hour/resources/v1/ai_image_upscaler/README.md +15 -7
  14. magic_hour/resources/v1/ai_meme_generator/README.md +13 -5
  15. magic_hour/resources/v1/ai_photo_editor/README.md +16 -8
  16. magic_hour/resources/v1/ai_qr_code_generator/README.md +14 -6
  17. magic_hour/resources/v1/ai_talking_photo/README.md +16 -8
  18. magic_hour/resources/v1/animation/README.md +18 -10
  19. magic_hour/resources/v1/client.py +6 -0
  20. magic_hour/resources/v1/face_swap/README.md +17 -9
  21. magic_hour/resources/v1/face_swap_photo/README.md +13 -5
  22. magic_hour/resources/v1/files/upload_urls/README.md +15 -8
  23. magic_hour/resources/v1/files/upload_urls/client.py +6 -8
  24. magic_hour/resources/v1/image_background_remover/README.md +13 -5
  25. magic_hour/resources/v1/image_projects/README.md +18 -10
  26. magic_hour/resources/v1/image_to_video/README.md +17 -9
  27. magic_hour/resources/v1/lip_sync/README.md +18 -10
  28. magic_hour/resources/v1/photo_colorizer/README.md +13 -5
  29. magic_hour/resources/v1/text_to_video/README.md +15 -7
  30. magic_hour/resources/v1/video_projects/README.md +18 -10
  31. magic_hour/resources/v1/video_to_video/README.md +19 -11
  32. magic_hour/types/models/__init__.py +2 -0
  33. magic_hour/types/models/v1_ai_image_editor_create_response.py +33 -0
  34. magic_hour/types/models/v1_image_projects_get_response.py +1 -1
  35. magic_hour/types/params/__init__.py +18 -0
  36. magic_hour/types/params/v1_ai_image_editor_create_body.py +49 -0
  37. magic_hour/types/params/v1_ai_image_editor_create_body_assets.py +28 -0
  38. magic_hour/types/params/v1_ai_image_editor_create_body_style.py +28 -0
  39. {magic_hour-0.24.0.dist-info → magic_hour-0.25.0.dist-info}/METADATA +5 -1
  40. {magic_hour-0.24.0.dist-info → magic_hour-0.25.0.dist-info}/RECORD +42 -35
  41. {magic_hour-0.24.0.dist-info → magic_hour-0.25.0.dist-info}/LICENSE +0 -0
  42. {magic_hour-0.24.0.dist-info → magic_hour-0.25.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,125 @@
1
+ import typing
2
+
3
+ from magic_hour.core import (
4
+ AsyncBaseClient,
5
+ RequestOptions,
6
+ SyncBaseClient,
7
+ default_request_options,
8
+ to_encodable,
9
+ type_utils,
10
+ )
11
+ from magic_hour.types import models, params
12
+
13
+
14
+ class AiImageEditorClient:
15
+ def __init__(self, *, base_client: SyncBaseClient):
16
+ self._base_client = base_client
17
+
18
+ def create(
19
+ self,
20
+ *,
21
+ assets: params.V1AiImageEditorCreateBodyAssets,
22
+ style: params.V1AiImageEditorCreateBodyStyle,
23
+ name: typing.Union[
24
+ typing.Optional[str], type_utils.NotGiven
25
+ ] = type_utils.NOT_GIVEN,
26
+ request_options: typing.Optional[RequestOptions] = None,
27
+ ) -> models.V1AiImageEditorCreateResponse:
28
+ """
29
+ AI Image Editor
30
+
31
+ Edit images with AI. Each edit costs 50 credits.
32
+
33
+ POST /v1/ai-image-editor
34
+
35
+ Args:
36
+ name: The name of image
37
+ assets: Provide the assets for image edit
38
+ style: V1AiImageEditorCreateBodyStyle
39
+ request_options: Additional options to customize the HTTP request
40
+
41
+ Returns:
42
+ Success
43
+
44
+ Raises:
45
+ ApiError: A custom exception class that provides additional context
46
+ for API errors, including the HTTP status code and response body.
47
+
48
+ Examples:
49
+ ```py
50
+ client.v1.ai_image_editor.create(
51
+ assets={"image_file_path": "api-assets/id/1234.png"},
52
+ style={"prompt": "Give me sunglasses"},
53
+ name="Ai Image Editor image",
54
+ )
55
+ ```
56
+ """
57
+ _json = to_encodable(
58
+ item={"name": name, "assets": assets, "style": style},
59
+ dump_with=params._SerializerV1AiImageEditorCreateBody,
60
+ )
61
+ return self._base_client.request(
62
+ method="POST",
63
+ path="/v1/ai-image-editor",
64
+ auth_names=["bearerAuth"],
65
+ json=_json,
66
+ cast_to=models.V1AiImageEditorCreateResponse,
67
+ request_options=request_options or default_request_options(),
68
+ )
69
+
70
+
71
+ class AsyncAiImageEditorClient:
72
+ def __init__(self, *, base_client: AsyncBaseClient):
73
+ self._base_client = base_client
74
+
75
+ async def create(
76
+ self,
77
+ *,
78
+ assets: params.V1AiImageEditorCreateBodyAssets,
79
+ style: params.V1AiImageEditorCreateBodyStyle,
80
+ name: typing.Union[
81
+ typing.Optional[str], type_utils.NotGiven
82
+ ] = type_utils.NOT_GIVEN,
83
+ request_options: typing.Optional[RequestOptions] = None,
84
+ ) -> models.V1AiImageEditorCreateResponse:
85
+ """
86
+ AI Image Editor
87
+
88
+ Edit images with AI. Each edit costs 50 credits.
89
+
90
+ POST /v1/ai-image-editor
91
+
92
+ Args:
93
+ name: The name of image
94
+ assets: Provide the assets for image edit
95
+ style: V1AiImageEditorCreateBodyStyle
96
+ request_options: Additional options to customize the HTTP request
97
+
98
+ Returns:
99
+ Success
100
+
101
+ Raises:
102
+ ApiError: A custom exception class that provides additional context
103
+ for API errors, including the HTTP status code and response body.
104
+
105
+ Examples:
106
+ ```py
107
+ await client.v1.ai_image_editor.create(
108
+ assets={"image_file_path": "api-assets/id/1234.png"},
109
+ style={"prompt": "Give me sunglasses"},
110
+ name="Ai Image Editor image",
111
+ )
112
+ ```
113
+ """
114
+ _json = to_encodable(
115
+ item={"name": name, "assets": assets, "style": style},
116
+ dump_with=params._SerializerV1AiImageEditorCreateBody,
117
+ )
118
+ return await self._base_client.request(
119
+ method="POST",
120
+ path="/v1/ai-image-editor",
121
+ auth_names=["bearerAuth"],
122
+ json=_json,
123
+ cast_to=models.V1AiImageEditorCreateResponse,
124
+ request_options=request_options or default_request_options(),
125
+ )
@@ -5,6 +5,15 @@ Create an AI image. Each image costs 5 credits.
5
5
 
6
6
  **API Endpoint**: `POST /v1/ai-image-generator`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `image_count` | ✓ | number to images to generate | `1` |
13
+ | `orientation` | ✓ | | `"landscape"` |
14
+ | `style` | ✓ | | `{"prompt": "Cool image", "tool": "ai-anime-generator"}` |
15
+ | `name` | ✗ | The name of image | `"Ai Image image"` |
16
+
8
17
  #### Synchronous Client
9
18
 
10
19
  ```python
@@ -37,11 +46,10 @@ res = await client.v1.ai_image_generator.create(
37
46
 
38
47
  ```
39
48
 
40
- #### Parameters
49
+ #### Response
41
50
 
42
- | Parameter | Required | Description | Example |
43
- |-----------|:--------:|-------------|--------|
44
- | `image_count` | ✓ | number to images to generate | `1` |
45
- | `orientation` | ✓ | | `"landscape"` |
46
- | `style` | ✓ | | `{"prompt": "Cool image", "tool": "ai-anime-generator"}` |
47
- | `name` | ✗ | The name of image | `"Ai Image image"` |
51
+ ##### Type
52
+ [V1AiImageGeneratorCreateResponse](/magic_hour/types/models/v1_ai_image_generator_create_response.py)
53
+
54
+ ##### Example
55
+ `{"credits_charged": 5, "frame_cost": 5, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -5,6 +5,15 @@ Upscale your image using AI. Each 2x upscale costs 50 credits, and 4x upscale co
5
5
 
6
6
  **API Endpoint**: `POST /v1/ai-image-upscaler`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `assets` | ✓ | Provide the assets for upscaling | `{"image_file_path": "api-assets/id/1234.png"}` |
13
+ | `scale_factor` | ✓ | How much to scale the image. Must be either 2 or 4 | `2.0` |
14
+ | `style` | ✓ | | `{"enhancement": "Balanced"}` |
15
+ | `name` | ✗ | The name of image | `"Image Upscaler image"` |
16
+
8
17
  #### Synchronous Client
9
18
 
10
19
  ```python
@@ -37,11 +46,10 @@ res = await client.v1.ai_image_upscaler.create(
37
46
 
38
47
  ```
39
48
 
40
- #### Parameters
49
+ #### Response
41
50
 
42
- | Parameter | Required | Description | Example |
43
- |-----------|:--------:|-------------|--------|
44
- | `assets` | ✓ | Provide the assets for upscaling | `{"image_file_path": "api-assets/id/1234.png"}` |
45
- | `scale_factor` | ✓ | How much to scale the image. Must be either 2 or 4 | `2.0` |
46
- | `style` | | | `{"enhancement": "Balanced"}` |
47
- | `name` | ✗ | The name of image | `"Image Upscaler image"` |
51
+ ##### Type
52
+ [V1AiImageUpscalerCreateResponse](/magic_hour/types/models/v1_ai_image_upscaler_create_response.py)
53
+
54
+ ##### Example
55
+ `{"credits_charged": 50, "frame_cost": 50, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -5,6 +5,13 @@ Create an AI generated meme. Each meme costs 10 credits.
5
5
 
6
6
  **API Endpoint**: `POST /v1/ai-meme-generator`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `style` | ✓ | | `{"search_web": False, "template": "Drake Hotline Bling", "topic": "When the code finally works"}` |
13
+ | `name` | ✗ | The name of the meme. | `"My Funny Meme"` |
14
+
8
15
  #### Synchronous Client
9
16
 
10
17
  ```python
@@ -41,9 +48,10 @@ res = await client.v1.ai_meme_generator.create(
41
48
 
42
49
  ```
43
50
 
44
- #### Parameters
51
+ #### Response
45
52
 
46
- | Parameter | Required | Description | Example |
47
- |-----------|:--------:|-------------|--------|
48
- | `style` | ✓ | | `{"search_web": False, "template": "Drake Hotline Bling", "topic": "When the code finally works"}` |
49
- | `name` | ✗ | The name of the meme. | `"My Funny Meme"` |
53
+ ##### Type
54
+ [V1AiMemeGeneratorCreateResponse](/magic_hour/types/models/v1_ai_meme_generator_create_response.py)
55
+
56
+ ##### Example
57
+ `{"credits_charged": 10, "frame_cost": 10, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -7,6 +7,16 @@ Edit photo using AI. Each photo costs 10 credits.
7
7
 
8
8
  **API Endpoint**: `POST /v1/ai-photo-editor`
9
9
 
10
+ #### Parameters
11
+
12
+ | Parameter | Required | Description | Example |
13
+ |-----------|:--------:|-------------|--------|
14
+ | `assets` | ✓ | Provide the assets for photo editor | `{"image_file_path": "api-assets/id/1234.png"}` |
15
+ | `resolution` | ✓ | The resolution of the final output image. The allowed value is based on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details | `768` |
16
+ | `style` | ✓ | | `{"image_description": "A photo of a person", "likeness_strength": 5.2, "negative_prompt": "painting, cartoon, sketch", "prompt": "A photo portrait of a person wearing a hat", "prompt_strength": 3.75, "steps": 4, "upscale_factor": 2, "upscale_fidelity": 0.5}` |
17
+ | `name` | ✗ | The name of image | `"Photo Editor image"` |
18
+ | `steps` | ✗ | Deprecated: Please use `.style.steps` instead. Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time. | `123` |
19
+
10
20
  #### Synchronous Client
11
21
 
12
22
  ```python
@@ -57,12 +67,10 @@ res = await client.v1.ai_photo_editor.create(
57
67
 
58
68
  ```
59
69
 
60
- #### Parameters
70
+ #### Response
61
71
 
62
- | Parameter | Required | Description | Example |
63
- |-----------|:--------:|-------------|--------|
64
- | `assets` | ✓ | Provide the assets for photo editor | `{"image_file_path": "api-assets/id/1234.png"}` |
65
- | `resolution` | ✓ | The resolution of the final output image. The allowed value is based on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details | `768` |
66
- | `style` | ✓ | | `{"image_description": "A photo of a person", "likeness_strength": 5.2, "negative_prompt": "painting, cartoon, sketch", "prompt": "A photo portrait of a person wearing a hat", "prompt_strength": 3.75, "steps": 4, "upscale_factor": 2, "upscale_fidelity": 0.5}` |
67
- | `name` | ✗ | The name of image | `"Photo Editor image"` |
68
- | `steps` | ✗ | Deprecated: Please use `.style.steps` instead. Number of iterations used to generate the output. Higher values improve quality and increase the strength of the prompt but increase processing time. | `123` |
72
+ ##### Type
73
+ [V1AiPhotoEditorCreateResponse](/magic_hour/types/models/v1_ai_photo_editor_create_response.py)
74
+
75
+ ##### Example
76
+ `{"credits_charged": 10, "frame_cost": 10, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -5,6 +5,14 @@ Create an AI QR code. Each QR code costs 20 credits.
5
5
 
6
6
  **API Endpoint**: `POST /v1/ai-qr-code-generator`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `content` | ✓ | The content of the QR code. | `"https://magichour.ai"` |
13
+ | `style` | ✓ | | `{"art_style": "Watercolor"}` |
14
+ | `name` | ✗ | The name of image | `"Qr Code image"` |
15
+
8
16
  #### Synchronous Client
9
17
 
10
18
  ```python
@@ -35,10 +43,10 @@ res = await client.v1.ai_qr_code_generator.create(
35
43
 
36
44
  ```
37
45
 
38
- #### Parameters
46
+ #### Response
39
47
 
40
- | Parameter | Required | Description | Example |
41
- |-----------|:--------:|-------------|--------|
42
- | `content` | ✓ | The content of the QR code. | `"https://magichour.ai"` |
43
- | `style` | ✓ | | `{"art_style": "Watercolor"}` |
44
- | `name` | | The name of image | `"Qr Code image"` |
48
+ ##### Type
49
+ [V1AiQrCodeGeneratorCreateResponse](/magic_hour/types/models/v1_ai_qr_code_generator_create_response.py)
50
+
51
+ ##### Example
52
+ `{"credits_charged": 20, "frame_cost": 20, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -5,6 +5,16 @@ Create a talking photo from an image and audio or text input.
5
5
 
6
6
  **API Endpoint**: `POST /v1/ai-talking-photo`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `assets` | ✓ | Provide the assets for creating a talking photo | `{"audio_file_path": "api-assets/id/1234.mp3", "image_file_path": "api-assets/id/1234.png"}` |
13
+ | `end_seconds` | ✓ | The end time of the input audio in seconds. The maximum duration allowed is 30 seconds. | `15.0` |
14
+ | `start_seconds` | ✓ | The start time of the input audio in seconds. The maximum duration allowed is 30 seconds. | `0.0` |
15
+ | `name` | ✗ | The name of image | `"Talking Photo image"` |
16
+ | `style` | ✗ | Attributes used to dictate the style of the output | `{"generation_mode": "expressive", "intensity": 1.5}` |
17
+
8
18
  #### Synchronous Client
9
19
 
10
20
  ```python
@@ -43,12 +53,10 @@ res = await client.v1.ai_talking_photo.create(
43
53
 
44
54
  ```
45
55
 
46
- #### Parameters
56
+ #### Response
47
57
 
48
- | Parameter | Required | Description | Example |
49
- |-----------|:--------:|-------------|--------|
50
- | `assets` | ✓ | Provide the assets for creating a talking photo | `{"audio_file_path": "api-assets/id/1234.mp3", "image_file_path": "api-assets/id/1234.png"}` |
51
- | `end_seconds` | ✓ | The end time of the input audio in seconds. The maximum duration allowed is 30 seconds. | `15.0` |
52
- | `start_seconds` | | The start time of the input audio in seconds. The maximum duration allowed is 30 seconds. | `0.0` |
53
- | `name` | ✗ | The name of image | `"Talking Photo image"` |
54
- | `style` | ✗ | Attributes used to dictate the style of the output | `{"generation_mode": "expressive", "intensity": 1.5}` |
58
+ ##### Type
59
+ [V1AiTalkingPhotoCreateResponse](/magic_hour/types/models/v1_ai_talking_photo_create_response.py)
60
+
61
+ ##### Example
62
+ `{"credits_charged": 450, "estimated_frame_cost": 450, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -5,6 +5,18 @@ Create a Animation video. The estimated frame cost is calculated based on the `f
5
5
 
6
6
  **API Endpoint**: `POST /v1/animation`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `assets` | ✓ | Provide the assets for animation. | `{"audio_file_path": "api-assets/id/1234.mp3", "audio_source": "file", "image_file_path": "api-assets/id/1234.png"}` |
13
+ | `end_seconds` | ✓ | The end time of the input video in seconds | `15.0` |
14
+ | `fps` | ✓ | The desire output video frame rate | `12.0` |
15
+ | `height` | ✓ | The height of the final output video. The maximum height depends on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details | `960` |
16
+ | `style` | ✓ | Defines the style of the output video | `{"art_style": "Painterly Illustration", "camera_effect": "Accelerate", "prompt": "Cyberpunk city", "prompt_type": "ai_choose", "transition_speed": 5}` |
17
+ | `width` | ✓ | The width of the final output video. The maximum width depends on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details | `512` |
18
+ | `name` | ✗ | The name of video | `"Animation video"` |
19
+
8
20
  #### Synchronous Client
9
21
 
10
22
  ```python
@@ -63,14 +75,10 @@ res = await client.v1.animation.create(
63
75
 
64
76
  ```
65
77
 
66
- #### Parameters
78
+ #### Response
67
79
 
68
- | Parameter | Required | Description | Example |
69
- |-----------|:--------:|-------------|--------|
70
- | `assets` | ✓ | Provide the assets for animation. | `{"audio_file_path": "api-assets/id/1234.mp3", "audio_source": "file", "image_file_path": "api-assets/id/1234.png"}` |
71
- | `end_seconds` | ✓ | The end time of the input video in seconds | `15.0` |
72
- | `fps` | | The desire output video frame rate | `12.0` |
73
- | `height` | ✓ | The height of the final output video. The maximum height depends on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details | `960` |
74
- | `style` | ✓ | Defines the style of the output video | `{"art_style": "Painterly Illustration", "camera_effect": "Accelerate", "prompt": "Cyberpunk city", "prompt_type": "ai_choose", "transition_speed": 5}` |
75
- | `width` | ✓ | The width of the final output video. The maximum width depends on your subscription. Please refer to our [pricing page](https://magichour.ai/pricing) for more details | `512` |
76
- | `name` | ✗ | The name of video | `"Animation video"` |
80
+ ##### Type
81
+ [V1AnimationCreateResponse](/magic_hour/types/models/v1_animation_create_response.py)
82
+
83
+ ##### Example
84
+ `{"credits_charged": 450, "estimated_frame_cost": 450, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -15,6 +15,10 @@ from magic_hour.resources.v1.ai_headshot_generator import (
15
15
  AiHeadshotGeneratorClient,
16
16
  AsyncAiHeadshotGeneratorClient,
17
17
  )
18
+ from magic_hour.resources.v1.ai_image_editor import (
19
+ AiImageEditorClient,
20
+ AsyncAiImageEditorClient,
21
+ )
18
22
  from magic_hour.resources.v1.ai_image_generator import (
19
23
  AiImageGeneratorClient,
20
24
  AsyncAiImageGeneratorClient,
@@ -88,6 +92,7 @@ class V1Client:
88
92
  self.ai_headshot_generator = AiHeadshotGeneratorClient(
89
93
  base_client=self._base_client
90
94
  )
95
+ self.ai_image_editor = AiImageEditorClient(base_client=self._base_client)
91
96
  self.ai_image_generator = AiImageGeneratorClient(base_client=self._base_client)
92
97
  self.ai_image_upscaler = AiImageUpscalerClient(base_client=self._base_client)
93
98
  self.ai_meme_generator = AiMemeGeneratorClient(base_client=self._base_client)
@@ -123,6 +128,7 @@ class AsyncV1Client:
123
128
  self.ai_headshot_generator = AsyncAiHeadshotGeneratorClient(
124
129
  base_client=self._base_client
125
130
  )
131
+ self.ai_image_editor = AsyncAiImageEditorClient(base_client=self._base_client)
126
132
  self.ai_image_generator = AsyncAiImageGeneratorClient(
127
133
  base_client=self._base_client
128
134
  )
@@ -8,6 +8,17 @@ Get more information about this mode at our [product page](/products/face-swap).
8
8
 
9
9
  **API Endpoint**: `POST /v1/face-swap`
10
10
 
11
+ #### Parameters
12
+
13
+ | Parameter | Required | Description | Example |
14
+ |-----------|:--------:|-------------|--------|
15
+ | `assets` | ✓ | Provide the assets for face swap. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used | `{"image_file_path": "image/id/1234.png", "video_file_path": "api-assets/id/1234.mp4", "video_source": "file"}` |
16
+ | `end_seconds` | ✓ | The end time of the input video in seconds | `15.0` |
17
+ | `start_seconds` | ✓ | The start time of the input video in seconds | `0.0` |
18
+ | `height` | ✗ | Used to determine the dimensions of the output video. * 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. * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio. Note: if the video's original resolution is less than the maximum, the video will not be resized. See our [pricing page](https://magichour.ai/pricing) for more details. | `960` |
19
+ | `name` | ✗ | The name of video | `"Face Swap video"` |
20
+ | `width` | ✗ | Used to determine the dimensions of the output video. * 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. * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio. Note: if the video's original resolution is less than the maximum, the video will not be resized. See our [pricing page](https://magichour.ai/pricing) for more details. | `512` |
21
+
11
22
  #### Synchronous Client
12
23
 
13
24
  ```python
@@ -52,13 +63,10 @@ res = await client.v1.face_swap.create(
52
63
 
53
64
  ```
54
65
 
55
- #### Parameters
66
+ #### Response
56
67
 
57
- | Parameter | Required | Description | Example |
58
- |-----------|:--------:|-------------|--------|
59
- | `assets` | ✓ | Provide the assets for face swap. For video, The `video_source` field determines whether `video_file_path` or `youtube_url` field is used | `{"image_file_path": "image/id/1234.png", "video_file_path": "api-assets/id/1234.mp4", "video_source": "file"}` |
60
- | `end_seconds` | ✓ | The end time of the input video in seconds | `15.0` |
61
- | `start_seconds` | | The start time of the input video in seconds | `0.0` |
62
- | `height` | ✗ | Used to determine the dimensions of the output video. * 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. * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio. Note: if the video's original resolution is less than the maximum, the video will not be resized. See our [pricing page](https://magichour.ai/pricing) for more details. | `960` |
63
- | `name` | ✗ | The name of video | `"Face Swap video"` |
64
- | `width` | ✗ | Used to determine the dimensions of the output video. * 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. * If both height and width are omitted, the video will be resized according to your subscription's maximum resolution, while preserving aspect ratio. Note: if the video's original resolution is less than the maximum, the video will not be resized. See our [pricing page](https://magichour.ai/pricing) for more details. | `512` |
68
+ ##### Type
69
+ [V1FaceSwapCreateResponse](/magic_hour/types/models/v1_face_swap_create_response.py)
70
+
71
+ ##### Example
72
+ `{"credits_charged": 450, "estimated_frame_cost": 450, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -5,6 +5,13 @@ Create a face swap photo. Each photo costs 5 credits. The height/width of the ou
5
5
 
6
6
  **API Endpoint**: `POST /v1/face-swap-photo`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `assets` | ✓ | Provide the assets for face swap photo | `{"source_file_path": "api-assets/id/1234.png", "target_file_path": "api-assets/id/1234.png"}` |
13
+ | `name` | ✗ | The name of image | `"Face Swap image"` |
14
+
8
15
  #### Synchronous Client
9
16
 
10
17
  ```python
@@ -39,9 +46,10 @@ res = await client.v1.face_swap_photo.create(
39
46
 
40
47
  ```
41
48
 
42
- #### Parameters
49
+ #### Response
43
50
 
44
- | Parameter | Required | Description | Example |
45
- |-----------|:--------:|-------------|--------|
46
- | `assets` | ✓ | Provide the assets for face swap photo | `{"source_file_path": "api-assets/id/1234.png", "target_file_path": "api-assets/id/1234.png"}` |
47
- | `name` | ✗ | The name of image | `"Face Swap image"` |
51
+ ##### Type
52
+ [V1FaceSwapPhotoCreateResponse](/magic_hour/types/models/v1_face_swap_photo_create_response.py)
53
+
54
+ ##### Example
55
+ `{"credits_charged": 5, "frame_cost": 5, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -11,19 +11,24 @@ Below is the list of valid extensions for each asset type:
11
11
 
12
12
  Note: `.gif` is supported for face swap API `video_file_path` field.
13
13
 
14
- After receiving the upload url, you can upload the file by sending a PUT request with the header `'Content-Type: application/octet-stream'`.
14
+ After receiving the upload url, you can upload the file by sending a PUT request.
15
15
 
16
16
  For example using curl
17
17
 
18
18
  ```
19
- curl -X PUT -H 'Content-Type: application/octet-stream' \
20
- --data '@/path/to/file/video.mp4' \
21
- https://videos.magichour.ai/api-assets/id/video.mp4?auth-value=1234567890
19
+ curl -X PUT --data '@/path/to/file/video.mp4' \
20
+ https://videos.magichour.ai/api-assets/id/video.mp4?<auth params from the API response>
22
21
  ```
23
22
 
24
23
 
25
24
  **API Endpoint**: `POST /v1/files/upload-urls`
26
25
 
26
+ #### Parameters
27
+
28
+ | Parameter | Required | Description | Example |
29
+ |-----------|:--------:|-------------|--------|
30
+ | `items` | ✓ | | `[{"extension": "mp4", "type_": "video"}, {"extension": "mp3", "type_": "audio"}]` |
31
+
27
32
  #### Synchronous Client
28
33
 
29
34
  ```python
@@ -56,8 +61,10 @@ res = await client.v1.files.upload_urls.create(
56
61
 
57
62
  ```
58
63
 
59
- #### Parameters
64
+ #### Response
60
65
 
61
- | Parameter | Required | Description | Example |
62
- |-----------|:--------:|-------------|--------|
63
- | `items` | ✓ | | `[{"extension": "mp4", "type_": "video"}, {"extension": "mp3", "type_": "audio"}]` |
66
+ ##### Type
67
+ [V1FilesUploadUrlsCreateResponse](/magic_hour/types/models/v1_files_upload_urls_create_response.py)
68
+
69
+ ##### Example
70
+ `{"items": [{"expires_at": "2024-07-25T16:56:21.932Z", "file_path": "api-assets/id/video.mp4", "upload_url": "https://videos.magichour.ai/api-assets/id/video.mp4?auth-value=1234567890"}, {"expires_at": "2024-07-25T16:56:21.932Z", "file_path": "api-assets/id/audio.mp3", "upload_url": "https://videos.magichour.ai/api-assets/id/audio.mp3?auth-value=1234567890"}]}`
@@ -33,14 +33,13 @@ class UploadUrlsClient:
33
33
 
34
34
  Note: `.gif` is supported for face swap API `video_file_path` field.
35
35
 
36
- After receiving the upload url, you can upload the file by sending a PUT request with the header `'Content-Type: application/octet-stream'`.
36
+ After receiving the upload url, you can upload the file by sending a PUT request.
37
37
 
38
38
  For example using curl
39
39
 
40
40
  ```
41
- curl -X PUT -H 'Content-Type: application/octet-stream' \
42
- --data '@/path/to/file/video.mp4' \
43
- https://videos.magichour.ai/api-assets/id/video.mp4?auth-value=1234567890
41
+ curl -X PUT --data '@/path/to/file/video.mp4' \
42
+ https://videos.magichour.ai/api-assets/id/video.mp4?<auth params from the API response>
44
43
  ```
45
44
 
46
45
 
@@ -99,14 +98,13 @@ class AsyncUploadUrlsClient:
99
98
 
100
99
  Note: `.gif` is supported for face swap API `video_file_path` field.
101
100
 
102
- After receiving the upload url, you can upload the file by sending a PUT request with the header `'Content-Type: application/octet-stream'`.
101
+ After receiving the upload url, you can upload the file by sending a PUT request.
103
102
 
104
103
  For example using curl
105
104
 
106
105
  ```
107
- curl -X PUT -H 'Content-Type: application/octet-stream' \
108
- --data '@/path/to/file/video.mp4' \
109
- https://videos.magichour.ai/api-assets/id/video.mp4?auth-value=1234567890
106
+ curl -X PUT --data '@/path/to/file/video.mp4' \
107
+ https://videos.magichour.ai/api-assets/id/video.mp4?<auth params from the API response>
110
108
  ```
111
109
 
112
110
 
@@ -5,6 +5,13 @@ Remove background from image. Each image costs 5 credits.
5
5
 
6
6
  **API Endpoint**: `POST /v1/image-background-remover`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `assets` | ✓ | Provide the assets for background removal | `{"image_file_path": "api-assets/id/1234.png"}` |
13
+ | `name` | ✗ | The name of image | `"Background Remover image"` |
14
+
8
15
  #### Synchronous Client
9
16
 
10
17
  ```python
@@ -33,9 +40,10 @@ res = await client.v1.image_background_remover.create(
33
40
 
34
41
  ```
35
42
 
36
- #### Parameters
43
+ #### Response
37
44
 
38
- | Parameter | Required | Description | Example |
39
- |-----------|:--------:|-------------|--------|
40
- | `assets` | ✓ | Provide the assets for background removal | `{"image_file_path": "api-assets/id/1234.png"}` |
41
- | `name` | ✗ | The name of image | `"Background Remover image"` |
45
+ ##### Type
46
+ [V1ImageBackgroundRemoverCreateResponse](/magic_hour/types/models/v1_image_background_remover_create_response.py)
47
+
48
+ ##### Example
49
+ `{"credits_charged": 5, "frame_cost": 5, "id": "clx7uu86w0a5qp55yxz315r6r"}`
@@ -5,6 +5,12 @@ Permanently delete the rendered image. This action is not reversible, please be
5
5
 
6
6
  **API Endpoint**: `DELETE /v1/image-projects/{id}`
7
7
 
8
+ #### Parameters
9
+
10
+ | Parameter | Required | Description | Example |
11
+ |-----------|:--------:|-------------|--------|
12
+ | `id` | ✓ | The id of the image project | `"cm6pvghix03bvyz0zwash6noj"` |
13
+
8
14
  #### Synchronous Client
9
15
 
10
16
  ```python
@@ -27,12 +33,6 @@ res = await client.v1.image_projects.delete(id="cm6pvghix03bvyz0zwash6noj")
27
33
 
28
34
  ```
29
35
 
30
- #### Parameters
31
-
32
- | Parameter | Required | Description | Example |
33
- |-----------|:--------:|-------------|--------|
34
- | `id` | ✓ | The id of the image project | `"cm6pvghix03bvyz0zwash6noj"` |
35
-
36
36
  ### Get image details <a name="get"></a>
37
37
 
38
38
  Get the details of a image project. The `downloads` field will be empty unless the image was successfully rendered.
@@ -48,6 +48,12 @@ The image can be one of the following status
48
48
 
49
49
  **API Endpoint**: `GET /v1/image-projects/{id}`
50
50
 
51
+ #### Parameters
52
+
53
+ | Parameter | Required | Description | Example |
54
+ |-----------|:--------:|-------------|--------|
55
+ | `id` | ✓ | The id of the image project | `"cm6pvghix03bvyz0zwash6noj"` |
56
+
51
57
  #### Synchronous Client
52
58
 
53
59
  ```python
@@ -70,8 +76,10 @@ res = await client.v1.image_projects.get(id="cm6pvghix03bvyz0zwash6noj")
70
76
 
71
77
  ```
72
78
 
73
- #### Parameters
79
+ #### Response
74
80
 
75
- | Parameter | Required | Description | Example |
76
- |-----------|:--------:|-------------|--------|
77
- | `id` | ✓ | The id of the image project | `"cm6pvghix03bvyz0zwash6noj"` |
81
+ ##### Type
82
+ [V1ImageProjectsGetResponse](/magic_hour/types/models/v1_image_projects_get_response.py)
83
+
84
+ ##### Example
85
+ `{"created_at": "1970-01-01T00:00:00", "credits_charged": 5, "downloads": [{"expires_at": "2024-10-19T05:16:19.027Z", "url": "https://videos.magichour.ai/id/output.png"}], "enabled": True, "error": {"code": "no_source_face", "message": "Please use an image with a detectable face"}, "id": "clx7uu86w0a5qp55yxz315r6r", "image_count": 1, "name": "Example Name", "status": "complete", "total_frame_cost": 5, "type_": "AI_IMAGE"}`