export type RunwayModel = 'gen-4.5' | 'gen-4' | 'gen-4-turbo' | 'seedance-2.0'; export type RunwayMode = 'explore' | 'credits'; export type RunwayAspectRatio = '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | '21:9'; export type RunwayResolution = '720p' | '1080p'; /** * Valid duration depends on the model: * - Gen-4.5 / Gen-4 / Gen-4 Turbo: 5, 8, 10 * - Seedance 2.0 (via /videos/create): 5, 8, 10, 15 * Other models have their own ranges. UseAPI enforces server-side. */ export type RunwayDurationSeconds = 5 | 8 | 10 | 15; /** * Minimal `fetch` shape that allows tests to inject a mock without depending * on a full DOM `Response` type. Compatible with both `globalThis.fetch` and * the matching helper in `../native-runway.ts`. */ export type RunwayFetchLike = (input: string, init?: { method?: string; headers?: Record; body?: string | Uint8Array; }) => Promise<{ ok: boolean; status: number; text: () => Promise; json: () => Promise; }>; export interface SubmitRunwayJobInput { apiToken: string; model: RunwayModel; textPrompt: string; mode: RunwayMode; seconds?: RunwayDurationSeconds; aspectRatio?: RunwayAspectRatio; resolution?: RunwayResolution; seed?: number; /** * Optional END keyframe (UseAPI asset id). Seedance 2.0 (and Gen-4.5 / Kling 3 * / Veo 3.1) keyframe-interpolation mode: the clip animates from * `startFrameAssetId` (image A) to `endFrameAssetId` (image B). Requires * `startFrameAssetId`; ignored without it. Lets two stills become one * continuous shot. */ endFrameAssetId?: string; /** Optional fetch override (defaults to global fetch). Used by tests + native wrapper. */ fetchImpl?: RunwayFetchLike; /** * UseAPI asset id (not a URL) — e.g. "user:2305-runwayml:email@example.com:uuid". * Switches Gen-4.5 / Gen-4 into image-to-video mode. Not supported on * /runwayml/videos/create for all models — check the endpoint docs. */ firstImageAssetId?: string; /** * UseAPI asset id used as the Seedance-2 keyframe (first frame) on the * unified /runwayml/videos/create endpoint. Distinct from * firstImageAssetId (Gen-4.x i2v) — Seedance-2 uses startFrameAssetId. */ startFrameAssetId?: string; /** * Seedance-2 multi-reference image asset ids (up to 11). When more than one * is supplied on the `seedance-2.0` model, the request emits individual * `imageAssetId1`..`imageAssetIdN` fields (1-based, capped at 11) and does * NOT set `startFrameAssetId` — keyframe mode and multi-reference mode are * mutually exclusive per the UseAPI Runway contract. Exactly one id keeps the * single-keyframe `startFrameAssetId` path. See * `references/video/seedance-transport-payloads.md` (Gateway B). */ imageAssetIds?: string[]; /** * Force multi-reference mode even for a SINGLE image asset id. Set when the * lone image is a character reference (not a keyframe): it must go into * `imageAssetId1`, never `startFrameAssetId`, so a character sheet is never * the literal first frame of the video (the grid-open bug). */ forceMultiRef?: boolean; /** * Seedance-2 multi-reference video asset ids (up to 3). Emitted as * `videoAssetId`, `videoAssetId2`, `videoAssetId3`. */ videoAssetIds?: string[]; /** * Request provider-generated audio (`audio: true` on the body). Seedance-2 then * generates speech/ambience — and, when a voice-reference video is supplied via * `videoAssetIds`, speaks the dialogue in that cloned voice (the r2v voice-lock). * Only emitted on the `seedance-2.0` model. Default off → byte-identical legacy. */ audio?: boolean; } /** Runway Seedance-2 caps: up to 11 image refs, up to 3 video refs. */ export declare const RUNWAY_MAX_IMAGE_REFS = 11; export declare const RUNWAY_MAX_VIDEO_REFS = 3; export interface SubmitRunwayJobResult { /** Namespaced taskId, e.g. "user:N-runwayml:email@x:task:uuid". Use as-is in poll/fetch. */ taskId: string; } export declare function submitRunwayJob(input: SubmitRunwayJobInput): Promise; export interface PollRunwayJobInput { apiToken: string; /** Namespaced taskId from SubmitRunwayJobResult. */ taskId: string; /** Optional fetch override (defaults to global fetch). */ fetchImpl?: RunwayFetchLike; } export type RunwayPollStatus = 'pending' | 'running' | 'completed' | 'failed'; export interface RunwayArtifact { /** Signed CloudFront URL of the rendered video. JWT in query string — expires. */ url?: string; /** Pre-signed JPG preview thumbnails (typically 3-5 frames sampled across the clip). */ previewUrls?: string[]; /** Reusable Runway asset id for chaining into i2v / multi-shot workflows. */ assetId?: string; fileSize?: string; metadata?: { duration?: number; frameRate?: number; dimensions?: [number, number]; [key: string]: unknown; }; [key: string]: unknown; } export interface PollRunwayJobResult { status: RunwayPollStatus; /** 0.0 - 1.0 progress fraction, parsed from UseAPI's stringy progressRatio. */ progress: number; artifacts: RunwayArtifact[]; raw: Record; } export declare function pollRunwayJob(input: PollRunwayJobInput): Promise; export interface FetchRunwayResultInput { apiToken: string; taskId: string; /** Optional fetch override (defaults to global fetch). */ fetchImpl?: RunwayFetchLike; } export interface FetchRunwayResultResult { videoUrl: string | null; thumbnailUrl: string | null; raw: Record; } /** * Convenience: poll once and extract the first artifact's video + thumbnail URLs. * Use after a poll has returned status='completed'. */ export declare function fetchRunwayResult(input: FetchRunwayResultInput): Promise; export interface RegisterRunwayAccountInput { apiToken: string; email: string; password: string; maxJobs: number; } export interface RegisterRunwayAccountResult { /** JWT bearer token UseAPI uses to authenticate against the user's Runway session. */ token: string; /** UseAPI internal account id. */ id: number; exp: number; iat: number; } export declare function registerRunwayAccount(input: RegisterRunwayAccountInput): Promise; //# sourceMappingURL=runway-useapi.d.ts.map