Discussions
Heygen video rendering error
I am trying to create a heygen video for my AI agent. Basically the heygen video should act as a front face of the AI agent where it should be able to talk whatever text the agent gives. I am using free version of the API key and as per documentation, the free version should be able to render the video upto 720p resolution without any errors.
I am using a react frontend and node backend and on my server side when I try to fetch the video to render it in my frontend I am getting the below error.
{
code: 100,
data: {
callback_id: null,
caption_url: null,
created_at: 1770087794,
duration: null,
error: {
code: 'RESOLUTION_NOT_ALLOWED',
detail: 'Please subscribe to higher plan to generate higher resolution videos',
message: 'Please subscribe to higher plan to generate higher resolution videos'
},
gif_url: null,
id: 'd13d41ae605c46cd8b1b006c518373bc',
status: 'failed',
thumbnail_url: null,
video_url: null,
video_url_caption: null
},
message: 'Success'
}
Below are the routes on my server:
app.post("/avatar/generate", async (req, res) => {
const { text } = req.body;
if (!text) {
return res.status(400).json({ error: "Text is required" });
}
const payload = {
video_inputs: [
{
character: {
type: "avatar",
avatar_id: "Abigail_expressive_2024112501",
// talking_photo_id: "8ba06b281d4b4254bd8fe5ee63966cb1"
},
voice: {
type: "text",
voice_id: "zCxc3t4ei4Z4igUPy9V8",
input_text: text,
},
},
],
video_config: {
dimension: {
width: 1280,
height: 720,
},
},
};
try {
const response = await axios.post(
"https://api.heygen.com/v2/video/generate",
payload,
{
headers: {
"X-Api-Key": HEYGEN_API_KEY,
"Content-Type": "application/json",
},
}
);
console.log(response.data);
res.json({
video_id: response.data.data.video_id,
});
} catch (err) {
console.error(
"❌ HeyGen error:",
JSON.stringify(err.response?.data, null, 2)
);
res.status(500).json(err.response?.data);
}
});
app.get("/avatar/status/:id", async (req, res) => {
try {
const response = await axios.get(
${HEYGEN_BASE}/v1/video_status.get,
{
params: { video_id: req.params.id },
headers: {
Authorization: Bearer ${HEYGEN_API_KEY},
},
}
);
console.log(response.data);
res.json(response.data.data);
} catch (err) {
console.error(err.response?.data || err.message);
res.status(500).json({ error: "Status check failed" });
}
});
To make things clear, I am using an API key not a trial key. I request the engineering team to help me resolve this issue as soon as possible.