I'm using a paid Eleven Labs account.
The JavaScript above works fine - sending the request, playing the response in JS, passing the URL of the response to a global variable, then in the event sheet, setting the Audio plugin's "Add remote URL" to that var and playing it (so I can insert effects).
This is everything I need, but I was trying to do it all in event sheets, but something's not working in the events in the screenshot above. If I download AJAX.LastData, I see stuff like this in the header:
ID3 #TSSE Lavf60.16.100
But VLC won't play it and presumably also why I get "EncodingError: Unable to decode audio data" when trying to play it in the event sheet using the actions in the screenshot.