Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .sdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "53e3a1c7-5db6-4850-bfe3-e16e89b5f60b",
"id": "3d0a471b-07ca-4e2e-85d9-7cff5b51eaa2",
"tracked_paths": [
{
"editable": true,
Expand Down
2 changes: 1 addition & 1 deletion magic_hour/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.71.0"
MOCK_SERVER = "https://api.sideko.dev/v1/mock/magichour/magic-hour/0.72.0"


def _get_base_url(
Expand Down
6 changes: 6 additions & 0 deletions magic_hour/resources/v1/ai_video_editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ For detailed examples, see the [product page](https://magichour.ai/products/vide
| `end_seconds` | ✓ | End time of your clip in seconds. Must be greater than `start_seconds`. Duration must be between 3 and 10 seconds. | `5.0` |
| `style` | ✓ | | `{"prompt": "Change the car color to blue"}` |
| `└─ prompt` | ✓ | The prompt used to edit the video. | `"Change the car color to blue"` |
| `model` | ✗ | Editing model. Defaults to `ltx-2.3` for free tier and `gemini-omni` for paid. Use `ltx-2.3` for LTX video edit. | `"gemini-omni"` |
| `name` | ✗ | Give your video a custom name for easy identification. | `"My Video Editor video"` |
| `resolution` | ✗ | Output resolution. Defaults to `480p` for free tier and `720p` for paid. Google Omni supports 720p only; LTX-2.3 supports 480p, 720p, and 1080p. | `"720p"` |
| `start_seconds` | ✗ | Start time of your clip (seconds). Must be ≥ 0. | `0.0` |

#### Synchronous Client
Expand All @@ -117,7 +119,9 @@ res = client.v1.ai_video_editor.create(
assets={"video_file_path": "api-assets/id/1234.mp4"},
end_seconds=5.0,
style={"prompt": "Change the car color to blue"},
model="gemini-omni",
name="My Video Editor video",
resolution="720p",
start_seconds=0.0,
)
```
Expand All @@ -133,7 +137,9 @@ res = await client.v1.ai_video_editor.create(
assets={"video_file_path": "api-assets/id/1234.mp4"},
end_seconds=5.0,
style={"prompt": "Change the car color to blue"},
model="gemini-omni",
name="My Video Editor video",
resolution="720p",
start_seconds=0.0,
)
```
Expand Down
45 changes: 45 additions & 0 deletions magic_hour/resources/v1/ai_video_editor/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import typing
import typing_extensions

from magic_hour.helpers.logger import get_sdk_logger
from magic_hour.resources.v1.files.client import AsyncFilesClient, FilesClient
Expand Down Expand Up @@ -30,9 +31,17 @@ def generate(
assets: params.V1AiVideoEditorGenerateBodyAssets,
end_seconds: float,
style: params.V1AiVideoEditorCreateBodyStyle,
model: typing.Union[
typing.Optional[typing_extensions.Literal["gemini-omni", "ltx-2.3"]],
type_utils.NotGiven,
] = type_utils.NOT_GIVEN,
name: typing.Union[
typing.Optional[str], type_utils.NotGiven
] = type_utils.NOT_GIVEN,
resolution: typing.Union[
typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
type_utils.NotGiven,
] = type_utils.NOT_GIVEN,
start_seconds: typing.Union[
typing.Optional[float], type_utils.NotGiven
] = type_utils.NOT_GIVEN,
Expand Down Expand Up @@ -106,9 +115,17 @@ def create(
assets: params.V1AiVideoEditorCreateBodyAssets,
end_seconds: float,
style: params.V1AiVideoEditorCreateBodyStyle,
model: typing.Union[
typing.Optional[typing_extensions.Literal["gemini-omni", "ltx-2.3"]],
type_utils.NotGiven,
] = type_utils.NOT_GIVEN,
name: typing.Union[
typing.Optional[str], type_utils.NotGiven
] = type_utils.NOT_GIVEN,
resolution: typing.Union[
typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
type_utils.NotGiven,
] = type_utils.NOT_GIVEN,
start_seconds: typing.Union[
typing.Optional[float], type_utils.NotGiven
] = type_utils.NOT_GIVEN,
Expand Down Expand Up @@ -143,7 +160,9 @@ def create(
POST /v1/ai-video-editor

Args:
model: Editing model. Defaults to `ltx-2.3` for free tier and `gemini-omni` for paid. Use `ltx-2.3` for LTX video edit.
name: Give your video a custom name for easy identification.
resolution: Output resolution. Defaults to `480p` for free tier and `720p` for paid. Google Omni supports 720p only; LTX-2.3 supports 480p, 720p, and 1080p.
start_seconds: Start time of your clip (seconds). Must be ≥ 0.
assets: Provide the assets for video editing.
end_seconds: End time of your clip in seconds. Must be greater than `start_seconds`. Duration must be between 3 and 10 seconds.
Expand All @@ -163,14 +182,18 @@ def create(
assets={"video_file_path": "api-assets/id/1234.mp4"},
end_seconds=5.0,
style={"prompt": "Change the car color to blue"},
model="gemini-omni",
name="My Video Editor video",
resolution="720p",
start_seconds=0.0,
)
```
"""
_json = to_encodable(
item={
"model": model,
"name": name,
"resolution": resolution,
"start_seconds": start_seconds,
"assets": assets,
"end_seconds": end_seconds,
Expand Down Expand Up @@ -198,9 +221,17 @@ async def generate(
assets: params.V1AiVideoEditorGenerateBodyAssets,
end_seconds: float,
style: params.V1AiVideoEditorCreateBodyStyle,
model: typing.Union[
typing.Optional[typing_extensions.Literal["gemini-omni", "ltx-2.3"]],
type_utils.NotGiven,
] = type_utils.NOT_GIVEN,
name: typing.Union[
typing.Optional[str], type_utils.NotGiven
] = type_utils.NOT_GIVEN,
resolution: typing.Union[
typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
type_utils.NotGiven,
] = type_utils.NOT_GIVEN,
start_seconds: typing.Union[
typing.Optional[float], type_utils.NotGiven
] = type_utils.NOT_GIVEN,
Expand Down Expand Up @@ -274,9 +305,17 @@ async def create(
assets: params.V1AiVideoEditorCreateBodyAssets,
end_seconds: float,
style: params.V1AiVideoEditorCreateBodyStyle,
model: typing.Union[
typing.Optional[typing_extensions.Literal["gemini-omni", "ltx-2.3"]],
type_utils.NotGiven,
] = type_utils.NOT_GIVEN,
name: typing.Union[
typing.Optional[str], type_utils.NotGiven
] = type_utils.NOT_GIVEN,
resolution: typing.Union[
typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]],
type_utils.NotGiven,
] = type_utils.NOT_GIVEN,
start_seconds: typing.Union[
typing.Optional[float], type_utils.NotGiven
] = type_utils.NOT_GIVEN,
Expand Down Expand Up @@ -311,7 +350,9 @@ async def create(
POST /v1/ai-video-editor

Args:
model: Editing model. Defaults to `ltx-2.3` for free tier and `gemini-omni` for paid. Use `ltx-2.3` for LTX video edit.
name: Give your video a custom name for easy identification.
resolution: Output resolution. Defaults to `480p` for free tier and `720p` for paid. Google Omni supports 720p only; LTX-2.3 supports 480p, 720p, and 1080p.
start_seconds: Start time of your clip (seconds). Must be ≥ 0.
assets: Provide the assets for video editing.
end_seconds: End time of your clip in seconds. Must be greater than `start_seconds`. Duration must be between 3 and 10 seconds.
Expand All @@ -331,14 +372,18 @@ async def create(
assets={"video_file_path": "api-assets/id/1234.mp4"},
end_seconds=5.0,
style={"prompt": "Change the car color to blue"},
model="gemini-omni",
name="My Video Editor video",
resolution="720p",
start_seconds=0.0,
)
```
"""
_json = to_encodable(
item={
"model": model,
"name": name,
"resolution": resolution,
"start_seconds": start_seconds,
"assets": assets,
"end_seconds": end_seconds,
Expand Down
20 changes: 20 additions & 0 deletions magic_hour/types/params/v1_ai_video_editor_create_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,25 @@ class V1AiVideoEditorCreateBody(typing_extensions.TypedDict):
End time of your clip in seconds. Must be greater than `start_seconds`. Duration must be between 3 and 10 seconds.
"""

model: typing_extensions.NotRequired[
typing_extensions.Literal["gemini-omni", "ltx-2.3"]
]
"""
Editing model. Defaults to `ltx-2.3` for free tier and `gemini-omni` for paid. Use `ltx-2.3` for LTX video edit.
"""

name: typing_extensions.NotRequired[str]
"""
Give your video a custom name for easy identification.
"""

resolution: typing_extensions.NotRequired[
typing_extensions.Literal["1080p", "480p", "720p"]
]
"""
Output resolution. Defaults to `480p` for free tier and `720p` for paid. Google Omni supports 720p only; LTX-2.3 supports 480p, 720p, and 1080p.
"""

start_seconds: typing_extensions.NotRequired[float]
"""
Start time of your clip (seconds). Must be ≥ 0.
Expand All @@ -56,7 +70,13 @@ class _SerializerV1AiVideoEditorCreateBody(pydantic.BaseModel):
end_seconds: float = pydantic.Field(
alias="end_seconds",
)
model: typing.Optional[typing_extensions.Literal["gemini-omni", "ltx-2.3"]] = (
pydantic.Field(alias="model", default=None)
)
name: typing.Optional[str] = pydantic.Field(alias="name", default=None)
resolution: typing.Optional[typing_extensions.Literal["1080p", "480p", "720p"]] = (
pydantic.Field(alias="resolution", default=None)
)
start_seconds: typing.Optional[float] = pydantic.Field(
alias="start_seconds", default=None
)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "magic_hour"
version = "0.71.0"
version = "0.72.0"
description = "Python SDK for Magic Hour API"
readme = "README.md"
authors = []
Expand Down
4 changes: 4 additions & 0 deletions tests/test_v1_ai_video_editor_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def test_create_200_success_all_params() -> None:
assets={"video_file_path": "api-assets/id/1234.mp4"},
end_seconds=5.0,
style={"prompt": "Change the car color to blue"},
model="gemini-omni",
name="My Video Editor video",
resolution="720p",
start_seconds=0.0,
)
try:
Expand Down Expand Up @@ -68,7 +70,9 @@ async def test_await_create_200_success_all_params() -> None:
assets={"video_file_path": "api-assets/id/1234.mp4"},
end_seconds=5.0,
style={"prompt": "Change the car color to blue"},
model="gemini-omni",
name="My Video Editor video",
resolution="720p",
start_seconds=0.0,
)
try:
Expand Down
Loading