Issue with API requests to OpenAI TTS (text to speech)

The issue with API requests to OpenAI TTS (text to speech) is primarily due to JSON syntax errors.

I want to start by saying that im not strong in JSON. Before making requests to TTS, i tried two methods:

  1. Used the operator: find & replace (not entirely sure if i did this correctly, see the screenshot below)

  2. Used the operator: formatted as JSON-safe (screenshot below, also not sure if this should be used)
    Screenshot 2024-06-27 at 08.22.46

The error appears intermittently, obviously depending on the input text.

Error code:

Workflow error - The service OpenAI - Text to Speech (tts-1) just returned an error (HTTP 400). Please consult their documentation to ensure your call is set up properly. Raw error: { “error”: { “message”: “We could not parse the JSON body of your request. (HINT: This likely means you aren’t using your HTTP library correctly. The OpenAI API expects a JSON payload, but what was sent was not valid JSON. If you have trouble figuring out how to fix this, please contact us through our help center at help.openai.com.)”, “type”: “invalid_request_error”, “param”: null, “code”: null } }

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.