Text2Video Workflow
Cinna Text-to-Video Workflow
Generate high-quality videos directly from text using Cinna’s distributed AI infrastructure. This workflow extends ComfyUI functionality and is executed on decentralized GPUs coordinated through Solana.
Overview
The text-to-video workflow allows you to describe a scene in natural language and receive an AI-generated video as output. The process runs across compute providers in the Cinna network, ensuring scalability, transparency, and efficiency.
Supported Models
1
Hunyuan
Before You Begin
Request your Cinna API key
Configure the following in your
.env
file:
envCopy codeCINNA_API_KEY=your_api_key
CINNA_WORKFLOW_URL=https://sequencer-v2.cinna.ai
Example Request
tsCopy codeimport Cinna from 'cinna'
const cinna = new Cinna({
apiKey: process.env['CINNA_API_KEY']
})
async function generateVideo() {
const task = new Text2VideoTask({
workflow_id: '1',
prompt: 'a rabbit moving quickly in a beautiful winter scenery nature trees sunset tracking camera',
timeout_seconds: 600
})
const response = await cinna.workflow.executeWorkflowAndWaitForResult(
task,
600000,
15000
)
console.log('Generated video URL:', response.result)
}
Example Response
jsonCopy code{
"task_id": "7599f1f038",
"create_timestamp": 1733965543,
"inference_latency": 0.608921,
"upload_latency": 2.316333,
"task_type": "txt2vid",
"status": "finished",
"result": "https://sequencer-v2.cinna.ai/files/generated-video.webp",
"task_details": {
"parameters": {
"fps": 24,
"height": 480,
"length": 37,
"prompt": "a rabbit moving quickly in a beautiful winter scenery nature trees sunset tracking camera",
"quality": 80,
"seed": 704883238463297,
"steps": 30,
"width": 848
}
},
"timeout_seconds": 600,
"workflow_id": "1"
}
Parameters
Type: Text2VideoTask
workflow_id
string
yes
ID of the video generation workflow
prompt
string
yes
Text description of the video
width
number
no
Width of the output video (default is 848)
height
number
no
Height of the output video (default is 480)
length
number
no
Length of the video in frames (default is 37)
steps
number
no
Inference steps (default is 30)
seed
number
no
Optional seed for reproducibility
fps
number
no
Frames per second (default is 24)
quality
number
no
Output quality (default is 80)
job_id_prefix
string
no
Optional identifier prefix
timeout_seconds
number
no
Maximum duration before the task is canceled
consumer_id
string
no
Optional consumer ID override
api_key
string
no
Optional API key override
Return Type
Type: WorkflowTaskResult
task_id
string
Unique task identifier
status
enum
Current status of the task
result
any
Output URL or content
task_details
any
Input parameters and metadata
timeout_seconds
number
Maximum duration allowed
workflow_id
string
ID of the workflow used
create_timestamp
number
Task creation time
inference_latency
number
Duration of model inference
upload_latency
number
Time taken to upload the result
Authentication
Cinna uses a combined format for authentication: consumerId#apiKey
. You can pass this information in two ways:
Option 1: During client initialization
tsCopy codeconst cinna = new Cinna({
apiKey: process.env['CINNA_API_KEY'] // Format: consumerId#apiKey
})
Option 2: In the task itself
tsCopy codeconst task = new Text2VideoTask({
consumer_id: 'yourConsumerId',
api_key: 'yourApiKey',
...
})
Task Class Definition
tsCopy codeclass Text2VideoTask extends WorkflowTask {
constructor(options: Text2VideoTaskOptions)
get task_type(): WorkflowTaskType.Text2Video
get task_details(): {
parameters: {
prompt: string
width?: number
height?: number
length?: number
steps?: number
seed?: number
fps?: number
quality?: number
}
}
}
Workflow Task Type
tsCopy codeenum WorkflowTaskType {
Text2Video = 'txt2vid'
}
Last updated