Beta: The API is currently in beta and may change.

API Reference

The Tontaube API provides text-to-speech capabilities via a simple REST interface.

Get Started

  1. 1 Create an API key in your Dashboard
  2. 2 Include the key in the X-API-Key header on every request
  3. 3 Make requests to the base URL below
Base URL https://api.tontaube.ai/v1

Authentication

All requests require an X-API-Key header with a valid API key. Keys start with ttb_live_.

Example Request
curl https://api.tontaube.ai/v1/speech/speakers \
  -H "X-API-Key: ttb_live_..."
GET /speech/speakers

Returns a list of available speakers for speech generation.

Response Body

Returns an array of speaker objects.

Field Type Description
id string (UUID) Unique speaker identifier
name string Display name
voice_key string Internal voice key
gender string | null Speaker gender
language_restrictions string[] | null Supported languages (null = all)
curl
curl https://api.tontaube.ai/v1/speech/speakers \
  -H "X-API-Key: ttb_live_..."
Response
[
  {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "name": "Aria",
    "voice_key": "aria_v1",
    "gender": "female",
    "language_restrictions": null
  }
]
POST /speech/generate

Generate speech audio from text. Deducts balance based on character count.

Request Body

Parameter Type Required Description
text string Yes Text to synthesize (max 30,000 characters)
speaker_id string Yes UUID of speaker from /speech/speakers
language string No Only English is currently supported; defaults to "en".
format string No Only wav is currently supported and is the default.

Response

Returns the generated audio as a binary stream with the appropriate content-type.

Response Headers

Header Description
X-Sample-Rate Sample rate of the generated audio
X-Audio-Duration Duration in seconds
X-Cost-USD Cost of this request in USD
X-Balance-USD Remaining account balance in USD
curl
curl -X POST https://api.tontaube.ai/v1/speech/generate \
  -H "X-API-Key: ttb_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello world",
    "speaker_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "language": "en",
    "format": "wav"
  }' \
  --output speech.wav
Coming Soon

Python SDK

A first-class Python client with async support, automatic retries, and type hints. Available on PyPI once the SDK exits private beta.

Python
pip install tontaube Not yet available
tontaube_example.py
import tontaube

# Initialize the client
client = tontaube.Client(api_key="your_key")

# Create a voice from a single file
# (or choose from our library of voices)
voice_id = client.create_voice(
    audio_file="sample.mp3"
)

audio = client.generate_speech(
    text="Hello world, this is Tontaube.",
    voice_id=voice_id
)