runapi-pixverse 0.1.2__tar.gz → 0.4.0__tar.gz

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.
@@ -1,19 +1,25 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: runapi-pixverse
3
- Version: 0.1.2
3
+ Version: 0.4.0
4
4
  Summary: RunAPI PixVerse SDK for text-to-video, image-to-video, reference editing, transitions, and video extension in JavaScript, Python, Ruby, Go, Java, and PHP
5
5
  Project-URL: Homepage, https://runapi.ai/models/pixverse
6
6
  Project-URL: Documentation, https://runapi.ai/docs/resources/sdks
7
7
  Project-URL: Source, https://github.com/runapi-ai/pixverse-sdk
8
8
  Project-URL: Issues, https://github.com/runapi-ai/pixverse-sdk/issues
9
9
  Project-URL: Changelog, https://github.com/runapi-ai/pixverse-sdk/blob/main/CHANGELOG.md
10
- Project-URL: Release Notes, https://github.com/runapi-ai/pixverse-sdk/releases/tag/python%2Fv0.1.2
10
+ Project-URL: Release Notes, https://github.com/runapi-ai/pixverse-sdk/releases/tag/python%2Fv0.4.0
11
11
  Author-email: RunAPI <contact@runapi.ai>
12
12
  License-Expression: Apache-2.0
13
13
  License-File: LICENSE
14
14
  Keywords: api,golang,gradle,java,maven,pixverse,pixverse-api,python,ruby,runapi,runapi-ai,sdk,text-to-video,typescript,video-api,video-generation
15
- Requires-Python: >=3.9
16
- Requires-Dist: runapi-core>=0.3.6
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: runapi-core~=0.10.1
17
23
  Description-Content-Type: text/markdown
18
24
 
19
25
  # PixVerse Python SDK for RunAPI
@@ -4,14 +4,22 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "runapi-pixverse"
7
- version = "0.1.2"
7
+ version = "0.4.0"
8
8
  description = "RunAPI PixVerse SDK for text-to-video, image-to-video, reference editing, transitions, and video extension in JavaScript, Python, Ruby, Go, Java, and PHP"
9
9
  readme = "README.md"
10
- requires-python = ">=3.9"
10
+ requires-python = ">=3.10"
11
+ classifiers = [
12
+ "Programming Language :: Python :: 3",
13
+ "Programming Language :: Python :: 3.10",
14
+ "Programming Language :: Python :: 3.11",
15
+ "Programming Language :: Python :: 3.12",
16
+ "Programming Language :: Python :: 3.13",
17
+ "Programming Language :: Python :: 3.14",
18
+ ]
11
19
  license = "Apache-2.0"
12
20
  authors = [{ name = "RunAPI", email = "contact@runapi.ai" }]
13
21
  keywords = ["runapi", "runapi-ai", "pixverse", "api", "sdk", "typescript", "python", "ruby", "golang", "java", "maven", "gradle", "video-generation", "text-to-video", "video-api", "pixverse-api"]
14
- dependencies = ["runapi-core>=0.3.6"]
22
+ dependencies = ["runapi-core~=0.10.1"]
15
23
 
16
24
  [project.urls]
17
25
  Homepage = "https://runapi.ai/models/pixverse"
@@ -19,7 +27,7 @@ Documentation = "https://runapi.ai/docs/resources/sdks"
19
27
  Source = "https://github.com/runapi-ai/pixverse-sdk"
20
28
  Issues = "https://github.com/runapi-ai/pixverse-sdk/issues"
21
29
  Changelog = "https://github.com/runapi-ai/pixverse-sdk/blob/main/CHANGELOG.md"
22
- "Release Notes" = "https://github.com/runapi-ai/pixverse-sdk/releases/tag/python%2Fv0.1.2"
30
+ "Release Notes" = "https://github.com/runapi-ai/pixverse-sdk/releases/tag/python%2Fv0.4.0"
23
31
 
24
32
  [tool.hatch.build.targets.wheel]
25
33
  packages = ["src/runapi"]
@@ -6,7 +6,6 @@ from typing import Any, Optional
6
6
 
