> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: HTTP
api: "POST /v1/tts/generate"
description: Synthesize full audio from text and return it as base64 JSON.
gridGap: 30
---

# Synthesize speech

`POST` `https://api.vakyam.ai/v1/tts/generate`

Synthesizes the full input text and returns base64-encoded audio in a JSON
envelope. The entire audio is generated before the response is returned. For
lower latency, see [HTTP streaming](/api-reference/speech-stream) or the
[WebSocket endpoint](/api-reference/speech-websocket).

> **Note:**
> **`voice_name` is deprecated** and will be removed after a migration window. Use
> the new `voice` parameter instead — it accepts a preset voice name (e.g.
> `Archana`) or a custom voice ID beginning with `vc_`. `voice_name` remains
> temporarily accepted for preset voices only and cannot be combined with `voice`.

#### cURL

```bash
curl https://api.vakyam.ai/v1/tts/generate \
  -H "Authorization: Bearer $VAKYAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "வணக்கம், நான் வாக்யம் AI பேசுகிறேன்.",
    "model_id": "raaga-v1",
    "voice": "Archana",
    "language": "ta-IN",
    "output_format": "mp3"
  }'
```



#### Python

```python
response = client.tts.generate(
    text="வணக்கம், நான் வாக்யம் AI பேசுகிறேன்.",
    model_id="raaga-v1",
    voice="Archana",
    language="ta-IN",
    output_format="mp3",
)
response.save("speech.mp3")
```



#### JavaScript

```ts
const speech = await client.tts.generate({
  text: "வணக்கம், நான் வாக்யம் AI பேசுகிறேன்.",
  model_id: "raaga-v1",
  voice: "Archana",
  language: "ta-IN",
  output_format: "mp3",
});
```



#### 200 Success

```json
{
  "audio": "SUQzBAAAAAAA...",
  "format": "mp3",
  "duration_seconds": 2.4,
  "characters_used": 36
}
```



#### 402 No credits

```json
{
  "error": {
    "status_code": 402,
    "code": "insufficient_credits",
    "message": "Your account has 120 credits remaining but this request requires 250."
  }
}
```



#### 422 Invalid voice

```json
{
  "error": {
    "status_code": 422,
    "code": "voice_language_not_found",
    "message": "No voice named 'Mohan' found for language 'ta-IN'."
  }
}
```



#### 429 Rate limited

```json
{
  "error": {
    "status_code": 429,
    "code": "rate_limit_exceeded",
    "message": "You have exceeded 60 requests per minute. Retry after 23 seconds."
  }
}
```



#### 429 Too many in flight

```json
{
  "error": {
    "status_code": 429,
    "code": "concurrency_limit_exceeded",
    "message": "This account already has 3 synthesis requests in flight, which is the maximum allowed at once. Wait for one to finish before starting another."
  }
}
```

## Authorization

- `Authorization` (string, required) — Bearer token: `Bearer vak_live_<key>`.

## Body

#### Request body

```json
{
  "text": "வணக்கம், நான் வாக்யம் AI பேசுகிறேன்.",
  "model_id": "raaga-v1",
  "voice": "Archana",
  "language": "ta-IN",
  "output_format": "mp3",
  "sample_rate": 24000,
  "speed": 1.0
}
```

- `text` (string, required) — Text to synthesize. Maximum 3000 Unicode characters.

- `model_id` (string, required) — Model identifier. Must be `raaga-v1`.

- `voice` (string, required) — Voice selector. A preset voice name (e.g. `Archana`) or a custom voice ID beginning with `vc_`. A preset voice must form a valid pair with `language` — see [Voices](/concepts/voices-and-languages). Send either `voice` or the deprecated `voice_name`, not both.

- `voice_name` (string, deprecated) — **Deprecated** — use `voice` instead. Temporarily accepted for preset voices only (it cannot select `vc_` custom voices) and will be removed after the migration window.

- `language` (string, required) — BCP 47 language code: `en-IN`, `hi-IN`, `ta-IN`, `te-IN`, `kn-IN`, `mr-IN`, `gu-IN`, or `bn-IN`.

- `output_format` (string, default mp3) — Audio format: `mp3`, `wav`, `pcm`, or `mulaw`.

- `sample_rate` (integer, default 24000) — Output sample rate in Hz. One of `8000`, `16000`, `24000`, or `48000`.

- `speed` (number, default 1.0) — Playback speed multiplier, `0.5`–`2.0`.

## Response

#### Response

```json
{
  "audio": "SUQzBAAAAAAA...",
  "format": "mp3",
  "duration_seconds": 2.4,
  "characters_used": 36
}
```

- `audio` (string) — Base64-encoded audio data. Decode it to get the raw audio bytes.

- `format` (string) — Output format of the returned audio.

- `duration_seconds` (number) — Duration of the synthesized audio in seconds.

- `characters_used` (integer) — Unicode characters consumed from your credit balance.

---

*Powered by [holocron.so](https://holocron.so)*
