Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading