#How to download voice reading from chatgpt
1 messages · Page 1 of 1 (latest)
Hi @sleek wadi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
To download a voice reading (spoken audio) from ChatGPT, you need to use OpenAI’s Text-to-Speech (TTS) API or the audio capabilities of the Chat Completions API. Here’s how you can do it:
1. Using the Text-to-Speech API
You can generate and download spoken audio from text using the /v1/audio/speech endpoint. Here’s a Python example:
from pathlib import Path
from openai import OpenAI
client = OpenAI()
speech_file_path = Path("speech.mp3")
with client.audio.speech.with_streaming_response.create(
model="gpt-4o-mini-tts",
voice="alloy", # or any supported voice
input="Your text to be read aloud goes here.",
instructions="Speak in a cheerful and positive tone.", # optional
) as response:
response.stream_to_file(speech_file_path)
This will save the generated audio as an MP3 file on your device. You can also use other formats like wav, opus, etc. by specifying the response_format parameter. For more details, see the Text to Speech guide.
2. Using the Chat Completions API with Audio Output
If you want more control (e.g., dynamic instructions, accents, or context-aware speech), you can use the gpt-4o-audio-preview model with the Chat Completions API:
import base64
from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
model="gpt-4o-audio-preview",
modalities=["text", "audio"],
audio={"voice": "alloy", "format": "wav"},
messages=[
{
"role": "user",
"content": "Your text to be read aloud goes here."
}
]
)
wav_bytes = base64.b64decode(completion.choices[0].message.audio.data)
with open("output.wav", "wb") as f:
f.write(wav_bytes)
This will save the audio as a WAV file. You can adjust the voice and format as needed. More details are available in the [Audio and speech guide](<https://platform.openai.com/docs/guides/audio#add-audio-to-your-existing-application>).
---
**Note:** If you are using the ChatGPT app or web interface, there is currently no built-in feature to directly download the voice output. The above methods require using the OpenAI API and some programming.
**Usage Policy Reminder:** If you use the TTS API, you must clearly disclose to end users that the voice is AI-generated and not a human voice, as per OpenAI’s [usage policies](<https://platform.openai.com/docs/guides/text-to-speech#page-top>).
---
**Summary:**
- Use the TTS API or Chat Completions API to generate and download voice readings.
- Save the output audio file using the provided code examples.
- No direct download option exists in the ChatGPT app or web interface at this time.
Sources:
- [Text to speech guide](<https://platform.openai.com/docs/guides/text-to-speech#page-top>)
- [Audio and speech guide](<https://platform.openai.com/docs/guides/audio#add-audio-to-your-existing-application>)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
@sleek wadi Kapa.ai is still learning and improving, please let me know how I did by reacting below.