From 789510c409141194ac8cf40f1c432615a8256eec Mon Sep 17 00:00:00 2001 From: Fsocietyhhh <1211904451@qq.com> Date: Fri, 15 May 2026 19:41:42 -0700 Subject: [PATCH] feat(video): forward Token360 video options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds 6 optional fields to VideoGenerateOptions that the gateway can forward to Token360 / Seedance: - aspectRatio: 16:9 / 9:16 / 1:1 / etc. - resolution: 360p — 4K - generateAudio: explicit on/off (gateway only sends when caller provides) - seed: reproducibility - watermark: pass through user opt-in - returnLastFrame: enable clip chaining All fields are optional and silently ignored when the underlying model or provider doesn't support them. xAI Grok video calls are unaffected since the gateway filters these out before dispatching. Per Token360 docs: https://www.token360.ai/en-US/docs/api-reference/video-generation/submit-video-generation-request Companion gateway PR wires generate_audio + fixes the seconds→duration field-name bug that was silently dropping all duration overrides. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/types.ts | 18 ++++++++++++++++++ src/video.ts | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/src/types.ts b/src/types.ts index a2f7f3a..42dcf26 100644 --- a/src/types.ts +++ b/src/types.ts @@ -496,6 +496,24 @@ export interface VideoGenerateOptions { imageUrl?: string; /** Duration to bill for (defaults to model's default duration) */ durationSeconds?: number; + /** Output aspect ratio. Token360 / Seedance only — silently ignored by xAI Grok. */ + aspectRatio?: "adaptive" | "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "9:21"; + /** Output resolution. Token360 / Seedance only. */ + resolution?: "360p" | "480p" | "540p" | "720p" | "1080p" | "1K" | "2K" | "4K"; + /** + * Whether the model should produce an audio track. Token360 / Seedance only. + * When omitted, the gateway does not send the flag — Token360 then applies + * its own upstream default (typically off, occasionally on depending on + * model variant / prompt). Audio generation is usually a paid surcharge, + * so callers should expose this as a visible toggle to their users. + */ + generateAudio?: boolean; + /** Reproducibility seed when supported by the model. */ + seed?: number; + /** Embed the upstream watermark on the output. Defaults to false at the gateway. */ + watermark?: boolean; + /** Return the last frame as an image alongside the clip — useful for chaining. */ + returnLastFrame?: boolean; } // Search options for standalone search endpoint diff --git a/src/video.ts b/src/video.ts index 737d16a..ad5cf74 100644 --- a/src/video.ts +++ b/src/video.ts @@ -115,6 +115,13 @@ export class VideoClient { }; if (options?.imageUrl) body.image_url = options.imageUrl; if (options?.durationSeconds !== undefined) body.duration_seconds = options.durationSeconds; + // ── Token360 / Seedance passthroughs (gateway silently ignores for xAI) ─ + if (options?.aspectRatio) body.aspect_ratio = options.aspectRatio; + if (options?.resolution) body.resolution = options.resolution; + if (options?.generateAudio !== undefined) body.generate_audio = options.generateAudio; + if (options?.seed !== undefined) body.seed = options.seed; + if (options?.watermark !== undefined) body.watermark = options.watermark; + if (options?.returnLastFrame) body.return_last_frame = true; const budgetMs = options?.budgetMs ?? DEFAULT_GENERATE_BUDGET_MS; return this.submitAndPoll(body, budgetMs);