Skip to main content
Version: 1.11.0-beta

WAN Image 2.2 Generation

Generate images using the WAN Image 2.2 workflow with dual LoRA support for enhanced control over image generation.

Overview

The WAN Image 2.2 workflow allows you to use two separate LoRA models simultaneously with different strength settings, providing fine-grained control over the generation process. This is particularly useful for combining different style or subject LoRAs to achieve specific artistic effects.

Important: When using model_type: "wan-image-2.2", both lora_low_name and lora_high_name parameters are required. The SDK will throw an error if either is missing.

Note: The workflow_type parameter is deprecated. Use model_type: "wan-image-2.2" instead.

Method Signature

client.images.generate(params: GenerateImageInput)

Parameters

ParameterTypeRequiredDescription
promptstringYesThe text prompt for image generation
widthnumberYesImage width (64-2048)
heightnumberYesImage height (64-2048)
model_idstringYesUUID of the model to use
model_type"wan-image-2.2"YesMust be set to "wan-image-2.2"
lora_low_namestringYesPath to the low-strength LoRA model (required for WAN Image 2.2)
lora_low_strengthnumberNoStrength for low LoRA (0-2, default: 0.5)
lora_high_namestringYesPath to the high-strength LoRA model (required for WAN Image 2.2)
lora_high_strengthnumberNoStrength for high LoRA (0-2, default: 1.0)
batch_sizenumberNoNumber of images to generate (1-4, default: 1)
guidancenumberNoGuidance scale (0-100)
model_weightnumberNoModel weight (0-1)
webhook_urlstringNoURL for webhook notifications

Example Usage

Basic Generation with Dual LoRAs (Required)

// WAN Image 2.2 requires both LoRA parameters
const result = await client.images.generate({
prompt: "A female model in vintage fashion, natural lighting",
width: 1200,
height: 1500,
model_id: "your-model-uuid",
model_type: "wan-image-2.2",
lora_low_name: "wan2.2/wan2.2-lora-instagirl-2.0/Instagirlv2.0_lownoise.safetensors", // Required
lora_low_strength: 0.5,
lora_high_name: "wan2.2/wan2.2-lora-instagirl-2.0/Instagirlv2.0_hinoise.safetensors", // Required
lora_high_strength: 1.0,
batch_size: 1
});

console.log("Generated image:", result.image_url);

Error Handling for Missing LoRAs

The SDK will throw an error if you don't provide both LoRA names:

try {
const result = await client.images.generate({
prompt: "Professional portrait photography",
width: 1024,
height: 1024,
model_id: "your-model-uuid",
model_type: "wan-image-2.2"
// Missing lora_low_name and lora_high_name - will throw error
});
} catch (error) {
console.error(error.message);
// "WAN Image 2.2 workflow requires both lora_low_name and lora_high_name parameters"
}

With Webhook for Progress Updates

const result = await client.images.generate({
prompt: "Artistic fashion photography",
width: 1200,
height: 1500,
model_id: "your-model-uuid",
model_type: "wan-image-2.2",
lora_low_name: "path/to/style-lora.safetensors",
lora_low_strength: 0.4,
lora_high_name: "path/to/subject-lora.safetensors",
lora_high_strength: 0.9,
webhook_url: "https://your-webhook-endpoint.com/progress"
});

Response

The method returns a GenerateImageOutput object:

{
runId: string;
status: string;
progress: number;
liveStatus: string;
run_type: string;
image_url?: string;
}

Notes

  • The WAN Image 2.2 workflow uses a predefined negative prompt optimized for high-quality generation
  • The dual LoRA system allows for complex style mixing not possible with single LoRA workflows
  • LoRA strengths can be fine-tuned to balance between different styles or subjects
  • The workflow is particularly effective for fashion, portrait, and artistic photography

Comparison with Other Workflows

FeatureDefaultWANWAN Image 2.2
Single LoRA
Dual LoRA
Custom LoRA Strength✓ (per LoRA)
Optimized Negative Prompt
Batch Generation

Error Handling

try {
const result = await client.images.generate({
// ... parameters
workflow_type: "wan-image-2.2"
});
} catch (error) {
console.error("Generation failed:", error.message);
// Handle specific error cases
}