> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bakbak.si/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bakbak.si/_mcp/server.

# Getting started with Bakbak TTS

This guide will help you get up and running with Bakbak TTS API in minutes.

## Prerequisites

* An API key (contact your administrator)
* HTTP client (cURL, Postman, or your preferred tool)
* Basic understanding of REST APIs

## Step 1: List Available Voices

First, discover which voices are available for your use case:

```bash
curl https://hub.getraya.app/v1/voices \
  -H "X-API-Key: <YOUR_API_KEY>"
```

> **Note**
>
> Each voice is tied to a specific model (`standard` or `m1`). When you generate speech, pass the matching `model` value — `standard` voices do not work with `"model": "m1"`, and `m1` voices do not work with `"model": "standard"`.

**Response:**

```json
{
  "voices": [
    {
      "id": "voice_001",
      "name": "Hindi Female Voice",
      "language": "hi",
      "model": "standard"
    },
    {
      "id": "voice_002",
      "name": "Marathi Male Voice",
      "language": "mr",
      "model": "m1"
    }
  ],
  "count": 2
}
```

## Step 2: Generate Speech (Non-Streaming)

Generate a complete audio file:

```bash
curl -X POST https://hub.getraya.app/v1/text-to-speech \
  -H "X-API-Key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "नमस्ते! मैं आपकी कैसे मदद कर सकता हूँ?",
    "voice_id": "voice_001",
    "model": "standard",
    "language": "hi",
    "output_format": {"container": "wav", "encoding": "pcm_s16le", "sample_rate": 24000},
    "speed": 1.0
  }'
```

> **Note**
>
> The Hindi example above uses Devanagari script, which is required for `language: "hi"`. Romanized Hindi (for example, `namaste`) is not supported. See [Best Practices](/text-to-speech/best-practices) for tips on Indic named entities in English text.

The response will be a binary audio file. Save it to a file:

```bash
curl -X POST https://hub.getraya.app/v1/text-to-speech \
  -H "X-API-Key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello", "voice_id": "voice_001", "language": "hi", "output_format": {"container": "wav", "encoding": "pcm_s16le"}}' \
  --output audio.wav
```

## Step 3: Generate Speech (Streaming)

For real-time applications, use the streaming endpoint:

```bash
curl -X POST https://hub.getraya.app/v1/text-to-speech/stream \
  -H "X-API-Key: <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello, this is a streaming example.",
    "voice_id": "voice_001",
    "model": "standard",
    "language": "hi",
    "output_format": {"container": "raw", "encoding": "pcm_s16le", "sample_rate": 24000}
  }'
```

The response uses Server-Sent Events (SSE) format. Each `chunk` event carries base64-encoded audio in the encoding you asked for, here 16-bit PCM at 24 kHz. For a phone line, ask for 8 kHz μ-law instead:

```json
"output_format": {"container": "raw", "encoding": "pcm_mulaw", "sample_rate": 8000}
```

See [Output Formats](/text-to-speech/output-formats) for every option.

## Next Steps

* Explore [Features & Capabilities](/text-to-speech/features)
* Check out [Use Cases](/text-to-speech/use-cases)
* Review [Best Practices](/text-to-speech/best-practices)
* Browse the [API Reference](/api-reference/introduction)