7
7
  from runapi.core import Resource, RequestOptions
8
8
 
9
- from ..contract_gen import CONTRACT
10
9
  from ..types import CompletedEditVideoResponse, EditVideoResponse
11
10
 
12
11
 
@@ -39,7 +38,6 @@ class EditVideo(Resource):
39
38
  The task creation result with an id.
40
39
  """
41
40
  compacted = self._compact_params(params)
42
- self._validate_contract(CONTRACT["edit-video"], compacted)
43
41
  return self._request("post", self.ENDPOINT, body=compacted, options=options)
44
42
 
45
43
  def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
@@ -2,7 +2,6 @@
2
2
 
3
3
  from typing import Any, Optional
4
4
  from runapi.core import Resource, RequestOptions
5
- from ..contract_gen import CONTRACT
6
5
  from ..types import CompletedExtendVideoResponse, ExtendVideoResponse
7
6
 
8
7
  class ExtendVideo(Resource):
@@ -14,7 +13,6 @@ class ExtendVideo(Resource):
14
13
  return self._poll_until_complete(lambda: self.get(task.id, options=options))
15
14
  def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
16
15
  body = self._compact_params(params)
17
- self._validate_contract(CONTRACT["extend-video"], body)
18
16
  return self._request("post", self.ENDPOINT, body=body, options=options)
19
17
  def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
20
18
  return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
@@ -6,7 +6,6 @@ from typing import Any, Optional
6
6
 
7
7
  from runapi.core import Resource, RequestOptions
8
8
 
9
- from ..contract_gen import CONTRACT
10
9
  from ..types import CompletedImageToVideoResponse, ImageToVideoResponse
11
10
 
12
11
 
@@ -40,7 +39,6 @@ class ImageToVideo(Resource):
40
39
  The task creation result with an id.
41
40
  """
42
41
  compacted = self._compact_params(params)
43
- self._validate_contract(CONTRACT["image-to-video"], compacted)
44
42
  return self._request("post", self.ENDPOINT, body=compacted, options=options)
45
43
 
46
44
  def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
@@ -6,7 +6,6 @@ from typing import Any, Optional
6
6
 
7
7
  from runapi.core import Resource, RequestOptions
8
8
 
9
- from ..contract_gen import CONTRACT
10
9
  from ..types import CompletedTextToVideoResponse, TextToVideoResponse
11
10
 
12
11
 
@@ -39,7 +38,6 @@ class TextToVideo(Resource):
39
38
  The task creation result with an id.
