Browse documentation

Audio

Generate speech

View as Markdown
Convert text into speech, store the result privately, and download it with the same API key.

Create speech

Speech completes in the request and returns a private MP3 file URL.
POST/v1/speech/generations
Bearer authentication required
cURL
curl https://api.byta-ai.com/v1/speech/generations \
  -H "Authorization: Bearer $BYTA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Byta-Audio-1.1",
    "input": "Welcome to Byta AI.",
    "voice": "alloy",
    "language": "en",
    "speed": 1
  }'
200 OK
{
  "id": "d07144aaddd8420ab9d0ea4d8aaa352f",
  "object": "speech_generation",
  "status": "completed",
  "modelId": "Byta-Audio-1.1",
  "creditsCharged": 1,
  "audio": {
    "id": "cc85a3897a3545878755290b24e2d4b4",
    "mimeType": "audio/mpeg",
    "sizeBytes": 184320,
    "url": "https://api.byta-ai.com/v1/speech/generations/d071.../files/cc85..."
  }
}

Parameters

inputrequired
string

Text to speak, up to 4,096 characters.

modeloptional
string

An enabled speech model from GET /v1/models.

voiceoptional
string

A supported voice identifier, up to 128 characters.

languageoptional
string

Supported language code. Defaults to en.

speedoptional
number

Playback speed from 0.25 through 4.0.

Download audio

GET/v1/speech/generations/{generationId}/files/{fileId}
Use the same Bearer key; add ?download=1 for attachment disposition.

Audio URLs are private

Do not expose the API key in a browser. Proxy or stream the file from your server.

Pricing

ModelCredits per 1,000 characters
Byta-Audio-1.115
Byta-Audio-1.1-Pro20