Text2Video Workflow
Generate videos from text descriptions using advanced AI models.
This workflow extends the base ComfyUI Workflow functionality to support text-to-video generation.
Supported Models to Workflow ID Mapping
1
Hunyuan
Before you start
Define environment variables in
.env
file:
Copy
XALORA_API_KEY=your_api_key
XALORA_WORKFLOW_URL=https://sequencer-v2.xalora.xyz
Example Request
Copy
import Xalora from 'xalora'
const xalora = new Xalora({
apiKey: process.env['XALORA_API_KEY']
});
async function generateVideo() {
const text2VideoTask = new Text2VideoTask({
workflow_id: '1',
prompt: 'a rabbit moving quickly in a beautiful winter scenery nature trees sunset tracking camera',
timeout_seconds: 600 // optional
});
const response = await xalora.workflow.executeWorkflowAndWaitForResult(
text2VideoTask,
600000, // 10 minutes timeout
15000 // 15 seconds polling interval
);
console.log('Generated video URL:', response.result);
}
Example Response
Copy
{
"task_id": "7599f1f038",
"create_timestamp": 1733965543,
"inference_latency": 0.608921,
"upload_latency": 2.316333,
"task_type": "txt2vid",
"status": "finished",
"result": "https://example.com/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
true
The ID of the workflow to execute.
prompt
string
true
The prompt to use for the video generation.
width
number
false
The width of the video. Default is 848.
height
number
false
The height of the video. Default is 480.
length
number
false
The length of the video in frames. Default is 37.
steps
number
false
The number of steps to use for the video generation. Default is 30.
seed
number
false
The seed to use for the video generation.
fps
number
false
The frames per second of the video. Default is 24.
quality
number
false
The quality of the video. Default is 80.
job_id_prefix
string
false
An optional prefix for the job ID. Default is “sdk-workflow”.
timeout_seconds
number
false
The timeout for the task in seconds. If the task is not finished within the timeout, it will be canceled.
consumer_id
string
false
The ID of the consumer.
api_key
string
false
The API key of the consumer.
Returns
Type: WorkflowTaskResult
task_id
string
true
The ID of the executed task.
status
enum
true
The status of the task.
result
any
false
The result of the task, if available.
task_details
any
false
The details of the task, if available.
timeout_seconds
number
false
The timeout for the task in seconds.
workflow_id
string
false
The ID of the workflow that executed the task.
create_timestamp
number
false
The timestamp when the task was created.
inference_latency
number
false
The latency of the inference in seconds.
upload_latency
number
false
The latency of the upload in seconds.
Authentication
Authentication uses a combined consumer ID and API key format: consumerId#apiKey
. You can provide these in two ways:
In the Xalora client initialization using environment variables:
Copy
const xalora = new Xalora({
apiKey: process.env['XALORA_API_KEY'] // format: consumerId#apiKey
});
In the
Text2VideoTask
object, the task-specific values will override the client defaults if provided.
Copy
const text2VideoTask = new Text2VideoTask({
consumer_id: 'consumerId',
api_key: 'apiKey',
...
});
Types
Text2VideoTask
A class representing a text-to-video task, extending the abstract WorkflowTask
class.
Copy
class 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
}
}
}
WorkflowTaskType
An enum representing the types of workflow tasks.
Copy
enum WorkflowTaskType {
Text2Video = 'txt2vid'
}
Last updated