仅首帧生成视频,返回task_id Args: at: Access Token project_id: 项目ID prompt: 提示词 model_key: veo_3_1_i2v_s_fast_fl等 aspect_ratio: 视频宽高比 start_media_id: 起始帧mediaId user_paygate_tier: 用户等级 Returns: 同
(
self,
at: str,
project_id: str,
prompt: str,
model_key: str,
aspect_ratio: str,
start_media_id: str,
use_v2_model_config: bool = False,
user_paygate_tier: str = "PAYGATE_TIER_ONE",
token_id: Optional[int] = None,
token_video_concurrency: Optional[int] = None,
)
| 3272 | raise last_error |
| 3273 | |
| 3274 | async def generate_video_start_image( |
| 3275 | self, |
| 3276 | at: str, |
| 3277 | project_id: str, |
| 3278 | prompt: str, |
| 3279 | model_key: str, |
| 3280 | aspect_ratio: str, |
| 3281 | start_media_id: str, |
| 3282 | use_v2_model_config: bool = False, |
| 3283 | user_paygate_tier: str = "PAYGATE_TIER_ONE", |
| 3284 | token_id: Optional[int] = None, |
| 3285 | token_video_concurrency: Optional[int] = None, |
| 3286 | ) -> dict: |
| 3287 | """仅首帧生成视频,返回task_id |
| 3288 | |
| 3289 | Args: |
| 3290 | at: Access Token |
| 3291 | project_id: 项目ID |
| 3292 | prompt: 提示词 |
| 3293 | model_key: veo_3_1_i2v_s_fast_fl等 |
| 3294 | aspect_ratio: 视频宽高比 |
| 3295 | start_media_id: 起始帧mediaId |
| 3296 | user_paygate_tier: 用户等级 |
| 3297 | |
| 3298 | Returns: |
| 3299 | 同 generate_video_text |
| 3300 | """ |
| 3301 | url = f"{self.api_base_url}/video:batchAsyncGenerateVideoStartImage" |
| 3302 | |
| 3303 | # 403/reCAPTCHA 重试逻辑 - reCAPTCHA evaluation failed 时允许更高重试上限 |
| 3304 | max_retries = self._resolve_generation_retry_budget(config.flow_max_retries) |
| 3305 | last_error = None |
| 3306 | retry_attempt = 0 |
| 3307 | session_id = self._generate_session_id() |
| 3308 | batch_id = str(uuid.uuid4()) |
| 3309 | video_context_warmed = False |
| 3310 | while retry_attempt < max_retries: |
| 3311 | # 每次重试都重新获取 reCAPTCHA token - 视频使用 VIDEO_GENERATION action |
| 3312 | launch_gate_acquired = False |
| 3313 | launch_ok, _, _ = await self._acquire_video_launch_gate( |
| 3314 | token_id=token_id, |
| 3315 | token_video_concurrency=token_video_concurrency, |
| 3316 | ) |
| 3317 | if not launch_ok: |
| 3318 | last_error = Exception("Video launch queue wait timeout") |
| 3319 | raise last_error |
| 3320 | |
| 3321 | launch_gate_acquired = True |
| 3322 | try: |
| 3323 | recaptcha_token, browser_id = await self._get_recaptcha_token( |
| 3324 | project_id, |
| 3325 | action="VIDEO_GENERATION", |
| 3326 | token_id=token_id |
| 3327 | ) |
| 3328 | finally: |
| 3329 | if launch_gate_acquired: |
| 3330 | await self._release_video_launch_gate(token_id) |
| 3331 | if not recaptcha_token: |
no test coverage detected