Skip to content

Media & data

Text-to-speech

Convert text to natural-sounding speech with an OpenAI-compatible TTS API. Voices come from Deepgram Aura, ElevenLabs and Voxtral.

Endpoint

POSThttps://api.ppq.ai/v1/audio/speech

Parameters

ParameterTypeRequiredDescription
input
string
Yes
The text to convert to speech. Maximum 2,000 characters for Deepgram and 5,000 for ElevenLabs.
model
string
No
"deepgram_aura_2" for Deepgram, "tinfoil-voxtral-tts" for Voxtral, or an ElevenLabs model such as "eleven_multilingual_v2" or "eleven_flash_v2_5".
voice
string
No
Voice ID. Deepgram: an Aura voice such as "aura-2-arcas-en". ElevenLabs: a voice ID such as "JBFqnCBsd6RMkjVDRZzb". Default: the provider's default voice.
language
string
No
ISO 639-1 language code, for example "en", "pt", "es", "fr", "de" or "it".

Notes:

  • GET /v1/audio/models lists every text-to-speech model.
  • With language and no voice, the API picks a compatible voice for that language.
  • With both language and voice, the API checks that the voice supports the language and returns 422 if it doesn't.
  • tinfoil-voxtral-tts runs in a private TEE and has the lowest cost. It's billed per 1,000 characters, with a small minimum per 1,200-character chunk, shown as pricing.min_per_request in GET /v1/audio/models.

Voices

Some of the Deepgram Aura voices:

Voice IDNameStyle
aura-2-arcas-en
Arcas
Natural, smooth, clear
aura-2-thalia-en
Thalia
Clear, confident, energetic
aura-2-andromeda-en
Andromeda
Casual, expressive
aura-2-helena-en
Helena
Caring, natural, friendly
aura-2-apollo-en
Apollo
Confident, comfortable
aura-2-aries-en
Aries
Warm, energetic, caring

GET /v1/audio/voices returns every voice across all providers (Deepgram, ElevenLabs and Voxtral). Filter by language with the language query parameter: the response includes the voices for that language plus multilingual voices.

# All voices
curl https://api.ppq.ai/v1/audio/voices

# Voices for Portuguese
curl https://api.ppq.ai/v1/audio/voices?language=pt

# Voices for Spanish
curl https://api.ppq.ai/v1/audio/voices?language=es

Code examples

from pathlib import Path

import requests
from openai import OpenAI

# Initialize client with PayPerQ API
client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.ppq.ai/v1"
)

# Generate speech — auto-select voice for Portuguese
response = requests.post(
    "https://api.ppq.ai/v1/audio/speech",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "model": "deepgram_aura_2",
        "input": "Olá, bem-vindo ao PayPerQ!",
        "language": "pt"  # ISO 639-1 code; HTTP allows omitting voice
    },
    timeout=60
)
response.raise_for_status()
Path("output.mp3").write_bytes(response.content)

# Or specify a voice explicitly (must match the language)
response2 = client.audio.speech.create(
    model="eleven_multilingual_v2",
    voice="JBFqnCBsd6RMkjVDRZzb",  # George (multilingual)
    input="Hello, welcome to PayPerQ!",
    extra_body={"language": "en"}
)
response2.stream_to_file("output_en.mp3")