Skip to main content

Hunyuan Image Generation Model Upgrade Guide

The image generation credits granted by the Mini Program Growth Initiative Phase 1 currently use the hunyuan-image model. This model will be shut down at 00:00 on June 30, 2026.

Please complete the migration before the shutdown date by switching to hunyuan-image-v3.0-v1.0.4. If the migration is not completed before the deadline, the system will automatically switch to hunyuan-image-v3.0-v1.0.4.

After the upgrade, the image generation credits from the Mini Program Growth Initiative can continue to be used with hunyuan-image-v3.0-v1.0.4.


Affected Models

Old Model NameNew Model Name
hunyuan-imagehunyuan-image-v3.0-v1.0.4

The new model hunyuan-image-v3.0-v1.0.4 supports custom aspect ratios, prompt rewriting, and a thinking-based rewriting mode, resulting in higher quality image generation.


Migration Guide

Image generation is only supported in Cloud Functions (Node.js SDK). Updating the model parameter in generateImage is all that is needed to complete the upgrade:

Using @cloudbase/node-sdk

Before:

const cloudbase = require('@cloudbase/node-sdk');
const app = cloudbase.init({ env: process.env.ENV_ID });
const ai = app.ai();

exports.main = async (event) => {
const { prompt } = event;

const imageModel = ai.createImageModel('hunyuan-image');
const res = await imageModel.generateImage({
model: 'hunyuan-image',
prompt,
});

return { url: res.data[0].url };
};

After:

const cloudbase = require('@cloudbase/node-sdk');
const app = cloudbase.init({ env: process.env.ENV_ID });
const ai = app.ai();

exports.main = async (event) => {
const { prompt } = event;

const imageModel = ai.createImageModel('hunyuan-image');
const res = await imageModel.generateImage({
model: 'hunyuan-image-v3.0-v1.0.4',
prompt,
size: '1024x1024', // optional, supports custom aspect ratio
revise: { value: true }, // optional, enable prompt rewriting
enable_thinking: { value: true }, // optional, enable thinking mode
});

return { url: res.data[0].url };
};

Using wx-server-sdk

Before:

const cloud = require('wx-server-sdk')
cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV })

exports.main = async (event, context) => {
const imageModel = cloud.ai().createImageModel('hunyuan-image')
const res = await imageModel.generateImage({
model: 'hunyuan-image',
prompt: event.prompt,
})
return { url: res.data[0].url }
}

After:

const cloud = require('wx-server-sdk')

cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
timeout: 150000, // HTTP request timeout 150s, overrides the ~15s default
})

const ALLOWED_SIZES = ['1024x1024', '1280x720', '720x1280', '1280x1280']

exports.main = async (event, context) => {
const prompt = (event.prompt || '').trim()
if (!prompt) {
return { error: 'Please enter a prompt' }
}
if (prompt.length > 500) {
return { error: 'Prompt must be 500 characters or less' }
}

const size = ALLOWED_SIZES.includes(event.size) ? event.size : '1024x1024'

const imageModel = cloud.ai().createImageModel('hunyuan-image')
const res = await imageModel.generateImage({
model: 'hunyuan-image-v3.0-v1.0.4',
prompt,
size,
revise: { value: false },
enable_thinking: { value: false },
})

return {
url: res.data[0].url, // Image URL, valid for 24 hours
revisedPrompt: res.data[0].revised_prompt, // Optimized prompt
}
}

The new model supports additional parameters. See Node SDK and wx-server-sdk for details.


Getting Help

If you run into issues during migration, visit the CloudBase Community or submit a support ticket for 1-on-1 assistance.