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

---
title: HTTP Generation
description: Generate complete audio with a single HTTP request.
---

# HTTP Generation

`POST /v1/tts/generate` synthesizes your full text and returns the complete audio
in one JSON response. This is the simplest way to generate speech — use it when
you have the whole text up front and don't need to start playback before
synthesis finishes. For lower time-to-first-byte, see
[HTTP streaming](/guides/http-streaming) or the
[realtime WebSocket](/guides/realtime-websocket) guide.

## Request

Send `text`, `model_id`, `voice`, and `language`. `output_format`,
`sample_rate`, and `speed` are optional.

#### Python

```python
from vakyamai import VakyamAI

client = VakyamAI()

response = client.tts.generate(
    text="வணக்கம், நான் வாக்யம் AI பேசுகிறேன்.",
    model_id="raaga-v1",
    voice="Archana",
    language="ta-IN",
    output_format="mp3",  # mp3 | wav | pcm | mulaw
    speed=1.0,            # 0.5 - 2.0
)

response.save("speech.mp3")
```



#### JavaScript

```ts
import { VakyamAI } from "@vakyam-ai/tts";
import { writeFile } from "node:fs/promises";

const client = new VakyamAI({ apiKey: process.env.VAKYAM_API_KEY! });

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

await writeFile("speech.mp3", speech.audioBytes);
```



#### 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"
  }'
```

## Response

The response is a JSON envelope with base64-encoded audio and metadata:

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

Decode the `audio` field to get the raw audio bytes. The SDKs do this for you
(`response.audio` in Python, `speech.audioBytes` in JavaScript). With cURL:

```bash
echo "<base64-audio>" | base64 --decode > speech.mp3
```

## Notes

* Maximum **3000 Unicode characters** per request.
* `voice` + `language` must be a valid pair — see
  [Voices & languages](/concepts/voices-and-languages).
* `output_format` accepts `mp3` (default), `wav`, `pcm`, or `mulaw`.
* `sample_rate` accepts `8000`, `16000`, `24000` (default), or `48000` Hz.
* The full request and response schema is in the
  [API reference](/api-reference/speech).

---

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