> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upliftai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Text to Speech

> Generate complete audio buffers with client.tts.create()

## `client.tts.create(request)`

Returns the full audio buffer in a single response. Best for batch/offline use where you don't need real-time playback.

```typescript theme={null}
import UpliftAI from '@upliftai/sdk-js';
import { writeFileSync } from 'fs';

const client = new UpliftAI({
  apiKey: 'your-api-key',
});

const { audio, metadata } = await client.tts.create({
  text: 'السلام علیکم، یہ ایک ٹیسٹ ہے',
  voiceId: 'v_meklc281',
  outputFormat: 'MP3_22050_128',
});

writeFileSync('output.mp3', audio);
console.log('Metadata:', metadata);
console.log(`Audio size: ${audio.length} bytes`);
```

### Request Parameters

| Parameter                   | Type     | Required | Description                                                    |
| --------------------------- | -------- | -------- | -------------------------------------------------------------- |
| `text`                      | `string` | Yes      | Text to synthesize (Urdu, English, or mixed)                   |
| `voiceId`                   | `string` | Yes      | Voice profile ID (e.g. `v_meklc281`)                           |
| `outputFormat`              | `string` | No       | Audio format — defaults to `WAV_22050_32`                      |
| `phraseReplacementConfigId` | `string` | No       | ID from [phrase replacements](/sdk/nodejs/phrase-replacements) |

### Response

| Field                  | Type     | Description              |
| ---------------------- | -------- | ------------------------ |
| `audio`                | `Buffer` | Complete audio data      |
| `metadata.requestId`   | `string` | Request ID for debugging |
| `metadata.contentType` | `string` | MIME type of the audio   |
| `metadata.sampleRate`  | `number` | Audio sample rate        |
