Skip to main content
The Queue API is the primary way to process videos with the Swift SDK. Submit jobs that are processed asynchronously in the background, then poll for status and retrieve results when complete.
All video processing (video editing, restyling, motion control) uses the Queue API. For image editing, use the Process API.

Overview

The Queue API is accessed via client.queue and provides four main methods:
  • submit() - Submit a job and get a job ID immediately
  • status() - Check the status of a submitted job
  • result() - Retrieve the completed video
  • submitAndPoll() - Submit and automatically poll until completion

Submit a Job

Submit a video editing job and receive a job ID immediately:
Returns:
  • jobId - Unique identifier for the job
  • status - Initial status (.pending)

Check Job Status

Poll the status of a submitted job:
Status Values:

Get Job Result

Retrieve the video data once the job is completed:
Returns: Data — the raw video bytes

Submit and Poll

The easiest way to use the Queue API — submit a job and automatically poll until completion:
Parameters:
  • model (required) - Video model from Models.video()
  • input (required) - Typed input for the model
  • onStatusChange (optional) - Closure called on each status change
Returns: QueueJobResult
  • .completed(jobId: String, data: Data) - Video data on success
  • .failed(jobId: String, error: String) - Error message on failure

Video Editing

Transform videos with prompt and optional reference image using lucy_2:
VideoEditInput parameters:
  • prompt (required) - Text description of the transformation
  • data (required) - Input video as FileInput
  • referenceImage (optional) - Reference image as FileInput
  • seed (optional) - Random seed for reproducible results
  • resolution (optional) - Output resolution (.res720p or .res480p)
  • enhancePrompt (optional) - Auto-enhance the prompt

Video Restyling

Restyle videos using either a text prompt or a reference image (but not both) with lucy_restyle_2:
VideoRestyleInput parameters:
  • prompt (optional) - Text description of style (required if no referenceImage)
  • data (required) - Input video as FileInput
  • referenceImage (optional) - Reference image (required if no prompt)
  • seed (optional) - Random seed
  • resolution (optional) - Output resolution
  • enhancePrompt (optional) - Auto-enhance the prompt
You must provide either prompt or referenceImage, but not both. The SDK validates this at initialization.

Manual Polling

For custom polling logic, use submit(), status(), and result() separately:

Error Handling


Supported Models

All video models support queue processing:

API Reference

client.queue.submit(model:input:)

Submit a job for processing. Parameters:
  • model: VideoModel - Video model
  • input - Typed input (VideoEditInput, VideoRestyleInput, or VideoToVideoInput)
Returns: JobSubmitResponse
  • jobId: String - Unique job identifier
  • status: JobStatus - Initial status (.pending)

client.queue.status(jobId:)

Check the status of a job. Parameters:
  • jobId: String - The job identifier
Returns: JobStatusResponse
  • jobId: String - Job identifier
  • status: JobStatus - Current status

client.queue.result(jobId:)

Get the result of a completed job. Parameters:
  • jobId: String - The job identifier
Returns: Data - Video bytes

client.queue.submitAndPoll(model:input:onStatusChange:)

Submit a job and poll until completion. Parameters:
  • model: VideoModel - Video model
  • input - Typed input
  • onStatusChange: ((JobStatusResponse) -> Void)? - Optional status callback
Returns: QueueJobResult

Next Steps

Process API

Synchronous image editing

Realtime API

Transform video streams in realtime with WebRTC