Voice

Text-to-speech

Generate 24 kHz WAV speech in 19 languages with Perigee-1-tts.

from pathlib import Path
import os
import orbitalsai
 
client = orbitalsai.Client(api_key=os.environ["ORBITALSAI_API_KEY"])
 
audio = client.synthesize(
    text="Sannu, muna maraba da ku.",
    language="Hausa",
)
 
Path("welcome.wav").write_bytes(audio)

client.synthesize() waits for a queued generation and returns WAV bytes. The output is 24,000 Hz, 16-bit, mono WAV audio.

Parameters

ParameterRequiredDescription
textYesText to synthesize, up to 10,000 Unicode characters.
languageYesOne of the 19 supported TTS languages. It selects pronunciation and the standard voice conditioning.

Standard synthesis does not expose a voice_id parameter.

REST request

curl --fail-with-body \
  -H "Authorization: Bearer $ORBITALSAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Sannu, muna maraba da ku.","language":"Hausa"}' \
  "https://api.orbitalsai.com/api/v1/tts/synthesize" \
  --output welcome.wav

The response uses Content-Type: audio/wav. Usage appears in X-Usage-Characters and cost in X-Cost-Credits.

Stream audio

with open("announcement.wav", "wb") as output:
    for chunk in client.stream_speech(
        "Today’s announcement",
        language="English",
    ):
        output.write(chunk)

Common errors

  • 401: invalid or revoked API key.
  • 402: insufficient credit.
  • 422: unsupported language, empty text, or text longer than 10,000 characters.
  • 503: speech synthesis is temporarily unavailable or pricing is not configured.
  • 504: generation exceeded the request timeout.

Next steps

On this page