#how can i save to file nothing is working. i have looked at the documentation

1 messages · Page 1 of 1 (latest)

dusty patio
#

This is my code:

import openai
from elevenlabs import set_api_key, save
from elevenlabs.api import History
import ffmpeg

set_api_key("hidden")


history = History.from_api()
LAST_ITEM = history.last_history_item_id

import requests

url = "https://api.elevenlabs.io/v1/history/" + LAST_ITEM + "/audio"
print(url)

headers = {
  "Accept": "audio/mpeg",
  "xi-api-key": "hidden"
}

response = requests.get(url, headers=headers)

save(response.content, "myfile.mp3")

But it just prints out a load of ��5�0�!�▲"ل��t♀Q}qC����C$��!¶6��♀P���2�đ5�n�^�ia�%�↑p��y0���♦☺�¶8♀]
☺]�J3→�▲J��}��S��0↨↓��ZU#f��fc�]�4�f�cS�S?U[�l�U[^� when I try to print the response. No audio is saved in the directory either.

gentle rock
#

You're trying to print out audio?

#

You cannot brint audio bytes, that's why