Skip to content

Create speech

POST /v1/audio/speech turns text into one audio file. Authenticate with a bearer key.

HTTP
POST https://api.spero.patientdesk.ai/v1/audio/speech
Authorization: Bearer sp_live_...
Content-Type: application/json

{
  "model": "spero-v1",
  "input": "Your order ships on Tuesday.",
  "voice": "spero-f1",
  "response_format": "mp3"
}

Parameters

NameValues
inputRequired. 1 to 2,000 characters.
modelspero-v1, the default.
voicespero-f1 (female, the default) or spero-m1 (male). Both are US English.
response_formatmp3 (the default), wav, flac, opus or pcm (16-bit, 24 kHz, mono).

These answer 400 with a plain message: stream: true, a speed other than 1, and any unknown voice.

Examples

curl https://api.spero.patientdesk.ai/v1/audio/speech \
  -H "Authorization: Bearer $SPERO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "spero-v1", "input": "Your order ships on Tuesday.", "voice": "spero-f1"}' \
  --max-time 300 \
  --output speech.mp3

Long text

Up to 600 characters render whole. Longer text is split at sentence ends, rendered in parts and joined, so a full 2,000 characters takes about 3 minutes. Set your client's timeout to match.

Speed

A two-sentence passage takes about 30 seconds, and a full 2,000 characters about 3 minutes, because each request renders six takes and keeps a clean one. Nothing is returned until the file is ready.

Response

On success, the body is the audio. These headers come with it:

HeaderMeaning
X-ModelThe model that rendered it.
X-VoiceThe voice that rendered it.
X-CharactersCharacters charged.
X-Audio-SecondsLength of the audio.
X-Cost-USDWhat this request cost.
X-Queue-Wait-MsTime spent waiting in the queue.
X-Request-IdThe id shown on your Requests page.
X-DisclosureAI-generated audio

All audio from Spero is AI-generated. The terms say when you must tell your listeners.

Your data

Spero stores neither your text nor the audio. It records counts only: characters, audio length, cost and status.