import { APIResource } from "../../resource.js"; import * as Core from "../../core.js"; import * as ConceptsAPI from "./concepts.js"; import { ConceptListResponse, Concepts } from "./concepts.js"; import * as ImageAPI from "./image.js"; import { Image, ImageCreateParams, ImageReframeParams } from "./image.js"; import * as VideoAPI from "./video.js"; import { Video, VideoCreateParams, VideoModifyParams, VideoReframeParams } from "./video.js"; export declare class Generations extends APIResource { concepts: ConceptsAPI.Concepts; image: ImageAPI.Image; video: VideoAPI.Video; /** * Initiate a new generation with the provided prompt * * @example * ```ts * const generation = await client.generations.create({ * model: 'ray-2', * aspect_ratio: '16:9', * keyframes: { * frame0: { * type: 'image', * url: 'https://example.com/image.jpg', * }, * frame1: { * type: 'generation', * id: '123e4567-e89b-12d3-a456-426614174000', * }, * }, * loop: true, * prompt: 'A serene lake surrounded by mountains at sunset', * }); * ``` */ create(body: GenerationCreateParams, options?: Core.RequestOptions): Core.APIPromise; /** * Retrieve a list of generations with optional filtering and sorting * * @example * ```ts * const generations = await client.generations.list(); * ``` */ list(query?: GenerationListParams, options?: Core.RequestOptions): Core.APIPromise; list(options?: Core.RequestOptions): Core.APIPromise; /** * Remove a specific generation by its ID * * @example * ```ts * await client.generations.delete('id'); * ``` */ delete(id: string, options?: Core.RequestOptions): Core.APIPromise; /** * Add audio to a generation by its ID * * @example * ```ts * const generation = await client.generations.audio('id'); * ``` */ audio(id: string, body: GenerationAudioParams, options?: Core.RequestOptions): Core.APIPromise; /** * Retrieve details of a specific generation by its ID * * @example * ```ts * const generation = await client.generations.get('id'); * ``` */ get(id: string, options?: Core.RequestOptions): Core.APIPromise; /** * Upscale a generation by its ID * * @example * ```ts * const generation = await client.generations.upscale('id'); * ``` */ upscale(id: string, body: GenerationUpscaleParams, options?: Core.RequestOptions): Core.APIPromise; } /** * The generation response object */ export interface Generation { /** * The ID of the generation */ id?: string; /** * The assets of the generation */ assets?: Generation.Assets; /** * The date and time when the generation was created */ created_at?: string; /** * The reason for the state of the generation */ failure_reason?: string; /** * The type of the generation */ generation_type?: 'video' | 'image'; /** * The model used for the generation */ model?: string; /** * The request of the generation */ request?: Generation.GenerationRequest | Generation.ImageGenerationRequest | Generation.UpscaleVideoGenerationRequest | Generation.AudioGenerationRequest | Generation.ReframeImageRequest | Generation.ReframeVideoRequest | Generation.ModifyVideoRequest; /** * The state of the generation */ state?: 'queued' | 'dreaming' | 'completed' | 'failed'; } export declare namespace Generation { /** * The assets of the generation */ interface Assets { /** * The URL of the image */ image?: string; /** * The URL of the progress video */ progress_video?: string; /** * The URL of the video */ video?: string; } /** * The generation request object */ interface GenerationRequest { /** * The model used for the generation */ model: 'ray-2' | 'ray-flash-2'; /** * The aspect ratio of the generation */ aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4' | '21:9' | '9:21'; /** * The callback URL of the generation, a POST request with Generation object will * be sent to the callback URL when the generation is dreaming, completed, or * failed */ callback_url?: string; /** * The concepts of the generation */ concepts?: Array; /** * The duration of the generation */ duration?: '5s' | '9s' | (string & {}); generation_type?: 'video'; /** * The keyframes of the generation */ keyframes?: GenerationRequest.Keyframes; /** * Whether to loop the video */ loop?: boolean; /** * The prompt of the generation */ prompt?: string; /** * The resolution of the generation */ resolution?: '540p' | '720p' | '1080p' | '4k' | (string & {}); } namespace GenerationRequest { /** * The concept object */ interface Concept { /** * The key of the concept */ key: string; } /** * The keyframes of the generation */ interface Keyframes { /** * The frame 0 of the generation */ frame0?: Keyframes.GenerationReference | Keyframes.ImageReference; /** * The frame 1 of the generation */ frame1?: Keyframes.GenerationReference | Keyframes.ImageReference; } namespace Keyframes { /** * The generation reference object */ interface GenerationReference { /** * The ID of the generation */ id: string; type: 'generation'; } /** * The image object */ interface ImageReference { type: 'image'; /** * The URL of the image */ url: string; } /** * The generation reference object */ interface GenerationReference { /** * The ID of the generation */ id: string; type: 'generation'; } /** * The image object */ interface ImageReference { type: 'image'; /** * The URL of the image */ url: string; } } } /** * The image generation request object */ interface ImageGenerationRequest { /** * The model used for the generation */ model: 'photon-1' | 'photon-flash-1'; /** * The aspect ratio of the generation */ aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4' | '21:9' | '9:21'; /** * The callback URL for the generation */ callback_url?: string; character_ref?: ImageGenerationRequest.CharacterRef; /** * The format of the image */ format?: 'jpg' | 'png'; generation_type?: 'image'; image_ref?: Array; /** * The modify image reference object */ modify_image_ref?: ImageGenerationRequest.ModifyImageRef; /** * The prompt of the generation */ prompt?: string; style_ref?: Array; /** * Create image in synchronous mode and return complated image */ sync?: boolean; /** * The timeout for the synchronous image generation */ sync_timeout?: number; } namespace ImageGenerationRequest { interface CharacterRef { /** * The image identity object */ identity0?: CharacterRef.Identity0; } namespace CharacterRef { /** * The image identity object */ interface Identity0 { /** * The URLs of the image identity */ images?: Array; } } /** * The image reference object */ interface ImageRef { /** * The URL of the image reference */ url?: string; /** * The weight of the image reference */ weight?: number; } /** * The modify image reference object */ interface ModifyImageRef { /** * The URL of the image reference */ url?: string; /** * The weight of the modify image reference */ weight?: number; } /** * The image reference object */ interface StyleRef { /** * The URL of the image reference */ url?: string; /** * The weight of the image reference */ weight?: number; } } /** * The upscale generation request object */ interface UpscaleVideoGenerationRequest { /** * The callback URL for the upscale */ callback_url?: string; generation_type?: 'upscale_video'; /** * The resolution of the upscale */ resolution?: '540p' | '720p' | '1080p' | '4k' | (string & {}); } /** * The audio generation request object */ interface AudioGenerationRequest { /** * The callback URL for the audio */ callback_url?: string; generation_type?: 'add_audio'; /** * The negative prompt of the audio */ negative_prompt?: string; /** * The prompt of the audio */ prompt?: string; } /** * The reframe image generation request object */ interface ReframeImageRequest { /** * The aspect ratio of the generation */ aspect_ratio: '1:1' | '16:9' | '9:16' | '4:3' | '3:4' | '21:9' | '9:21'; generation_type: 'reframe_image'; /** * The image entity object */ media: ReframeImageRequest.Media; /** * The model used for the reframe image */ model: 'photon-1' | 'photon-flash-1'; /** * The callback URL of the generation, a POST request with Generation object will * be sent to the callback URL when the generation is dreaming, completed, or * failed */ callback_url?: string; /** * The format of the image */ format?: 'jpg' | 'png'; /** * The x position of the image in the grid */ grid_position_x?: number; /** * The y position of the image in the grid */ grid_position_y?: number; /** * The prompt of the generation */ prompt?: string; /** * Resized height of source image */ resized_height?: number; /** * Resized width of source image */ resized_width?: number; /** * The x end of the crop bounds */ x_end?: number; /** * The x start of the crop bounds */ x_start?: number; /** * The y end of the crop bounds */ y_end?: number; /** * The y start of the crop bounds */ y_start?: number; } namespace ReframeImageRequest { /** * The image entity object */ interface Media { /** * The URL of the media */ url: string; } } /** * The reframe video generation request object */ interface ReframeVideoRequest { /** * The aspect ratio of the generation */ aspect_ratio: '1:1' | '16:9' | '9:16' | '4:3' | '3:4' | '21:9' | '9:21'; generation_type: 'reframe_video'; /** * The image entity object */ media: ReframeVideoRequest.Media; /** * The model used for the reframe video */ model: 'ray-2' | 'ray-flash-2'; /** * The callback URL of the generation, a POST request with Generation object will * be sent to the callback URL when the generation is dreaming, completed, or * failed */ callback_url?: string; /** * The image entity object */ first_frame?: ReframeVideoRequest.FirstFrame; /** * The x position of the image in the grid */ grid_position_x?: number; /** * The y position of the image in the grid */ grid_position_y?: number; /** * The prompt of the generation */ prompt?: string; /** * Resized height of source video */ resized_height?: number; /** * Resized width of source video */ resized_width?: number; /** * The x end of the crop bounds */ x_end?: number; /** * The x start of the crop bounds */ x_start?: number; /** * The y end of the crop bounds */ y_end?: number; /** * The y start of the crop bounds */ y_start?: number; } namespace ReframeVideoRequest { /** * The image entity object */ interface Media { /** * The URL of the media */ url: string; } /** * The image entity object */ interface FirstFrame { /** * The URL of the media */ url: string; } } /** * The modify video generation request object */ interface ModifyVideoRequest { generation_type: 'modify_video'; /** * The image entity object */ media: ModifyVideoRequest.Media; /** * The mode of the modify video */ mode: 'adhere_1' | 'adhere_2' | 'adhere_3' | 'flex_1' | 'flex_2' | 'flex_3' | 'reimagine_1' | 'reimagine_2' | 'reimagine_3'; /** * The model used for the modify video */ model: 'ray-2' | 'ray-flash-2'; /** * The callback URL of the generation, a POST request with Generation object will * be sent to the callback URL when the generation is dreaming, completed, or * failed */ callback_url?: string; /** * The image entity object */ first_frame?: ModifyVideoRequest.FirstFrame; /** * The prompt of the generation */ prompt?: string; } namespace ModifyVideoRequest { /** * The image entity object */ interface Media { /** * The URL of the media */ url: string; } /** * The image entity object */ interface FirstFrame { /** * The URL of the media */ url: string; } } } /** * The generations response object */ export interface GenerationListResponse { /** * The generations requested */ generations: Array; /** * The number of generations returned */ count?: number; /** * Whether there are more generations */ has_more?: boolean; /** * The limit of the generations requested */ limit?: number; /** * The offset of the generations requested */ offset?: number; } export interface GenerationCreateParams { /** * The model used for the generation */ model: 'ray-2' | 'ray-flash-2'; /** * The aspect ratio of the generation */ aspect_ratio?: '1:1' | '16:9' | '9:16' | '4:3' | '3:4' | '21:9' | '9:21'; /** * The callback URL of the generation, a POST request with Generation object will * be sent to the callback URL when the generation is dreaming, completed, or * failed */ callback_url?: string; /** * The concepts of the generation */ concepts?: Array; /** * The duration of the generation */ duration?: '5s' | '9s' | (string & {}); generation_type?: 'video'; /** * The keyframes of the generation */ keyframes?: GenerationCreateParams.Keyframes; /** * Whether to loop the video */ loop?: boolean; /** * The prompt of the generation */ prompt?: string; /** * The resolution of the generation */ resolution?: '540p' | '720p' | '1080p' | '4k' | (string & {}); } export declare namespace GenerationCreateParams { /** * The concept object */ interface Concept { /** * The key of the concept */ key: string; } /** * The keyframes of the generation */ interface Keyframes { /** * The frame 0 of the generation */ frame0?: Keyframes.GenerationReference | Keyframes.ImageReference; /** * The frame 1 of the generation */ frame1?: Keyframes.GenerationReference | Keyframes.ImageReference; } namespace Keyframes { /** * The generation reference object */ interface GenerationReference { /** * The ID of the generation */ id: string; type: 'generation'; } /** * The image object */ interface ImageReference { type: 'image'; /** * The URL of the image */ url: string; } /** * The generation reference object */ interface GenerationReference { /** * The ID of the generation */ id: string; type: 'generation'; } /** * The image object */ interface ImageReference { type: 'image'; /** * The URL of the image */ url: string; } } } export interface GenerationListParams { limit?: number; offset?: number; } export interface GenerationAudioParams { /** * The callback URL for the audio */ callback_url?: string; generation_type?: 'add_audio'; /** * The negative prompt of the audio */ negative_prompt?: string; /** * The prompt of the audio */ prompt?: string; } export interface GenerationUpscaleParams { /** * The callback URL for the upscale */ callback_url?: string; generation_type?: 'upscale_video'; /** * The resolution of the upscale */ resolution?: '540p' | '720p' | '1080p' | '4k' | (string & {}); } export declare namespace Generations { export { type Generation as Generation, type GenerationListResponse as GenerationListResponse, type GenerationCreateParams as GenerationCreateParams, type GenerationListParams as GenerationListParams, type GenerationAudioParams as GenerationAudioParams, type GenerationUpscaleParams as GenerationUpscaleParams, }; export { Concepts as Concepts, type ConceptListResponse as ConceptListResponse }; export { Image as Image, type ImageCreateParams as ImageCreateParams, type ImageReframeParams as ImageReframeParams, }; export { Video as Video, type VideoCreateParams as VideoCreateParams, type VideoModifyParams as VideoModifyParams, type VideoReframeParams as VideoReframeParams, }; } //# sourceMappingURL=generations.d.ts.map