// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import { RequestOptions } from '../internal/request-options'; import { APIPromiseWithAwaitableTask, wrapAsWaitableResource } from '../lib/polling'; /** * These endpoints all kick off tasks to create generations. */ export class TextToVideo extends APIResource { /** * This endpoint will start a new task to generate a video from a text prompt. */ create( body: TextToVideoCreateParams, options?: RequestOptions, ): APIPromiseWithAwaitableTask { return wrapAsWaitableResource(this._client)( this._client.post('/v1/text_to_video', { body, ...options }), ); } } export interface TextToVideoCreateResponse { /** * The ID of the task that was created. Use this to retrieve the task later. */ id: string; } export type TextToVideoCreateParams = | TextToVideoCreateParams.Gen4_5 | TextToVideoCreateParams.Veo3_1 | TextToVideoCreateParams.Veo3_1Fast | TextToVideoCreateParams.Seedance2 | TextToVideoCreateParams.Veo3; export declare namespace TextToVideoCreateParams { export interface Gen4_5 { /** * The number of seconds of duration for the output video. Must be an integer from * 2 to 10. */ duration: number; model: 'gen4.5'; /** * A non-empty string up to 1000 characters (measured in UTF-16 code units). This * should describe in detail what should appear in the output. */ promptText: string; /** * The resolution of the output video. */ ratio: '1280:720' | '720:1280'; /** * Settings that affect the behavior of the content moderation system. */ contentModeration?: Gen4_5.ContentModeration; /** * If unspecified, a random number is chosen. Varying the seed integer is a way to * get different results for the same other request parameters. Using the same seed * integer for an identical request will produce similar results. */ seed?: number; } export namespace Gen4_5 { /** * Settings that affect the behavior of the content moderation system. */ export interface ContentModeration { /** * When set to `low`, the content moderation system will be less strict about * preventing generations that include recognizable public figures. */ publicFigureThreshold?: 'auto' | 'low'; } } export interface Veo3_1 { model: 'veo3.1'; /** * A non-empty string up to 1000 characters (measured in UTF-16 code units). This * should describe in detail what should appear in the output. */ promptText: string; /** * The resolution of the output video. */ ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080'; /** * Whether to generate audio for the video. Audio inclusion affects pricing. */ audio?: boolean; /** * The number of seconds of duration for the output video. */ duration?: 4 | 6 | 8; } export interface Veo3_1Fast { model: 'veo3.1_fast'; /** * A non-empty string up to 1000 characters (measured in UTF-16 code units). This * should describe in detail what should appear in the output. */ promptText: string; /** * The resolution of the output video. */ ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080'; /** * Whether to generate audio for the video. Audio inclusion affects pricing. */ audio?: boolean; /** * The number of seconds of duration for the output video. */ duration?: 4 | 6 | 8; } export interface Seedance2 { model: 'seedance2'; /** * A non-empty string up to 3500 characters (measured in UTF-16 code units). This * should describe in detail what should appear in the output. */ promptText: string; /** * Whether to generate audio for the video. Audio inclusion affects pricing. */ audio?: boolean; /** * The number of seconds of duration for the output video. */ duration?: number; /** * The number of video generations to produce. */ outputCount?: number; /** * The resolution of the output video. */ ratio?: | '992:432' | '864:496' | '752:560' | '640:640' | '560:752' | '496:864' | '1470:630' | '1280:720' | '1112:834' | '960:960' | '834:1112' | '720:1280'; } export interface Veo3 { /** * The number of seconds of duration for the output video. */ duration: 8; model: 'veo3'; /** * A non-empty string up to 1000 characters (measured in UTF-16 code units). This * should describe in detail what should appear in the output. */ promptText: string; /** * The resolution of the output video. */ ratio: '1280:720' | '720:1280' | '1080:1920' | '1920:1080'; } } export declare namespace TextToVideo { export { type TextToVideoCreateResponse as TextToVideoCreateResponse, type TextToVideoCreateParams as TextToVideoCreateParams, }; }