From e616217109d9c7bb3d23e3b640fd5f71969651ce Mon Sep 17 00:00:00 2001 From: Runbo Li Date: Sat, 10 Oct 2026 18:03:38 -0700 Subject: [PATCH 1/5] feat(copy): fix Python SDK starter and polling examples --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba805ce..9028380 100644 --- a/README.md +++ b/README.md @@ -105,11 +105,12 @@ The `generate()` function provides a complete end-to-end solution: ```python # Generate function - handles everything automatically response = client.v1.ai_image_generator.generate( + image_count=1, style={"prompt": "A beautiful sunset over mountains"}, name="Sunset Image", wait_for_completion=True, # Wait for status to be complete/error/canceled download_outputs=True, # Download files automatically - download_directory="./outputs/" # Where to save files + download_directory="." # Where to save files ) # You get both the API response AND downloaded file paths @@ -129,6 +130,7 @@ The `create()` function provides granular control: ```python # Create function - only starts the process create_response = client.v1.ai_image_generator.create( + image_count=1, style={"prompt": "A beautiful sunset over mountains"}, name="Sunset Image" ) @@ -139,7 +141,8 @@ print(f"Started project: {project_id}") # You must handle the rest: # 1. Poll for completion. We provide a helper function to handle polling for you -result = client.v1.image_projects.check_status( +result = client.v1.image_projects.check_result( + id=project_id, wait_for_completion=True, download_outputs=False, ) From e777552789d50660399e53852f4bc01c37066453 Mon Sep 17 00:00:00 2001 From: Runs Date: Sun, 11 Oct 2026 02:42:58 +0000 Subject: [PATCH 2/5] feat(copy): use Free-compatible SDK image starters --- .../resources/v1/ai_image_editor/README.md | 16 ++++++++++------ .../resources/v1/ai_image_generator/README.md | 16 +++++++++------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/magic_hour/resources/v1/ai_image_editor/README.md b/magic_hour/resources/v1/ai_image_editor/README.md index 57a0fde..073f460 100644 --- a/magic_hour/resources/v1/ai_image_editor/README.md +++ b/magic_hour/resources/v1/ai_image_editor/README.md @@ -34,6 +34,8 @@ client = Client(token=getenv("API_TOKEN")) res = client.v1.ai_image_editor.generate( assets={"image_file_paths": ["/path/to/1234.png"]}, style={"prompt": "Give me sunglasses"}, + model="flux-2-klein", + resolution="640px", name="Ai Image Editor image", wait_for_completion=True, download_outputs=True, @@ -51,6 +53,8 @@ client = AsyncClient(token=getenv("API_TOKEN")) res = await client.v1.ai_image_editor.generate( assets={"image_file_paths": ["/path/to/1234.png"]}, style={"prompt": "Give me sunglasses"}, + model="flux-2-klein", + resolution="640px", name="Ai Image Editor image", wait_for_completion=True, download_outputs=True, @@ -74,7 +78,7 @@ Edit images with AI. | `└─ image_file_path` | ✗ | Deprecated: Please use `image_file_paths` instead as edits with multiple images are now supported. The image used in the edit. 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. | `"string"` | | `└─ image_file_paths` | ✗ | The image(s) used in the edit, maximum of 10 images. 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", "api-assets/id/1235.png"]` | | `style` | ✓ | | `{"prompt": "Give me sunglasses"}` | -| `└─ model` | ✗ | Deprecated: Please use `model` instead. The AI model to use for image editing. * `Nano Banana` - Precise, realistic edits with consistent results * `Seedream` - Creative, imaginative images with artistic freedom * `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. | `"Nano Banana"` | +| `└─ model` | ✗ | Deprecated: Please use `model` instead. The AI model to use for image editing. _ `Nano Banana` - Precise, realistic edits with consistent results _ `Seedream` - Creative, imaginative images with artistic freedom \* `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. | `"Nano Banana"` | | `└─ prompt` | ✓ | The prompt used to edit the image. | `"Give me sunglasses"` | | `aspect_ratio` | ✗ | The aspect ratio of the output image(s). If not specified, defaults to `auto`. | `"1:1"` | | `image_count` | ✗ | Number of images to generate. Maximum varies by model. Defaults to 1 if not specified. | `1.0` | @@ -94,9 +98,9 @@ res = client.v1.ai_image_editor.create( style={"prompt": "Give me sunglasses"}, aspect_ratio="1:1", image_count=1.0, - model="default", + model="flux-2-klein", name="My Ai Image Editor image", - resolution="1k", + resolution="640px", ) ``` @@ -112,9 +116,9 @@ res = await client.v1.ai_image_editor.create( style={"prompt": "Give me sunglasses"}, aspect_ratio="1:1", image_count=1.0, - model="default", + model="flux-2-klein", name="My Ai Image Editor image", - resolution="1k", + resolution="640px", ) ``` @@ -127,5 +131,5 @@ res = await client.v1.ai_image_editor.create( ##### Example ```python -{"credits_charged": 50, "frame_cost": 123, "id": "cuid-example"} +{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"} ``` diff --git a/magic_hour/resources/v1/ai_image_generator/README.md b/magic_hour/resources/v1/ai_image_generator/README.md index d680716..c824eaf 100644 --- a/magic_hour/resources/v1/ai_image_generator/README.md +++ b/magic_hour/resources/v1/ai_image_generator/README.md @@ -38,9 +38,9 @@ res = client.v1.ai_image_generator.generate( "tool": "ai-anime-generator", }, aspect_ratio="1:1", - model="default", + model="z-image-turbo", name="My Ai Image image", - resolution="1k", + resolution="640px", wait_for_completion=True, download_outputs=True, download_directory="." @@ -56,6 +56,8 @@ from os import getenv client = AsyncClient(token=getenv("API_TOKEN")) res = await client.v1.ai_image_generator.generate( image_count=1, + model="z-image-turbo", + resolution="640px", aspect_ratio="16:9", style={"prompt": "Cool image", "tool": "ai-anime-generator"}, name="Ai Image image", @@ -99,9 +101,9 @@ res = client.v1.ai_image_generator.create( image_count=1, style={"prompt": "Cool image", "tool": "ai-anime-generator"}, aspect_ratio="1:1", - model="default", + model="z-image-turbo", name="My Ai Image image", - resolution="1k", + resolution="640px", ) ``` @@ -116,9 +118,9 @@ res = await client.v1.ai_image_generator.create( image_count=1, style={"prompt": "Cool image", "tool": "ai-anime-generator"}, aspect_ratio="1:1", - model="default", + model="z-image-turbo", name="My Ai Image image", - resolution="1k", + resolution="640px", ) ``` @@ -131,5 +133,5 @@ res = await client.v1.ai_image_generator.create( ##### Example ```python -{"credits_charged": 5, "frame_cost": 123, "id": "cuid-example"} +{"credits_charged": 5, "frame_cost": 5, "id": "cuid-example"} ``` From df1d27204113f42297a3b305839f8b5e99568df7 Mon Sep 17 00:00:00 2001 From: Runs Date: Sun, 11 Oct 2026 03:12:13 +0000 Subject: [PATCH 3/5] fix: correct upload-to-upscale example field --- magic_hour/resources/v1/files/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/magic_hour/resources/v1/files/client.py b/magic_hour/resources/v1/files/client.py index 9044d07..45d38ec 100644 --- a/magic_hour/resources/v1/files/client.py +++ b/magic_hour/resources/v1/files/client.py @@ -232,7 +232,7 @@ def upload_file( # Use the uploaded file in other API calls result = client.v1.ai_image_upscaler.create( - assets={"image_file_path": file_path}, style={"upscale_factor": 2} + assets={"image_file_path": file_path}, scale_factor=2 ) ``` @@ -360,7 +360,7 @@ async def upload_example(): # Use the uploaded file in other API calls result = await client.v1.ai_image_upscaler.create( - assets={"image_file_path": file_path}, style={"upscale_factor": 2} + assets={"image_file_path": file_path}, scale_factor=2 ) From 8db9390be1fa28aa6f79f996703b2912207c4ae3 Mon Sep 17 00:00:00 2001 From: Runs Date: Sun, 11 Oct 2026 03:40:59 +0000 Subject: [PATCH 4/5] feat(copy): clarify model-dependent image generation costs --- magic_hour/resources/v1/ai_image_editor/client.py | 4 ++-- magic_hour/resources/v1/ai_image_generator/client.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/magic_hour/resources/v1/ai_image_editor/client.py b/magic_hour/resources/v1/ai_image_editor/client.py index 12202a5..a76f4a8 100644 --- a/magic_hour/resources/v1/ai_image_editor/client.py +++ b/magic_hour/resources/v1/ai_image_editor/client.py @@ -80,7 +80,7 @@ def generate( """ Generate edited image (alias for create with additional functionality). - Edit image using AI. Each edit costs 5 credits. + Edit images using AI. Credit cost depends on the selected model and resolution. Args: name: The name of image. This value is mainly used for your own identification of the image. @@ -396,7 +396,7 @@ async def generate( """ Generate edited image (alias for create with additional functionality). - Edit image using AI. Each edit costs 5 credits. + Edit images using AI. Credit cost depends on the selected model and resolution. Args: name: The name of image. This value is mainly used for your own identification of the image. diff --git a/magic_hour/resources/v1/ai_image_generator/client.py b/magic_hour/resources/v1/ai_image_generator/client.py index 3efe4f4..40547cd 100644 --- a/magic_hour/resources/v1/ai_image_generator/client.py +++ b/magic_hour/resources/v1/ai_image_generator/client.py @@ -79,7 +79,7 @@ def generate( """ Generate AI images (alias for create with additional functionality). - Create AI images with text prompts. Each image costs 5 credits. + Create AI images with text prompts. Credit cost depends on model, resolution, and image count. Args: name: The name of image. This value is mainly used for your own identification of the image. @@ -387,7 +387,7 @@ async def generate( """ Generate AI images (alias for create with additional functionality). - Create AI images with text prompts. Each image costs 5 credits. + Create AI images with text prompts. Credit cost depends on model, resolution, and image count. Args: name: The name of image. This value is mainly used for your own identification of the image. From f98f72b56898fbf0dc35d62e019691dc875d16be Mon Sep 17 00:00:00 2001 From: Runs Date: Sun, 11 Oct 2026 05:41:29 +0000 Subject: [PATCH 5/5] fix: use supported face editor values in examples --- .../resources/v1/ai_face_editor/client.py | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/magic_hour/resources/v1/ai_face_editor/client.py b/magic_hour/resources/v1/ai_face_editor/client.py index a5d5c1b..1279292 100644 --- a/magic_hour/resources/v1/ai_face_editor/client.py +++ b/magic_hour/resources/v1/ai_face_editor/client.py @@ -60,20 +60,20 @@ def generate( assets={"image_file_path": "path/to/face.png"}, style={ "enhance_face": True, - "eye_gaze_horizontal": 0.2, - "eye_gaze_vertical": -0.1, - "eye_open_ratio": 0.8, - "eyebrow_direction": 0.3, - "head_pitch": 0.1, + "eye_gaze_horizontal": 20, + "eye_gaze_vertical": -10, + "eye_open_ratio": 80, + "eyebrow_direction": 30, + "head_pitch": 10, "head_roll": 0.0, - "head_yaw": -0.2, + "head_yaw": -20, "lip_open_ratio": 0.0, "mouth_grim": 0.0, "mouth_position_horizontal": 0.0, "mouth_position_vertical": 0.0, "mouth_pout": 0.0, "mouth_purse": 0.0, - "mouth_smile": 0.5, + "mouth_smile": 50, }, name="Face Editor image", wait_for_completion=True, @@ -212,20 +212,20 @@ async def generate( assets={"image_file_path": "path/to/face.png"}, style={ "enhance_face": True, - "eye_gaze_horizontal": 0.2, - "eye_gaze_vertical": -0.1, - "eye_open_ratio": 0.8, - "eyebrow_direction": 0.3, - "head_pitch": 0.1, + "eye_gaze_horizontal": 20, + "eye_gaze_vertical": -10, + "eye_open_ratio": 80, + "eyebrow_direction": 30, + "head_pitch": 10, "head_roll": 0.0, - "head_yaw": -0.2, + "head_yaw": -20, "lip_open_ratio": 0.0, "mouth_grim": 0.0, "mouth_position_horizontal": 0.0, "mouth_position_vertical": 0.0, "mouth_pout": 0.0, "mouth_purse": 0.0, - "mouth_smile": 0.5, + "mouth_smile": 50, }, name="Face Editor image", wait_for_completion=True,