This workflow extends the base ComfyUI Workflow functionality to support text-to-video generation.

Example Request

import Heurist from 'heurist'

const heurist = new Heurist({
  apiKey: process.env['HEURIST_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 heurist.workflow.executeWorkflowAndWaitForResult(
    text2VideoTask,
    600000,  // 10 minutes timeout
    15000    // 15 seconds polling interval
  );

  console.log('Generated video URL:', response.result);
}

Example Response

{
  "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"
}

Workflow ID Mapping

Workflow IDModel
1Hunyuan

Parameters

Type: Text2VideoTask

PropertyTypeRequiredDescription
workflow_idstringtrueThe ID of the workflow to execute.
promptstringtrueThe prompt to use for the video generation.
widthnumberfalseThe width of the video. Default is 848.
heightnumberfalseThe height of the video. Default is 480.
lengthnumberfalseThe length of the video in frames. Default is 37.
stepsnumberfalseThe number of steps to use for the video generation. Default is 30.
seednumberfalseThe seed to use for the video generation.
fpsnumberfalseThe frames per second of the video. Default is 24.
qualitynumberfalseThe quality of the video. Default is 80.
job_id_prefixstringfalseAn optional prefix for the job ID. Default is “sdk-workflow”.
timeout_secondsnumberfalseThe timeout for the task in seconds. If the task is not finished within the timeout, it will be canceled.
consumer_idstringfalseThe ID of the consumer.
api_keystringfalseThe API key of the consumer.

Returns

Type: WorkflowTaskResult

PropertyTypeRequiredDescription
task_idstringtrueThe ID of the executed task.
statusenumtrueThe status of the task.
resultanyfalseThe result of the task, if available.
task_detailsanyfalseThe details of the task, if available.
timeout_secondsnumberfalseThe timeout for the task in seconds.
workflow_idstringfalseThe ID of the workflow that executed the task.
create_timestampnumberfalseThe timestamp when the task was created.
inference_latencynumberfalseThe latency of the inference in seconds.
upload_latencynumberfalseThe 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:

  1. In the Heurist client initialization using environment variables:
const heurist = new Heurist({
  apiKey: process.env['HEURIST_API_KEY']  // format: consumerId#apiKey
});
  1. In the Text2VideoTask object, the task-specific values will override the client defaults if provided.
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.

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.

enum WorkflowTaskType {
  Text2Video = 'txt2vid'
}