Skip to navigation

Text-to-Speech Quickstart

From API key to a playable audio file, fast
Generate my first audio file
Write a small script that turns a string into a playable audio file with the Speechify API. Use the official SDK, read `SPEECHIFY_API_KEY` from the environment, pick a voice from the catalog, and save the audio to disk. Follow [https://docs.speechify.ai/build/text-to-speech-quickstart.md](https://docs.speechify.ai/build/text-to-speech-quickstart.md).

The fastest path from nothing to a playable audio file. Follow the steps in order and you will hear generated speech at the end.

1

Get your API key

  1. Sign up at platform.speechify.ai
  2. Go to API Keys
  3. Copy your default API key (or create a new one)
export SPEECHIFY_API_KEY="your-api-key-here"

API keys are sensitive. Never expose them in client-side code or public repositories. See the Authentication guide for security best practices.

2

Install the SDK

pip install speechify-api
3

Generate speech

POST
/v1/audio/speech
from speechify import Speechify
client = Speechify(
token="YOUR_TOKEN_HERE",
)
client.audio.speech(
audio_format="mp3",
input="Hello! This is the Speechify text-to-speech API.",
model="simba-3.2",
voice_id="geffen_32",
)
Response
{
"audio_data": "example",
"audio_format": "wav",
"billable_characters_count": 10,
"speech_marks": {
"chunks": [
{}
],
"end": 1,
"end_time": 1,
"start": 1,
"start_time": 1,
"type": "example",
"value": "example"
}
}
4

Save and play

Assign the call above to response, then write the audio to output.mp3:

import base64
with open("output.mp3", "wb") as f:
f.write(base64.b64decode(response.audio_data))

Then play it:

afplay output.mp3
For new integrations, use model: "simba-3.2" with any English voice such as geffen_32. See Models.

Next steps