Free AI Text to Speech Tool | Natural Voice Generator for YouTube Videos
ELEVENLABS_API_KEY=your_api_key_hereimport fetch from "node-fetch";
export default async function handler(req, res) {
if (req.method !== "POST") {
return res.status(405).send("Method Not Allowed");
}
const { text, voiceId } = req.body;
const response = await fetch(
`https://api.elevenlabs.io/v1/text-to-speech/${voiceId}`,
{
method: "POST",
headers: {
"xi-api-key": process.env.ELEVENLABS_API_KEY,
"Content-Type": "application/json"
},
body: JSON.stringify({
text: text,
model_id: "eleven_multilingual_v2"
})
}
);
const audioBuffer = await response.arrayBuffer();
res.setHeader("Content-Type", "audio/mpeg");
res.send(Buffer.from(audioBuffer));
}
AI Text to Speech Tool
Featured Post
Free AI Text to Speech Tool | Natural Voice Generator for YouTube Videos
ELEVENLABS_API_KEY=your_api_key_hereimport fetch from "node-fetch"; export default async function handler(req, res) { if (req.m...






0 comments:
Post a Comment