elevenlabs-docs
elevenlabs-docs copied to clipboard
sound generation code sample not valid
Path: /api-reference/sound-generation
Hey the official code sample on this doc is not valid
method: 'POST',
headers: { 'Content-Type': 'application/json', 'xi-api-key': '....' },
body: '{"text":"butterfly flapping sounds","duration_seconds":10,"prompt_influence":0.6}',
};
fetch('https://api.elevenlabs.io/v1/sound-generation', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
It would give this err
SyntaxError: Unexpected token '�', "����v="... is not valid JSON
at JSON.parse (<anonymous>)
at parseJSONFromBytes (node:internal/deps/undici/undici:5917:19)
at successSteps (node:internal/deps/undici/undici:5888:27)
at fullyReadBody (node:internal/deps/undici/undici:2106:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async specConsumeBody (node:internal/deps/undici/undici:5897:7)
```