Skip to main content

Image-to-Image

The Hunyuan image-to-image model accepts a reference image (base image) alongside a text prompt, enabling the generated output to more closely match the desired composition and style.

Model

Use the HY-Image-v3.0-I2I-ToB-v1.0.1 model for image-to-image generation.

Parameters

Image-to-image supports all text-to-image parameters, plus the following reference image parameters:

ParameterTypeRequiredDescription
image_urlslist<string>NoList of reference image URLs; mutually exclusive with images
imageslist<string>NoList of base64-encoded reference images; mutually exclusive with image_urls
Reference Image Requirements
  • Use either image_urls or images (base64); images takes priority
  • Maximum 1 image, up to 10MB
  • Supported formats: jpg, jpeg, png

Usage Example

const imageModel = ai.createImageModel('hunyuan-image')
const res = await imageModel.generateImage({
model: 'HY-Image-v3.0-I2I-ToB-v1.0.1',
prompt: 'Convert this photo to an oil painting style',
image_urls: ['https://example.com/reference.jpg'],
revise: { value: true },
})

console.log(res.data[0].url)

Access Methods