|
1 | | -from __future__ import annotations |
2 | | - |
3 | 1 | from enum import Enum |
4 | | -from typing import Optional |
5 | 2 |
|
6 | 3 | from pydantic import BaseModel, Field |
7 | 4 |
|
@@ -60,87 +57,174 @@ class PixverseStyle(str, Enum): |
60 | 57 | cyberpunk = "cyberpunk" |
61 | 58 |
|
62 | 59 |
|
63 | | -# NOTE: forgoing descriptions for now in return for dev speed |
64 | 60 | class PixverseTextVideoRequest(BaseModel): |
65 | 61 | aspect_ratio: PixverseAspectRatio = Field(...) |
66 | 62 | quality: PixverseQuality = Field(...) |
67 | 63 | duration: PixverseDuration = Field(...) |
68 | | - model: Optional[str] = Field("v3.5") |
69 | | - motion_mode: Optional[PixverseMotionMode] = Field(PixverseMotionMode.normal) |
| 64 | + model: str | None = Field("v3.5") |
| 65 | + motion_mode: PixverseMotionMode | None = Field(PixverseMotionMode.normal) |
70 | 66 | prompt: str = Field(...) |
71 | | - negative_prompt: Optional[str] = Field(None) |
72 | | - seed: Optional[int] = Field(None) |
73 | | - style: Optional[str] = Field(None) |
74 | | - template_id: Optional[int] = Field(None) |
75 | | - water_mark: Optional[bool] = Field(None) |
| 67 | + negative_prompt: str | None = Field(None) |
| 68 | + seed: int | None = Field(None) |
| 69 | + style: str | None = Field(None) |
| 70 | + template_id: int | None = Field(None) |
| 71 | + water_mark: bool | None = Field(None) |
76 | 72 |
|
77 | 73 |
|
78 | 74 | class PixverseImageVideoRequest(BaseModel): |
79 | 75 | quality: PixverseQuality = Field(...) |
80 | 76 | duration: PixverseDuration = Field(...) |
81 | 77 | img_id: int = Field(...) |
82 | | - model: Optional[str] = Field("v3.5") |
83 | | - motion_mode: Optional[PixverseMotionMode] = Field(PixverseMotionMode.normal) |
| 78 | + model: str | None = Field("v3.5") |
| 79 | + motion_mode: PixverseMotionMode | None = Field(PixverseMotionMode.normal) |
84 | 80 | prompt: str = Field(...) |
85 | | - negative_prompt: Optional[str] = Field(None) |
86 | | - seed: Optional[int] = Field(None) |
87 | | - style: Optional[str] = Field(None) |
88 | | - template_id: Optional[int] = Field(None) |
89 | | - water_mark: Optional[bool] = Field(None) |
| 81 | + negative_prompt: str | None = Field(None) |
| 82 | + seed: int | None = Field(None) |
| 83 | + style: str | None = Field(None) |
| 84 | + template_id: int | None = Field(None) |
| 85 | + water_mark: bool | None = Field(None) |
90 | 86 |
|
91 | 87 |
|
92 | 88 | class PixverseTransitionVideoRequest(BaseModel): |
93 | 89 | quality: PixverseQuality = Field(...) |
94 | 90 | duration: PixverseDuration = Field(...) |
95 | 91 | first_frame_img: int = Field(...) |
96 | 92 | last_frame_img: int = Field(...) |
97 | | - model: Optional[str] = Field("v3.5") |
98 | | - motion_mode: Optional[PixverseMotionMode] = Field(PixverseMotionMode.normal) |
| 93 | + model: str | None = Field("v3.5") |
| 94 | + motion_mode: PixverseMotionMode | None = Field(PixverseMotionMode.normal) |
99 | 95 | prompt: str = Field(...) |
100 | | - # negative_prompt: Optional[str] = Field(None) |
101 | | - seed: Optional[int] = Field(None) |
102 | | - # style: Optional[str] = Field(None) |
103 | | - # template_id: Optional[int] = Field(None) |
104 | | - # water_mark: Optional[bool] = Field(None) |
| 96 | + seed: int | None = Field(None) |
| 97 | + |
| 98 | + |
| 99 | +class PixverseImgIdResponseObject(BaseModel): |
| 100 | + img_id: int | None = None |
105 | 101 |
|
106 | 102 |
|
107 | 103 | class PixverseImageUploadResponse(BaseModel): |
108 | | - ErrCode: Optional[int] = None |
109 | | - ErrMsg: Optional[str] = None |
110 | | - Resp: Optional[PixverseImgIdResponseObject] = Field(None, alias='Resp') |
| 104 | + ErrCode: int | None = None |
| 105 | + ErrMsg: str | None = None |
| 106 | + Resp: PixverseImgIdResponseObject | None = Field(None) |
111 | 107 |
|
112 | 108 |
|
113 | | -class PixverseImgIdResponseObject(BaseModel): |
114 | | - img_id: Optional[int] = None |
| 109 | +class PixverseVideoIdResponseObject(BaseModel): |
| 110 | + video_id: int = Field(...) |
| 111 | + credits: int | None = Field(None) |
115 | 112 |
|
116 | 113 |
|
117 | 114 | class PixverseVideoResponse(BaseModel): |
118 | | - ErrCode: Optional[int] = Field(None) |
119 | | - ErrMsg: Optional[str] = Field(None) |
120 | | - Resp: Optional[PixverseVideoIdResponseObject] = Field(None) |
| 115 | + ErrCode: int | None = Field(None) |
| 116 | + ErrMsg: str | None = Field(None) |
| 117 | + Resp: PixverseVideoIdResponseObject | None = Field(None) |
121 | 118 |
|
122 | 119 |
|
123 | | -class PixverseVideoIdResponseObject(BaseModel): |
124 | | - video_id: int = Field(..., description='Video_id') |
| 120 | +class PixverseGenerationStatusResponseObject(BaseModel): |
| 121 | + create_time: str | None = Field(None) |
| 122 | + id: int | None = Field(None) |
| 123 | + modify_time: str | None = Field(None) |
| 124 | + negative_prompt: str | None = Field(None) |
| 125 | + outputHeight: int | None = Field(None) |
| 126 | + outputWidth: int | None = Field(None) |
| 127 | + prompt: str | None = Field(None) |
| 128 | + resolution_ratio: int | None = Field(None) |
| 129 | + seed: int | None = Field(None) |
| 130 | + size: int | None = Field(None) |
| 131 | + status: int | None = Field(None) |
| 132 | + style: str | None = Field(None) |
| 133 | + has_audio: bool | None = Field(None) |
| 134 | + credits: int | None = Field(None) |
| 135 | + url: str | None = Field(None) |
125 | 136 |
|
126 | 137 |
|
127 | 138 | class PixverseGenerationStatusResponse(BaseModel): |
128 | | - ErrCode: Optional[int] = Field(None) |
129 | | - ErrMsg: Optional[str] = Field(None) |
130 | | - Resp: Optional[PixverseGenerationStatusResponseObject] = Field(None) |
| 139 | + ErrCode: int | None = Field(None) |
| 140 | + ErrMsg: str | None = Field(None) |
| 141 | + Resp: PixverseGenerationStatusResponseObject | None = Field(None) |
131 | 142 |
|
132 | 143 |
|
133 | | -class PixverseGenerationStatusResponseObject(BaseModel): |
134 | | - create_time: Optional[str] = Field(None) |
135 | | - id: Optional[int] = Field(None) |
136 | | - modify_time: Optional[str] = Field(None) |
137 | | - negative_prompt: Optional[str] = Field(None) |
138 | | - outputHeight: Optional[int] = Field(None) |
139 | | - outputWidth: Optional[int] = Field(None) |
140 | | - prompt: Optional[str] = Field(None) |
141 | | - resolution_ratio: Optional[int] = Field(None) |
142 | | - seed: Optional[int] = Field(None) |
143 | | - size: Optional[int] = Field(None) |
144 | | - status: Optional[int] = Field(None) |
145 | | - style: Optional[str] = Field(None) |
146 | | - url: Optional[str] = Field(None) |
| 144 | +class PixverseV6AspectRatio(str, Enum): |
| 145 | + ratio_16_9 = "16:9" |
| 146 | + ratio_4_3 = "4:3" |
| 147 | + ratio_1_1 = "1:1" |
| 148 | + ratio_3_4 = "3:4" |
| 149 | + ratio_9_16 = "9:16" |
| 150 | + ratio_2_3 = "2:3" |
| 151 | + ratio_3_2 = "3:2" |
| 152 | + ratio_21_9 = "21:9" |
| 153 | + |
| 154 | + |
| 155 | +class PixverseV6Style(str, Enum): |
| 156 | + none = "none" |
| 157 | + anime = "anime" |
| 158 | + animation_3d = "3d_animation" |
| 159 | + clay = "clay" |
| 160 | + comic = "comic" |
| 161 | + cyberpunk = "cyberpunk" |
| 162 | + realistic = "realistic" |
| 163 | + |
| 164 | + |
| 165 | +class PixverseReferenceType(str, Enum): |
| 166 | + subject = "subject" |
| 167 | + background = "background" |
| 168 | + |
| 169 | + |
| 170 | +class PixverseImageReference(BaseModel): |
| 171 | + img_id: int = Field(...) |
| 172 | + ref_name: str = Field(...) |
| 173 | + type: PixverseReferenceType = Field(...) |
| 174 | + |
| 175 | + |
| 176 | +class PixverseVideoReference(BaseModel): |
| 177 | + ref_name: str = Field(...) |
| 178 | + video_media_id: int | None = Field(None) |
| 179 | + source_video_id: int | None = Field(None) |
| 180 | + |
| 181 | + |
| 182 | +class PixverseV6BaseRequest(BaseModel): |
| 183 | + model: str = Field("v6") |
| 184 | + prompt: str = Field(...) |
| 185 | + duration: int = Field(...) |
| 186 | + quality: PixverseQuality = Field(...) |
| 187 | + negative_prompt: str | None = Field(None) |
| 188 | + seed: int | None = Field(None) |
| 189 | + style: str | None = Field(None) |
| 190 | + generate_audio_switch: bool | None = Field(None) |
| 191 | + |
| 192 | + |
| 193 | +class PixverseV6TextVideoRequest(PixverseV6BaseRequest): |
| 194 | + aspect_ratio: PixverseV6AspectRatio = Field(...) |
| 195 | + generate_multi_clip_switch: bool | None = Field(None) |
| 196 | + |
| 197 | + |
| 198 | +class PixverseV6ImageVideoRequest(PixverseV6BaseRequest): |
| 199 | + img_id: int = Field(...) |
| 200 | + generate_multi_clip_switch: bool | None = Field(None) |
| 201 | + |
| 202 | + |
| 203 | +class PixverseV6TransitionVideoRequest(PixverseV6BaseRequest): |
| 204 | + first_frame_img: int = Field(...) |
| 205 | + last_frame_img: int = Field(...) |
| 206 | + |
| 207 | + |
| 208 | +class PixverseV6ExtendVideoRequest(PixverseV6BaseRequest): |
| 209 | + video_media_id: int = Field(...) |
| 210 | + |
| 211 | + |
| 212 | +class PixverseV6FusionVideoRequest(PixverseV6BaseRequest): |
| 213 | + aspect_ratio: str = Field(...) |
| 214 | + image_references: list[PixverseImageReference] | None = Field(None) |
| 215 | + video_references: list[PixverseVideoReference] | None = Field(None) |
| 216 | + reference_mode: str | None = Field(None) |
| 217 | + |
| 218 | + |
| 219 | +class PixverseMediaIdResponseObject(BaseModel): |
| 220 | + media_id: int | None = Field(None) |
| 221 | + media_type: str | None = Field(None) |
| 222 | + url: str | None = Field(None) |
| 223 | + width: int | None = Field(None) |
| 224 | + height: int | None = Field(None) |
| 225 | + |
| 226 | + |
| 227 | +class PixverseMediaUploadResponse(BaseModel): |
| 228 | + ErrCode: int | None = Field(None) |
| 229 | + ErrMsg: str | None = Field(None) |
| 230 | + Resp: PixverseMediaIdResponseObject | None = Field(None) |
0 commit comments