runapi-runway-aleph 0.1.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.
- runapi/runway_aleph/__init__.py +24 -0
- runapi/runway_aleph/client.py +29 -0
- runapi/runway_aleph/contract_gen.py +21 -0
- runapi/runway_aleph/py.typed +0 -0
- runapi/runway_aleph/resources/__init__.py +3 -0
- runapi/runway_aleph/resources/edit_video.py +39 -0
- runapi/runway_aleph/types.py +37 -0
- runapi_runway_aleph-0.1.0.dist-info/METADATA +81 -0
- runapi_runway_aleph-0.1.0.dist-info/RECORD +10 -0
- runapi_runway_aleph-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Runway Aleph client for RunAPI."""
|
|
2
|
+
|
|
3
|
+
from runapi.core import (
|
|
4
|
+
AuthenticationError,
|
|
5
|
+
InsufficientCreditsError,
|
|
6
|
+
NotFoundError,
|
|
7
|
+
RateLimitError,
|
|
8
|
+
TaskFailedError,
|
|
9
|
+
TaskTimeoutError,
|
|
10
|
+
ValidationError,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
from .client import RunwayAlephClient
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"RunwayAlephClient",
|
|
17
|
+
"AuthenticationError",
|
|
18
|
+
"RateLimitError",
|
|
19
|
+
"InsufficientCreditsError",
|
|
20
|
+
"NotFoundError",
|
|
21
|
+
"ValidationError",
|
|
22
|
+
"TaskFailedError",
|
|
23
|
+
"TaskTimeoutError",
|
|
24
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Runway Aleph client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Optional
|
|
6
|
+
|
|
7
|
+
from runapi.core import ClientOptions, HttpClient, resolve_api_key
|
|
8
|
+
|
|
9
|
+
from .resources.edit_video import EditVideo
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class RunwayAlephClient:
|
|
13
|
+
"""Runway Aleph prompt-guided video editing client.
|
|
14
|
+
|
|
15
|
+
Example::
|
|
16
|
+
|
|
17
|
+
client = RunwayAlephClient(api_key="sk-...")
|
|
18
|
+
result = client.edit_video.run(
|
|
19
|
+
model="runway-aleph",
|
|
20
|
+
prompt="Transform the scene into a watercolor painting style",
|
|
21
|
+
source_video_url="https://cdn.runapi.ai/public/samples/video.mp4",
|
|
22
|
+
)
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(self, api_key: Optional[str] = None, **options: Any) -> None:
|
|
26
|
+
resolved_api_key = resolve_api_key(api_key)
|
|
27
|
+
client_options = ClientOptions(api_key=resolved_api_key, **options)
|
|
28
|
+
http = client_options.http_client or HttpClient(client_options)
|
|
29
|
+
self.edit_video = EditVideo(http)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
CONTRACT = {
|
|
2
|
+
"edit-video": {
|
|
3
|
+
"models": ["runway-aleph"],
|
|
4
|
+
"fields_by_model": {
|
|
5
|
+
"runway-aleph": {
|
|
6
|
+
"aspect_ratio": {
|
|
7
|
+
"enum": ["16:9", "9:16", "4:3", "3:4", "1:1", "21:9"]
|
|
8
|
+
},
|
|
9
|
+
"prompt": {
|
|
10
|
+
"required": True
|
|
11
|
+
},
|
|
12
|
+
"seed": {
|
|
13
|
+
"type": "integer"
|
|
14
|
+
},
|
|
15
|
+
"source_video_url": {
|
|
16
|
+
"required": True
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Runway Aleph edit-video resource."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from runapi.core import Resource
|
|
8
|
+
|
|
9
|
+
from ..contract_gen import CONTRACT
|
|
10
|
+
from ..types import (
|
|
11
|
+
CompletedEditVideoResponse,
|
|
12
|
+
TaskCreateResponse,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class EditVideo(Resource):
|
|
17
|
+
"""Prompt-guided video editing with Runway Aleph."""
|
|
18
|
+
|
|
19
|
+
ENDPOINT = "/api/v1/runway_aleph/edit_video"
|
|
20
|
+
|
|
21
|
+
RESPONSE_CLASS = TaskCreateResponse
|
|
22
|
+
COMPLETED_RESPONSE_CLASS = CompletedEditVideoResponse
|
|
23
|
+
|
|
24
|
+
MODEL = "runway-aleph"
|
|
25
|
+
|
|
26
|
+
def run(self, **params: Any) -> Any:
|
|
27
|
+
"""Create a task and poll until it completes."""
|
|
28
|
+
task = self.create(**params)
|
|
29
|
+
return self._poll_until_complete(lambda: self.get(task.id))
|
|
30
|
+
|
|
31
|
+
def create(self, **params: Any) -> Any:
|
|
32
|
+
"""Create an edit-video task and return immediately with an ``id``."""
|
|
33
|
+
compacted = self._compact_params(params)
|
|
34
|
+
self._validate_contract(CONTRACT["edit-video"], {**compacted, "model": self.MODEL})
|
|
35
|
+
return self._request("post", self.ENDPOINT, body=compacted)
|
|
36
|
+
|
|
37
|
+
def get(self, id: str) -> Any:
|
|
38
|
+
"""Fetch the current status of an edit-video task."""
|
|
39
|
+
return self._request("get", f"{self.ENDPOINT}/{id}")
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Runway Aleph enums and response models."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from runapi.core import BaseModel, TaskResponse, optional, required
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Video(BaseModel):
|
|
9
|
+
id = optional(str)
|
|
10
|
+
url = required(str)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Image(BaseModel):
|
|
14
|
+
url = required(str)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class EditVideoResponse(TaskResponse):
|
|
18
|
+
"""Runway Aleph video editing task status response."""
|
|
19
|
+
|
|
20
|
+
id = required(str)
|
|
21
|
+
status = optional(str, enum=lambda: TaskResponse.Status.ALL)
|
|
22
|
+
videos = optional([lambda: Video])
|
|
23
|
+
images = optional([lambda: Image])
|
|
24
|
+
error = optional(str)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class TaskCreateResponse(EditVideoResponse):
|
|
28
|
+
"""Runway Aleph task creation response with an id."""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class CompletedEditVideoResponse(EditVideoResponse):
|
|
32
|
+
"""Returned by ``edit_video.run()`` once polling observes completion.
|
|
33
|
+
|
|
34
|
+
``videos`` is required so callers never have to null-check it on success.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
videos = required([lambda: Video])
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: runapi-runway-aleph
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Runway Aleph prompt-guided video editing client for RunAPI
|
|
5
|
+
Project-URL: Homepage, https://runapi.ai/models/runway-aleph
|
|
6
|
+
Project-URL: Documentation, https://runapi.ai/docs#sdk-runway-aleph
|
|
7
|
+
Author-email: RunAPI <contact@runapi.ai>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Keywords: ai,runapi,runway,runway-aleph,sdk,video
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Requires-Dist: runapi-core
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Runway Aleph Python SDK for RunAPI
|
|
15
|
+
|
|
16
|
+
The Runway Aleph Python SDK is the language-specific package for Runway Aleph on
|
|
17
|
+
RunAPI. Use it for prompt-guided video editing when your application needs JSON
|
|
18
|
+
request bodies, task status lookup, and consistent RunAPI errors in Python.
|
|
19
|
+
|
|
20
|
+
For model details, use https://runapi.ai/models/runway-aleph; for API reference,
|
|
21
|
+
use https://runapi.ai/docs#runway-aleph; for SDK docs, use
|
|
22
|
+
https://runapi.ai/docs#sdk-runway-aleph.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install runapi-runway-aleph
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from runapi.runway_aleph import RunwayAlephClient
|
|
34
|
+
|
|
35
|
+
client = RunwayAlephClient() # reads RUNAPI_API_KEY, or pass api_key="sk-..."
|
|
36
|
+
|
|
37
|
+
task = client.edit_video.create(
|
|
38
|
+
model="runway-aleph",
|
|
39
|
+
prompt="Transform the scene into a watercolor painting style",
|
|
40
|
+
source_video_url="https://cdn.runapi.ai/public/samples/video.mp4",
|
|
41
|
+
)
|
|
42
|
+
status = client.edit_video.get(task.id)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Use `create` to submit a task and return quickly, `get` to fetch the latest task
|
|
46
|
+
state, and `run` to create and poll until completion:
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
result = client.edit_video.run(
|
|
50
|
+
model="runway-aleph",
|
|
51
|
+
prompt="Transform the scene into a watercolor painting style",
|
|
52
|
+
source_video_url="https://cdn.runapi.ai/public/samples/video.mp4",
|
|
53
|
+
)
|
|
54
|
+
print(result.videos[0].url)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
In web request handlers, prefer `create` plus webhook or later `get` polling so a
|
|
58
|
+
worker is not held open.
|
|
59
|
+
|
|
60
|
+
RunAPI-generated file URLs are temporary. Download and store generated videos in
|
|
61
|
+
your own durable storage within 7 days; do not treat returned URLs as long-term
|
|
62
|
+
assets.
|
|
63
|
+
|
|
64
|
+
## Language notes
|
|
65
|
+
|
|
66
|
+
Pass parameters as keyword arguments and catch the `runapi.runway_aleph` error
|
|
67
|
+
classes when building video jobs, workers, or scripts. The available resource is
|
|
68
|
+
`edit_video`. Keep `RUNAPI_API_KEY` in the environment or your secret manager;
|
|
69
|
+
never commit API keys or callback secrets.
|
|
70
|
+
|
|
71
|
+
## Links
|
|
72
|
+
|
|
73
|
+
- Model page: https://runapi.ai/models/runway-aleph
|
|
74
|
+
- SDK docs: https://runapi.ai/docs#sdk-runway-aleph
|
|
75
|
+
- Product docs: https://runapi.ai/docs#runway-aleph
|
|
76
|
+
- Pricing and rate limits: https://runapi.ai/models/runway-aleph
|
|
77
|
+
- Full catalog: https://runapi.ai/models
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
Licensed under the Apache License, Version 2.0.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
runapi/runway_aleph/__init__.py,sha256=XBMwewKDb6uX-Q9CjfHdMCY3gkvcW9ymtP8f_fDypi8,476
|
|
2
|
+
runapi/runway_aleph/client.py,sha256=fdRAy5kURdONFEnfpVlYk9oHyCr5NVFzHUEWAFkJFDo,930
|
|
3
|
+
runapi/runway_aleph/contract_gen.py,sha256=29JMHJciIZxcu4GDjs2C6ttMXmSz4PwJqmZtH3hnHA4,547
|
|
4
|
+
runapi/runway_aleph/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
runapi/runway_aleph/types.py,sha256=6oHjwqfMNiFBs2BNIQI2fvfeyZv1M-oY5ASsraWBM_w,928
|
|
6
|
+
runapi/runway_aleph/resources/__init__.py,sha256=cI9Ydn4h0zTbPbW1BJoAI20vYcHdoJ8JB8wB7bmtIOs,59
|
|
7
|
+
runapi/runway_aleph/resources/edit_video.py,sha256=r8snBWNiLtNu_1i85ycZU0csi8fSDbyXoJBb8HaHo-g,1210
|
|
8
|
+
runapi_runway_aleph-0.1.0.dist-info/METADATA,sha256=6aMKKyJswKDKsSJQWBoI2asrcnPTezlg0aMfi57Q7Rc,2679
|
|
9
|
+
runapi_runway_aleph-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
10
|
+
runapi_runway_aleph-0.1.0.dist-info/RECORD,,
|