40
39
  """
41
40
  compacted = self._compact_params(params)
42
- self._validate_contract(CONTRACT["text-to-video"], compacted)
43
41
  return self._request("post", self.ENDPOINT, body=compacted, options=options)
44
42
 
45
43
  def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
@@ -2,7 +2,6 @@
2
2
 
3
3
  from typing import Any, Optional
4
4
  from runapi.core import Resource, RequestOptions
5
- from ..contract_gen import CONTRACT
6
5
  from ..types import CompletedTransitionVideoResponse, TransitionVideoResponse
7
6
 
8
7
  class TransitionVideo(Resource):
@@ -14,7 +13,6 @@ class TransitionVideo(Resource):
14
13
  return self._poll_until_complete(lambda: self.get(task.id, options=options))
15
14
  def create(self, options: Optional[RequestOptions] = None, **params: Any) -> Any:
16
15
  body = self._compact_params(params)
17
- self._validate_contract(CONTRACT["transition-video"], body)
18
16
  return self._request("post", self.ENDPOINT, body=body, options=options)
19
17
  def get(self, id: str, options: Optional[RequestOptions] = None) -> Any:
20
18
  return self._request("get", f"{self.ENDPOINT}/{id}", options=options)
@@ -4,8 +4,6 @@ from runapi.core import BaseModel, TaskResponse, optional, required
4
4
 
5
5
  MODEL = "pixverse-v6"
6
6
  CHARACTER_MODEL = MODEL
7
- DURATION_RANGE = range(1, 16)
8
- SEED_RANGE = range(0, 2_147_483_648)
9
7
 
10
8
  class MediaUrl(BaseModel):
11
9
  url = optional(str)
@@ -1,7 +1,7 @@
1
1
  import pytest
2
2
 
3
3
  from runapi.core import config
4
- from runapi.core.errors import AuthenticationError, ValidationError
4
+ from runapi.core.errors import AuthenticationError
5
5
  from runapi.pixverse import PixVerseClient
6
6
  from runapi.pixverse.resources import EditVideo, ExtendVideo, ImageToVideo, TextToVideo, TransitionVideo
7
7
 
@@ -30,8 +30,7 @@ def common_params():
30
30
  "model": "pixverse-v6",
31
31
  "prompt": "A lantern crosses the night sky",
32
32
  "output_resolution": "720p",
33
- "duration_seconds": 5,
34
- }
33
+ "duration_seconds": 5}
35
34
 
36
35
 
37
36
  def test_auth_and_resource_accessors():
@@ -52,11 +51,10 @@ def test_auth_and_resource_accessors():
52
51
  ("image_to_video", "image_to_video", {"first_frame_image_url": "https://cdn.runapi.ai/public/samples/first.png"}, "first_frame_image_url"),
53
52
  ("edit_video", "edit_video", {"reference_image_urls": ["https://cdn.runapi.ai/public/samples/reference.png"], "aspect_ratio": "16:9"}, "reference_image_urls"),
54
53
  ("transition_video", "transition_video", {"first_frame_image_url": "https://cdn.runapi.ai/public/samples/first.png", "last_frame_image_url": "https://cdn.runapi.ai/public/samples/last.png"}, "last_frame_image_url"),
55
- ("extend_video", "extend_video", {"source_task_id": "source_123"}, "source_task_id"),
56
- ],
54
+ ("extend_video", "extend_video", {"source_task_id": "source_123"}, "source_task_id")],
57
55
  )
58
56
  def test_create_and_get_request_shape(resource_name, endpoint, extra, expected_key):
59
- fake = FakeHttp({"id": "task_123", "status": "processing"}, {"id": "task_123", "status": "completed", "videos": [{"url": "https://cdn.runapi.ai/output.mp4"}]})
57
+ fake = FakeHttp({"id": "task_123", "status": "processing"}, {"id": "task_123", "status": "completed", "usage": {"cost": 0.05}, "videos": [{"url": "https://cdn.runapi.ai/output.mp4"}]})
60
58
  resource = getattr(PixVerseClient(api_key="k", http_client=fake), resource_name)
61
59
  params = {**common_params(), **extra}
62
60
 
@@ -66,9 +64,3 @@ def test_create_and_get_request_shape(resource_name, endpoint, extra, expected_k
66
64
  assert fake.calls[0] == ("post", f"/api/v1/pixverse/{endpoint}", params)
67
65
  assert expected_key in fake.calls[0][2]
68
66
  assert fake.calls[1] == ("get", f"/api/v1/pixverse/{endpoint}/task_123", None)
69
-
70
-
71
- def test_contract_validation_rejects_missing_required_field():
72
- client = PixVerseClient(api_key="k", http_client=FakeHttp())
73
- with pytest.raises(ValidationError, match="aspect_ratio is required"):
74
- client.text_to_video.create(**common_params())
@@ -1,188 +0,0 @@
1
- CONTRACT = {
2
- "edit-video": {
3
- "models": ["pixverse-v6"],
4
- "fields_by_model": {
5
- "pixverse-v6": {
6
- "aspect_ratio": {
7
- "enum": ["16:9", "4:3", "1:1", "3:4", "9:16", "2:3", "3:2", "21:9"],
8
- "required": True
9
- },
10
- "duration_seconds": {
11
- "required": True,
12
- "min": 1,
13
- "max": 15,
14
- "type": "integer"
15
- },
16
- "model": {
17
- "required": True
18
- },
19
- "output_resolution": {
20
- "enum": ["360p", "540p", "720p", "1080p"],
21
- "required": True
22
- },
23
- "prompt": {
24
- "required": True,
25
- "min": 3,
26
- "max": 5000,
27
- "length": True
28
- },
29
- "reference_image_urls": {
30
- "required": True,
31
- "min_items": 1,
32
- "max_items": 7
33
- },
34
- "seed": {
35
- "min": 0,
36
- "max": 2147483647,
37
- "type": "integer"
38
- }
39
- }
40
- }
41
- },
42
- "extend-video": {
43
- "models": ["pixverse-v6"],
44
- "fields_by_model": {
45
- "pixverse-v6": {
46
- "duration_seconds": {
47
- "required": True,
48
- "min": 1,
49
- "max": 15,
50
- "type": "integer"
51
- },
52
- "model": {
53
- "required": True
54
- },
55
- "output_resolution": {
56
- "enum": ["360p", "540p", "720p", "1080p"],
57
- "required": True
58
- },
59
- "prompt": {
60
- "required": True,
61
- "min": 3,
62
- "max": 5000,
63
- "length": True
64
- },
65
- "seed": {
66
- "min": 0,
67
- "max": 2147483647,
68
- "type": "integer"
69
- },
70
- "source_task_id": {
71
- "required": True
72
- }
73
- }
74
- }
75
- },
76
- "image-to-video": {
77
- "models": ["pixverse-v6"],
78
- "fields_by_model": {
79
- "pixverse-v6": {
80
- "duration_seconds": {
81
- "required": True,
82
- "min": 1,
83
- "max": 15,
84
- "type": "integer"
85
- },
86
- "enable_audio": {
87
- "enum": [True, False]
88
- },
89
- "first_frame_image_url": {
90
- "required": True
91
- },
92
- "model": {
93
- "required": True
94
- },
95
- "output_resolution": {
96
- "enum": ["360p", "540p", "720p", "1080p"],
97
- "required": True
98
- },
99
- "prompt": {
100
- "required": True,
101
- "min": 3,
102
- "max": 5000,
103
- "length": True
104
- },
105
- "seed": {
106
- "min": 0,
107
- "max": 2147483647,
108
- "type": "integer"
109
- }
110
- }
111
- }
112
- },
113
- "text-to-video": {
114
- "models": ["pixverse-v6"],
115
- "fields_by_model": {
116
- "pixverse-v6": {
117
- "aspect_ratio": {
118
- "enum": ["16:9", "4:3", "1:1", "3:4", "9:16", "2:3", "3:2", "21:9"],
119
- "required": True
120
- },
121
- "duration_seconds": {
122
- "required": True,
123
- "min": 1,
124
- "max": 15,
125
- "type": "integer"
126
- },
127
- "enable_audio": {
128
- "enum": [True, False]
129
- },
130
- "model": {
131
- "required": True
132
- },
133
- "output_resolution": {
134
- "enum": ["360p", "540p", "720p", "1080p"],
135
- "required": True
136
- },
137
- "prompt": {
138
- "required": True,
139
- "min": 3,
140
- "max": 5000,
141
- "length": True
142
- },
143
- "seed": {
144
- "min": 0,
145
- "max": 2147483647,
146
- "type": "integer"
147
- }
148
- }
149
- }
150
- },
151
- "transition-video": {
152
- "models": ["pixverse-v6"],
153
- "fields_by_model": {
154
- "pixverse-v6": {
155
- "duration_seconds": {
156
- "required": True,
157
- "min": 1,
158
- "max": 15,
159
- "type": "integer"
160
- },
161
- "first_frame_image_url": {
162
- "required": True
163
- },
164
- "last_frame_image_url": {
165
- "required": True
166
- },
167
- "model": {
168
- "required": True
169
- },
170
- "output_resolution": {
171
- "enum": ["360p", "540p", "720p", "1080p"],
172
- "required": True
173
- },
174
- "prompt": {
175
- "required": True,
176
- "min": 3,
177
- "max": 5000,
178
- "length": True
179
- },
180
- "seed": {
181
- "min": 0,
182
- "max": 2147483647,
183
- "type": "integer"
184
- }
185
- }
186
- }
187
- }
188
- }
File without changes