This workflow extends the base ComfyUI Workflow functionality to support text-to-image generation using LoRA models.

Example Request

import Heurist from 'heurist'

const heurist = new Heurist({
  apiKey: process.env['HEURIST_API_KEY']
});

async function generateImage() {
  const fluxLoraTask = new FluxLoraTask({
    workflow_id: '3',
    prompt: 'A photo of GECKO with dark green skin spots playing american football, cartoon, comic, anime',
    lora_name: 'gecko',
    timeout_seconds: 300 // optional
  });

  const response = await heurist.workflow.executeWorkflowAndWaitForResult(
    fluxLoraTask,
    600000,  // 10 minutes timeout
    3000     // 3 seconds polling interval
  );

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

Example Response

{
  "task_id": "9034a6ca80",
  "task_type": "txt2img",
  "workflow_id": "3",
  "status": "finished",
  "timeout_seconds": 300,
  "create_timestamp": 1738916890,
  "result": "https://sequencer-v2.heurist.xyz/files/flux-lora/flux-lora-0x737c3fcc8def561dbE0D3de8Cc3B0646574b7651-9034a6ca80.jpg",
  "miner_id": "0x737c3fcc8def561dbE0D3de8Cc3B0646574b7651",
  "queue_position": 1,
  "inference_latency": 18.42825,
  "msg": ""
}

Workflow ID Mapping

Workflow IDModel
3FluxLora

Parameters

Type: FluxLoraTask

PropertyTypeRequiredDescription
workflow_idstringtrueThe ID of the workflow to execute.
promptstringtrueThe prompt to use for the video generation.
lora_namestringtrueThe name of the LoRA model to use.
widthnumberfalseThe width of the image. Default is 680.
heightnumberfalseThe height of the image. Default is 1024.
stepsnumberfalseThe number of steps to use for the image generation. Default is 15.
noise_seednumberfalseThe seed to use for the image generation. Default is 966993914913986.
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 FluxLoraTask object, the task-specific values will override the client defaults if provided.
const fluxLoraTask = new FluxLoraTask({
  consumer_id: 'consumerId',
  api_key: 'apiKey',
  ...
});

Types

FluxLoraTask

A class representing a FluxLora task, extending the abstract WorkflowTask class.

class FluxLoraTask extends WorkflowTask {
  constructor(options: FluxLoraTaskOptions)
  get task_type(): WorkflowTaskType.FluxLora
  get task_details(): {
    parameters: {
      prompt: string
      lora_name: string
      width?: number
      height?: number
      steps?: number
      noise_seed?: number
    }
  }
}

WorkflowTaskType

An enum representing the types of workflow tasks.

enum WorkflowTaskType {
  FluxLora = 'flux-lora'
}