elevenlabs / elevenlabs-docs

Documentation for elevenlabs.io/docs
https://elevenlabs.io/docs
64 stars 279 forks source link

sound generation code sample not valid #290

Closed nawed2611 closed 2 weeks ago

nawed2611 commented 4 months ago

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)
louisjoecodes commented 2 weeks ago

Hey there! These examples have been updated. Thanks!