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:
| Parameter | Type | Required | Description |
|---|---|---|---|
image_urls | list<string> | No | List of reference image URLs; mutually exclusive with images |
images | list<string> | No | List of base64-encoded reference images; mutually exclusive with image_urls |
Reference Image Requirements
- Use either
image_urlsorimages(base64);imagestakes 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
- wx-server-sdk — WeChat Mini Program Cloud Functions
- Node SDK — Cloud Functions / Cloud Run
- JS SDK — Node.js server environment