diff --git a/.sdk.json b/.sdk.json index 95504eb..b126fbd 100644 --- a/.sdk.json +++ b/.sdk.json @@ -1,5 +1,5 @@ { - "id": "2db416fc-d566-4b6b-a6a2-d7d8e5e2be0e", + "id": "a29c33ac-83f8-4c7a-b921-cbe31c36a530", "tracked_paths": [ { "editable": true, diff --git a/README.md b/README.md index 3641684..ad8a736 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,7 @@ download_urls = result.downloads ### [v1.audio_to_video](magic_hour/resources/v1/audio_to_video/README.md) - [create](magic_hour/resources/v1/audio_to_video/README.md#create) - Audio-to-Video +- [generate](magic_hour/resources/v1/audio_to_video/README.md#generate) - Audio To Video Generate Workflow ### [v1.auto_subtitle_generator](magic_hour/resources/v1/auto_subtitle_generator/README.md) diff --git a/magic_hour/environment.py b/magic_hour/environment.py index a33601c..d113c51 100644 --- a/magic_hour/environment.py +++ b/magic_hour/environment.py @@ -6,7 +6,7 @@ class Environment(enum.Enum): """Pre-defined base URLs for the API""" ENVIRONMENT = "https://api.magichour.ai" - MOCK_SERVER = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.64.0" + MOCK_SERVER = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.65.0" def _get_base_url( diff --git a/magic_hour/resources/v1/ai_image_upscaler/README.md b/magic_hour/resources/v1/ai_image_upscaler/README.md index 9439286..51f77a0 100644 --- a/magic_hour/resources/v1/ai_image_upscaler/README.md +++ b/magic_hour/resources/v1/ai_image_upscaler/README.md @@ -75,8 +75,9 @@ Upscale your image using AI. Each 2x upscale costs 50 credits, and 4x upscale co | `assets` | ✓ | Provide the assets for upscaling | `{"image_file_path": "api-assets/id/1234.png"}` | | `└─ image_file_path` | ✓ | The image to upscale. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. . The maximum input image size is 4096x4096px. | `"api-assets/id/1234.png"` | | `scale_factor` | ✓ | How much to scale the image. Must be either 2 or 4. Note: 4x upscale is only available on Creator, Pro, or Business tier. | `2.0` | -| `style` | ✓ | | `{"enhancement": "Balanced"}` | -| `└─ enhancement` | ✓ | | `"Balanced"` | +| `style` | ✓ | Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`. | `{"mode": "creative"}` | +| `└─ enhancement` | ✗ | | `"Balanced"` | +| `└─ mode` | ✗ | The upscaling mode. `"pro"` is faster and does not require `enhancement`. `"creative"` requires `enhancement`. Defaults to `"creative"`. | `"creative"` | | `└─ prompt` | ✗ | A prompt to guide the final image. This value is ignored if `enhancement` is not Creative | `"string"` | | `name` | ✗ | Give your image a custom name for easy identification. | `"My Image Upscaler image"` | @@ -90,7 +91,7 @@ client = Client(token=getenv("API_TOKEN")) res = client.v1.ai_image_upscaler.create( assets={"image_file_path": "api-assets/id/1234.png"}, scale_factor=2.0, - style={"enhancement": "Balanced"}, + style={"mode": "creative"}, name="My Image Upscaler image", ) ``` @@ -105,7 +106,7 @@ client = AsyncClient(token=getenv("API_TOKEN")) res = await client.v1.ai_image_upscaler.create( assets={"image_file_path": "api-assets/id/1234.png"}, scale_factor=2.0, - style={"enhancement": "Balanced"}, + style={"mode": "creative"}, name="My Image Upscaler image", ) ``` diff --git a/magic_hour/resources/v1/ai_image_upscaler/client.py b/magic_hour/resources/v1/ai_image_upscaler/client.py index dd6370b..a1b37b6 100644 --- a/magic_hour/resources/v1/ai_image_upscaler/client.py +++ b/magic_hour/resources/v1/ai_image_upscaler/client.py @@ -118,7 +118,7 @@ def create( scale_factor: How much to scale the image. Must be either 2 or 4. Note: 4x upscale is only available on Creator, Pro, or Business tier. - style: V1AiImageUpscalerCreateBodyStyle + style: Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`. request_options: Additional options to customize the HTTP request Returns: @@ -133,7 +133,7 @@ def create( client.v1.ai_image_upscaler.create( assets={"image_file_path": "api-assets/id/1234.png"}, scale_factor=2.0, - style={"enhancement": "Balanced"}, + style={"mode": "creative"}, name="My Image Upscaler image", ) ``` @@ -255,7 +255,7 @@ async def create( scale_factor: How much to scale the image. Must be either 2 or 4. Note: 4x upscale is only available on Creator, Pro, or Business tier. - style: V1AiImageUpscalerCreateBodyStyle + style: Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`. request_options: Additional options to customize the HTTP request Returns: @@ -270,7 +270,7 @@ async def create( await client.v1.ai_image_upscaler.create( assets={"image_file_path": "api-assets/id/1234.png"}, scale_factor=2.0, - style={"enhancement": "Balanced"}, + style={"mode": "creative"}, name="My Image Upscaler image", ) ``` diff --git a/magic_hour/resources/v1/ai_talking_photo/README.md b/magic_hour/resources/v1/ai_talking_photo/README.md index f544d05..5d33852 100644 --- a/magic_hour/resources/v1/ai_talking_photo/README.md +++ b/magic_hour/resources/v1/ai_talking_photo/README.md @@ -81,8 +81,8 @@ Create a talking photo from an image and audio or text input. | `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"}` | | `└─ audio_file_path` | ✓ | The audio file to sync with the image. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.mp3"` | | `└─ image_file_path` | ✓ | The source image to animate. This value is either - a direct URL to the video file - `file_path` field from the response of the [upload urls API](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls). See the [file upload guide](https://docs.magichour.ai/api-reference/files/generate-asset-upload-urls#input-file) for details. | `"api-assets/id/1234.png"` | -| `end_seconds` | ✓ | The end time of the input audio in seconds. The maximum duration allowed is 60 seconds. | `15.0` | -| `start_seconds` | ✓ | The start time of the input audio in seconds. The maximum duration allowed is 60 seconds. | `0.0` | +| `end_seconds` | ✓ | The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. | `15.0` | +| `start_seconds` | ✓ | The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. | `0.0` | | `max_resolution` | ✗ | Constrains the larger dimension (height or width) of the output video. Allows you to set a lower resolution than your plan's maximum if desired. The value is capped by your plan's max resolution. | `1024` | | `name` | ✗ | Give your image a custom name for easy identification. | `"My Talking Photo image"` | | `style` | ✗ | Attributes used to dictate the style of the output | `{"generation_mode": "realistic"}` | diff --git a/magic_hour/resources/v1/ai_talking_photo/client.py b/magic_hour/resources/v1/ai_talking_photo/client.py index d9ad323..1fd39db 100644 --- a/magic_hour/resources/v1/ai_talking_photo/client.py +++ b/magic_hour/resources/v1/ai_talking_photo/client.py @@ -138,8 +138,8 @@ def create( name: Give your image a custom name for easy identification. style: Attributes used to dictate the style of the output assets: Provide the assets for creating a talking photo - end_seconds: The end time of the input audio in seconds. The maximum duration allowed is 60 seconds. - start_seconds: The start time of the input audio in seconds. The maximum duration allowed is 60 seconds. + end_seconds: The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. + start_seconds: The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. request_options: Additional options to customize the HTTP request Returns: @@ -302,8 +302,8 @@ async def create( name: Give your image a custom name for easy identification. style: Attributes used to dictate the style of the output assets: Provide the assets for creating a talking photo - end_seconds: The end time of the input audio in seconds. The maximum duration allowed is 60 seconds. - start_seconds: The start time of the input audio in seconds. The maximum duration allowed is 60 seconds. + end_seconds: The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. + start_seconds: The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. request_options: Additional options to customize the HTTP request Returns: diff --git a/magic_hour/types/params/v1_ai_image_upscaler_create_body.py b/magic_hour/types/params/v1_ai_image_upscaler_create_body.py index 2b11355..3fe88a0 100644 --- a/magic_hour/types/params/v1_ai_image_upscaler_create_body.py +++ b/magic_hour/types/params/v1_ai_image_upscaler_create_body.py @@ -35,6 +35,9 @@ class V1AiImageUpscalerCreateBody(typing_extensions.TypedDict): """ style: typing_extensions.Required[V1AiImageUpscalerCreateBodyStyle] + """ + Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`. + """ class _SerializerV1AiImageUpscalerCreateBody(pydantic.BaseModel): diff --git a/magic_hour/types/params/v1_ai_image_upscaler_create_body_style.py b/magic_hour/types/params/v1_ai_image_upscaler_create_body_style.py index 93a0afa..1cce95b 100644 --- a/magic_hour/types/params/v1_ai_image_upscaler_create_body_style.py +++ b/magic_hour/types/params/v1_ai_image_upscaler_create_body_style.py @@ -5,13 +5,18 @@ class V1AiImageUpscalerCreateBodyStyle(typing_extensions.TypedDict): """ - V1AiImageUpscalerCreateBodyStyle + Style settings for the upscale. Use `mode` to select between `"pro"` (faster, no enhancement required) and `"creative"` (defaults to `"Balanced"` enhancement). Defaults to `"creative"`. """ - enhancement: typing_extensions.Required[ + enhancement: typing_extensions.NotRequired[ typing_extensions.Literal["Balanced", "Creative", "Resemblance"] ] + mode: typing_extensions.NotRequired[typing_extensions.Literal["creative", "pro"]] + """ + The upscaling mode. `"pro"` is faster and does not require `enhancement`. `"creative"` requires `enhancement`. Defaults to `"creative"`. + """ + prompt: typing_extensions.NotRequired[str] """ A prompt to guide the final image. This value is ignored if `enhancement` is not Creative @@ -28,9 +33,10 @@ class _SerializerV1AiImageUpscalerCreateBodyStyle(pydantic.BaseModel): populate_by_name=True, ) - enhancement: typing_extensions.Literal["Balanced", "Creative", "Resemblance"] = ( - pydantic.Field( - alias="enhancement", - ) + enhancement: typing.Optional[ + typing_extensions.Literal["Balanced", "Creative", "Resemblance"] + ] = pydantic.Field(alias="enhancement", default=None) + mode: typing.Optional[typing_extensions.Literal["creative", "pro"]] = ( + pydantic.Field(alias="mode", default=None) ) prompt: typing.Optional[str] = pydantic.Field(alias="prompt", default=None) diff --git a/magic_hour/types/params/v1_ai_talking_photo_create_body.py b/magic_hour/types/params/v1_ai_talking_photo_create_body.py index cd8d4ed..b4692cc 100644 --- a/magic_hour/types/params/v1_ai_talking_photo_create_body.py +++ b/magic_hour/types/params/v1_ai_talking_photo_create_body.py @@ -24,7 +24,7 @@ class V1AiTalkingPhotoCreateBody(typing_extensions.TypedDict): end_seconds: typing_extensions.Required[float] """ - The end time of the input audio in seconds. The maximum duration allowed is 60 seconds. + The end time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. """ max_resolution: typing_extensions.NotRequired[int] @@ -39,7 +39,7 @@ class V1AiTalkingPhotoCreateBody(typing_extensions.TypedDict): start_seconds: typing_extensions.Required[float] """ - The start time of the input audio in seconds. The maximum duration allowed is 60 seconds. + The start time of the input audio in seconds. Maximum clip length depends on style.generation_mode: realistic 180s, prompted 45s. """ style: typing_extensions.NotRequired[V1AiTalkingPhotoCreateBodyStyle] diff --git a/pyproject.toml b/pyproject.toml index fa1bee3..db97bd6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "magic_hour" -version = "0.64.0" +version = "0.65.0" description = "Python SDK for Magic Hour API" readme = "README.md" authors = [] diff --git a/tests/test_v1_ai_image_upscaler_client.py b/tests/test_v1_ai_image_upscaler_client.py index d599845..81213ef 100644 --- a/tests/test_v1_ai_image_upscaler_client.py +++ b/tests/test_v1_ai_image_upscaler_client.py @@ -29,7 +29,7 @@ def test_create_200_success_all_params() -> None: response = client.v1.ai_image_upscaler.create( assets={"image_file_path": "api-assets/id/1234.png"}, scale_factor=2.0, - style={"enhancement": "Balanced", "prompt": "string"}, + style={"enhancement": "Balanced", "mode": "creative", "prompt": "string"}, name="My Image Upscaler image", ) try: @@ -66,7 +66,7 @@ async def test_await_create_200_success_all_params() -> None: response = await client.v1.ai_image_upscaler.create( assets={"image_file_path": "api-assets/id/1234.png"}, scale_factor=2.0, - style={"enhancement": "Balanced", "prompt": "string"}, + style={"enhancement": "Balanced", "mode": "creative", "prompt": "string"}, name="My Image Upscaler image", ) try: