diff --git a/.sdk.json b/.sdk.json index c2bdf65..8601f01 100644 --- a/.sdk.json +++ b/.sdk.json @@ -1,5 +1,5 @@ { - "id": "c90fe09f-b516-4af0-b41b-381e051eba94", + "id": "e010c44a-5d62-41e2-b0fe-654712dd6457", "tracked_paths": [ { "editable": true, diff --git a/magic_hour/environment.py b/magic_hour/environment.py index 4864771..e4e93f9 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.56.0" + MOCK_SERVER = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.57.0" def _get_base_url( diff --git a/magic_hour/resources/v1/ai_image_editor/README.md b/magic_hour/resources/v1/ai_image_editor/README.md index 18f4559..277678e 100644 --- a/magic_hour/resources/v1/ai_image_editor/README.md +++ b/magic_hour/resources/v1/ai_image_editor/README.md @@ -80,6 +80,7 @@ Edit images with AI. | `image_count` | ✗ | Number of images to generate. Maximum varies by model. Defaults to 1 if not specified. | `1.0` | | `model` | ✗ | The AI model to use for image editing. Each model has different capabilities and costs. **Models:** - `default` - Use the model we recommend, which will change over time. This is recommended unless you need a specific model. This is the default behavior. - `qwen-edit` - 10 credits/image - Available for tiers: free, creator, pro, business - Image count allowed: 1 - Max additional input images: 2 - `nano-banana` - 50 credits/image - Available for tiers: free, creator, pro, business - Image count allowed: 1 - Max additional input images: 9 - `nano-banana-2` - 100 credits/image - Available for tiers: free, creator, pro, business - Image count allowed: 1 - Max additional input images: 9 - `seedream-v4` - 50 credits/image - Available for tiers: free, creator, pro, business - Image count allowed: 1 - Max additional input images: 9 - `nano-banana-pro` - 150 credits/image - Available for tiers: creator, pro, business - Image count allowed: 1, 4, 9, 16 - Max additional input images: 9 - `seedream-v4.5` - 100 credits/image - Available for tiers: creator, pro, business - Image count allowed: 1 - Max additional input images: 9 | `"default"` | | `name` | ✗ | Give your image a custom name for easy identification. | `"My Ai Image Editor image"` | +| `resolution` | ✗ | Maximum resolution for the generated image. **Options:** - `auto` - Automatic resolution (all tiers, default) - `2k` - Up to 2048px (requires Pro or Business tier) - `4k` - Up to 4096px (requires Business tier) Note: Resolution availability depends on your subscription tier. Defaults to `auto` if not specified. | `"auto"` | #### Synchronous Client @@ -95,6 +96,7 @@ res = client.v1.ai_image_editor.create( image_count=1.0, model="default", name="My Ai Image Editor image", + resolution="auto", ) ``` @@ -112,6 +114,7 @@ res = await client.v1.ai_image_editor.create( image_count=1.0, model="default", name="My Ai Image Editor image", + resolution="auto", ) ``` diff --git a/magic_hour/resources/v1/ai_image_editor/client.py b/magic_hour/resources/v1/ai_image_editor/client.py index b639a59..bccea52 100644 --- a/magic_hour/resources/v1/ai_image_editor/client.py +++ b/magic_hour/resources/v1/ai_image_editor/client.py @@ -57,6 +57,10 @@ def generate( name: typing.Union[ typing.Optional[str], type_utils.NotGiven ] = type_utils.NOT_GIVEN, + resolution: typing.Union[ + typing.Optional[typing_extensions.Literal["2k", "4k", "auto"]], + type_utils.NotGiven, + ] = type_utils.NOT_GIVEN, wait_for_completion: bool = True, download_outputs: bool = True, download_directory: typing.Optional[str] = None, @@ -112,6 +116,7 @@ def generate( image_count=image_count, model=model, name=name, + resolution=resolution, request_options=request_options, ) logger.info(f"AI Image Editor response: {create_response}") @@ -159,6 +164,10 @@ def create( name: typing.Union[ typing.Optional[str], type_utils.NotGiven ] = type_utils.NOT_GIVEN, + resolution: typing.Union[ + typing.Optional[typing_extensions.Literal["2k", "4k", "auto"]], + type_utils.NotGiven, + ] = type_utils.NOT_GIVEN, request_options: typing.Optional[RequestOptions] = None, ) -> models.V1AiImageEditorCreateResponse: """ @@ -201,6 +210,14 @@ def create( - Max additional input images: 9 name: Give your image a custom name for easy identification. + resolution: Maximum resolution for the generated image. + + **Options:** + - `auto` - Automatic resolution (all tiers, default) + - `2k` - Up to 2048px (requires Pro or Business tier) + - `4k` - Up to 4096px (requires Business tier) + + Note: Resolution availability depends on your subscription tier. Defaults to `auto` if not specified. assets: Provide the assets for image edit style: V1AiImageEditorCreateBodyStyle request_options: Additional options to customize the HTTP request @@ -223,6 +240,7 @@ def create( image_count=1.0, model="default", name="My Ai Image Editor image", + resolution="auto", ) ``` """ @@ -232,6 +250,7 @@ def create( "image_count": image_count, "model": model, "name": name, + "resolution": resolution, "assets": assets, "style": style, }, @@ -283,6 +302,10 @@ async def generate( ], type_utils.NotGiven, ] = type_utils.NOT_GIVEN, + resolution: typing.Union[ + typing.Optional[typing_extensions.Literal["2k", "4k", "auto"]], + type_utils.NotGiven, + ] = type_utils.NOT_GIVEN, wait_for_completion: bool = True, download_outputs: bool = True, download_directory: typing.Optional[str] = None, @@ -340,6 +363,7 @@ async def generate( aspect_ratio=aspect_ratio, image_count=image_count, model=model, + resolution=resolution, request_options=request_options, ) logger.info(f"AI Image Editor response: {create_response}") @@ -387,6 +411,10 @@ async def create( name: typing.Union[ typing.Optional[str], type_utils.NotGiven ] = type_utils.NOT_GIVEN, + resolution: typing.Union[ + typing.Optional[typing_extensions.Literal["2k", "4k", "auto"]], + type_utils.NotGiven, + ] = type_utils.NOT_GIVEN, request_options: typing.Optional[RequestOptions] = None, ) -> models.V1AiImageEditorCreateResponse: """ @@ -429,6 +457,14 @@ async def create( - Max additional input images: 9 name: Give your image a custom name for easy identification. + resolution: Maximum resolution for the generated image. + + **Options:** + - `auto` - Automatic resolution (all tiers, default) + - `2k` - Up to 2048px (requires Pro or Business tier) + - `4k` - Up to 4096px (requires Business tier) + + Note: Resolution availability depends on your subscription tier. Defaults to `auto` if not specified. assets: Provide the assets for image edit style: V1AiImageEditorCreateBodyStyle request_options: Additional options to customize the HTTP request @@ -451,6 +487,7 @@ async def create( image_count=1.0, model="default", name="My Ai Image Editor image", + resolution="auto", ) ``` """ @@ -460,6 +497,7 @@ async def create( "image_count": image_count, "model": model, "name": name, + "resolution": resolution, "assets": assets, "style": style, }, diff --git a/magic_hour/resources/v1/ai_image_generator/README.md b/magic_hour/resources/v1/ai_image_generator/README.md index 937ce97..8f93449 100644 --- a/magic_hour/resources/v1/ai_image_generator/README.md +++ b/magic_hour/resources/v1/ai_image_generator/README.md @@ -75,18 +75,18 @@ Create an AI image with advanced model selection and quality controls. #### Parameters -| Parameter | Required | Deprecated | Description | Example | -| ----------------- | :------: | :--------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- | -| `image_count` | ✓ | ✗ | Number of images to generate. Maximum varies by model. | `1` | -| `style` | ✓ | ✗ | The art style to use for image generation. | `{"prompt": "Cool image", "tool": "ai-anime-generator"}` | -| `└─ prompt` | ✓ | — | The prompt used for the image(s). | `"Cool image"` | -| `└─ quality_mode` | ✗ | ✓ | DEPRECATED: Use `model` field instead for explicit model selection. Legacy quality mode mapping: - `standard` → `z-image-turbo` model - `pro` → `seedream` model If model is specified, it will take precedence over the legacy quality_mode field. | `"pro"` | -| `└─ tool` | ✗ | — | The art style to use for image generation. Defaults to 'general' if not provided. | `"ai-anime-generator"` | -| `aspect_ratio` | ✗ | ✗ | The aspect ratio of the output image(s). If not specified, defaults to `1:1` (square). | `"1:1"` | -| `model` | ✗ | ✗ | The AI model to use for image generation. Each model has different capabilities and costs. **Models:** - `default` - Use the model we recommend, which will change over time. This is recommended unless you need a specific model. This is the default behavior. - `flux-schnell` - 5 credits/image - Supported resolutions: auto - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `z-image-turbo` - 5 credits/image - Supported resolutions: auto, 2k - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `seedream` - 30 credits/image - Supported resolutions: auto, 2k, 4k - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana` - 50 credits/image - Supported resolutions: auto - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-2` - 100 credits/image - Supported resolutions: auto - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-pro` - 150 credits/image - Supported resolutions: auto - Available for tiers: creator, pro, business - Image count allowed: 1, 4, 9, 16 | `"default"` | -| `name` | ✗ | ✗ | Give your image a custom name for easy identification. | `"My Ai Image image"` | -| `orientation` | ✗ | ✓ | DEPRECATED: Use `aspect_ratio` instead. The orientation of the output image(s). `aspect_ratio` takes precedence when `orientation` if both are provided. | `"landscape"` | -| `resolution` | ✗ | ✗ | Maximum resolution for the generated image. **Options:** - `auto` - Automatic resolution (all tiers, default) - `2k` - Up to 2048px (requires Pro or Business tier) - `4k` - Up to 4096px (requires Business tier) Note: Resolution availability depends on the model and your subscription tier. See `model` field for which resolutions each model supports. Defaults to `auto` if not specified. | `"auto"` | +| Parameter | Required | Deprecated | Description | Example | +| ----------------- | :------: | :--------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | +| `image_count` | ✓ | ✗ | Number of images to generate. Maximum varies by model. | `1` | +| `style` | ✓ | ✗ | The art style to use for image generation. | `{"prompt": "Cool image", "tool": "ai-anime-generator"}` | +| `└─ prompt` | ✓ | — | The prompt used for the image(s). | `"Cool image"` | +| `└─ quality_mode` | ✗ | ✓ | DEPRECATED: Use `model` field instead for explicit model selection. Legacy quality mode mapping: - `standard` → `z-image-turbo` model - `pro` → `seedream` model If model is specified, it will take precedence over the legacy quality_mode field. | `"pro"` | +| `└─ tool` | ✗ | — | The art style to use for image generation. Defaults to 'general' if not provided. | `"ai-anime-generator"` | +| `aspect_ratio` | ✗ | ✗ | The aspect ratio of the output image(s). If not specified, defaults to `1:1` (square). | `"1:1"` | +| `model` | ✗ | ✗ | The AI model to use for image generation. Each model has different capabilities and costs. **Models:** - `default` - Use the model we recommend, which will change over time. This is recommended unless you need a specific model. This is the default behavior. - `flux-schnell` - 5 credits/image - Supported resolutions: auto - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `z-image-turbo` - 5 credits/image - Supported resolutions: auto, 2k - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `seedream` - 30 credits/image - Supported resolutions: auto, 2k, 4k - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana` - 50 credits/image - Supported resolutions: auto - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-2` - 100 credits/image - Supported resolutions: auto, 2k, 4k - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-pro` - 150 credits/image - Supported resolutions: auto, 2k, 4k - Available for tiers: creator, pro, business - Image count allowed: 1, 4, 9, 16 | `"default"` | +| `name` | ✗ | ✗ | Give your image a custom name for easy identification. | `"My Ai Image image"` | +| `orientation` | ✗ | ✓ | DEPRECATED: Use `aspect_ratio` instead. The orientation of the output image(s). `aspect_ratio` takes precedence when `orientation` if both are provided. | `"landscape"` | +| `resolution` | ✗ | ✗ | Maximum resolution for the generated image. **Options:** - `auto` - Automatic resolution (all tiers, default) - `2k` - Up to 2048px (requires Pro or Business tier) - `4k` - Up to 4096px (requires Business tier) Note: Resolution availability depends on the model and your subscription tier. See `model` field for which resolutions each model supports. Defaults to `auto` if not specified. | `"auto"` | #### Synchronous Client diff --git a/magic_hour/resources/v1/ai_image_generator/client.py b/magic_hour/resources/v1/ai_image_generator/client.py index 4a1e354..6a4ffa1 100644 --- a/magic_hour/resources/v1/ai_image_generator/client.py +++ b/magic_hour/resources/v1/ai_image_generator/client.py @@ -186,11 +186,11 @@ def create( - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-2` - 100 credits/image - - Supported resolutions: auto + - Supported resolutions: auto, 2k, 4k - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-pro` - 150 credits/image - - Supported resolutions: auto + - Supported resolutions: auto, 2k, 4k - Available for tiers: creator, pro, business - Image count allowed: 1, 4, 9, 16 @@ -411,11 +411,11 @@ async def create( - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-2` - 100 credits/image - - Supported resolutions: auto + - Supported resolutions: auto, 2k, 4k - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-pro` - 150 credits/image - - Supported resolutions: auto + - Supported resolutions: auto, 2k, 4k - Available for tiers: creator, pro, business - Image count allowed: 1, 4, 9, 16 diff --git a/magic_hour/resources/v1/face_swap_photo/README.md b/magic_hour/resources/v1/face_swap_photo/README.md index 67b3523..3968fa7 100644 --- a/magic_hour/resources/v1/face_swap_photo/README.md +++ b/magic_hour/resources/v1/face_swap_photo/README.md @@ -80,7 +80,7 @@ res = await client.v1.face_swap_photo.generate( ### Face Swap Photo -Create a face swap photo. Each photo costs 5 credits. The height/width of the output image depends on your subscription. Please refer to our [pricing](https://magichour.ai/pricing) page for more details +Create a face swap photo. Each photo costs 10 credits. The height/width of the output image depends on your subscription. Please refer to our [pricing](https://magichour.ai/pricing) page for more details **API Endpoint**: `POST /v1/face-swap-photo` @@ -150,5 +150,5 @@ res = await client.v1.face_swap_photo.create( ##### Example ```python -{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"} +{"credits_charged": 10, "frame_cost": 10, "id": "cuid-example"} ``` diff --git a/magic_hour/resources/v1/face_swap_photo/client.py b/magic_hour/resources/v1/face_swap_photo/client.py index faf78a2..24bb377 100644 --- a/magic_hour/resources/v1/face_swap_photo/client.py +++ b/magic_hour/resources/v1/face_swap_photo/client.py @@ -115,7 +115,7 @@ def create( """ Face Swap Photo - Create a face swap photo. Each photo costs 5 credits. The height/width of the output image depends on your subscription. Please refer to our [pricing](https://magichour.ai/pricing) page for more details + Create a face swap photo. Each photo costs 10 credits. The height/width of the output image depends on your subscription. Please refer to our [pricing](https://magichour.ai/pricing) page for more details POST /v1/face-swap-photo @@ -262,7 +262,7 @@ async def create( """ Face Swap Photo - Create a face swap photo. Each photo costs 5 credits. The height/width of the output image depends on your subscription. Please refer to our [pricing](https://magichour.ai/pricing) page for more details + Create a face swap photo. Each photo costs 10 credits. The height/width of the output image depends on your subscription. Please refer to our [pricing](https://magichour.ai/pricing) page for more details POST /v1/face-swap-photo diff --git a/magic_hour/types/params/v1_ai_image_editor_create_body.py b/magic_hour/types/params/v1_ai_image_editor_create_body.py index fd1c939..e24cfd3 100644 --- a/magic_hour/types/params/v1_ai_image_editor_create_body.py +++ b/magic_hour/types/params/v1_ai_image_editor_create_body.py @@ -84,6 +84,20 @@ class V1AiImageEditorCreateBody(typing_extensions.TypedDict): Give your image a custom name for easy identification. """ + resolution: typing_extensions.NotRequired[ + typing_extensions.Literal["2k", "4k", "auto"] + ] + """ + Maximum resolution for the generated image. + + **Options:** + - `auto` - Automatic resolution (all tiers, default) + - `2k` - Up to 2048px (requires Pro or Business tier) + - `4k` - Up to 4096px (requires Business tier) + + Note: Resolution availability depends on your subscription tier. Defaults to `auto` if not specified. + """ + style: typing_extensions.Required[V1AiImageEditorCreateBodyStyle] @@ -120,6 +134,9 @@ class _SerializerV1AiImageEditorCreateBody(pydantic.BaseModel): ] ] = pydantic.Field(alias="model", default=None) name: typing.Optional[str] = pydantic.Field(alias="name", default=None) + resolution: typing.Optional[typing_extensions.Literal["2k", "4k", "auto"]] = ( + pydantic.Field(alias="resolution", default=None) + ) style: _SerializerV1AiImageEditorCreateBodyStyle = pydantic.Field( alias="style", ) diff --git a/magic_hour/types/params/v1_ai_image_generator_create_body.py b/magic_hour/types/params/v1_ai_image_generator_create_body.py index efead02..cb51304 100644 --- a/magic_hour/types/params/v1_ai_image_generator_create_body.py +++ b/magic_hour/types/params/v1_ai_image_generator_create_body.py @@ -58,11 +58,11 @@ class V1AiImageGeneratorCreateBody(typing_extensions.TypedDict): - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-2` - 100 credits/image - - Supported resolutions: auto + - Supported resolutions: auto, 2k, 4k - Available for tiers: free, creator, pro, business - Image count allowed: 1, 2, 3, 4 - `nano-banana-pro` - 150 credits/image - - Supported resolutions: auto + - Supported resolutions: auto, 2k, 4k - Available for tiers: creator, pro, business - Image count allowed: 1, 4, 9, 16 diff --git a/pyproject.toml b/pyproject.toml index 9b512b2..00ad950 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "magic_hour" -version = "0.56.0" +version = "0.57.0" description = "Python SDK for Magic Hour API" readme = "README.md" authors = [] diff --git a/tests/test_v1_ai_image_editor_client.py b/tests/test_v1_ai_image_editor_client.py index e77426c..4ff86c0 100644 --- a/tests/test_v1_ai_image_editor_client.py +++ b/tests/test_v1_ai_image_editor_client.py @@ -36,6 +36,7 @@ def test_create_200_success_all_params() -> None: image_count=1.0, model="default", name="My Ai Image Editor image", + resolution="auto", ) try: pydantic.TypeAdapter(models.V1AiImageEditorCreateResponse).validate_python( @@ -78,6 +79,7 @@ async def test_await_create_200_success_all_params() -> None: image_count=1.0, model="default", name="My Ai Image Editor image", + resolution="auto", ) try: pydantic.TypeAdapter(models.V1AiImageEditorCreateResponse).validate_python(