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

# Voice CLI

> CLI commands for text-to-speech and speech-to-text

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    User([User]) --> Agent[Agent]
    Agent --> Output([Output])

    classDef agent fill:#8B0000,stroke:#7C90A0,color:#fff
    classDef tool fill:#189AB4,stroke:#7C90A0,color:#fff

    class Agent agent
    class User,Output tool
    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff
```

# Voice CLI Commands

The `praisonai-ts` CLI provides the `voice` command for text-to-speech and speech-to-text operations using OpenAI.

## Quick Start

**1. Simple Usage**

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { createOpenAIVoice } from 'praisonai';

const voice = createOpenAIVoice();

// Text to speech
const audio = await voice.speak("Hello world", { voice: 'nova' });

// Speech to text
const text = await voice.listen(audioBuffer);
```

**2. With Configuration**

See the sections below for advanced options.

***

## Commands Overview

| Command | Description |
| - | - |
| `voice speak <text>` | Convert text to speech |
| `voice transcribe <file>` | Transcribe audio file to text |
| `voice voices` | List available voices |
| `voice providers` | List voice providers |
| `voice help` | Show help |

## Text-to-Speech

Convert text to audio:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Basic speech generation
praisonai-ts voice speak "Hello, how are you today?"

# Specify a voice
praisonai-ts voice speak "Welcome to PraisonAI" --voice nova

# Specify output file
praisonai-ts voice speak "Hello world" --file greeting.mp3

# JSON output
praisonai-ts voice speak "Test message" --json
```

**Example Output:**

```
✓ Speech saved to: speech_1705123456789.mp3
  Size: 45632 bytes
```

**JSON Output:**

```json theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
{
  "success": true,
  "data": {
    "text": "Hello world",
    "voice": "alloy",
    "file": "greeting.mp3",
    "size": 45632
  }
}
```

## Speech-to-Text

Transcribe audio files:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Transcribe an audio file
praisonai-ts voice transcribe recording.mp3

# JSON output
praisonai-ts voice transcribe meeting.wav --json
```

**Example Output:**

```
Transcription

Hello, this is a test recording for the voice transcription feature.
```

**JSON Output:**

```json theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
{
  "success": true,
  "data": {
    "file": "recording.mp3",
    "text": "Hello, this is a test recording..."
  }
}
```

## List Voices

View available voice options:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai-ts voice voices
praisonai-ts voice voices --json
```

**Available Voices:**

| Voice | Style | Best For |
| - | - | - |
| `alloy` | Neutral, balanced | General purpose |
| `echo` | Warm, engaging | Conversational |
| `fable` | Expressive, dynamic | Storytelling |
| `onyx` | Deep, authoritative | Professional |
| `nova` | Friendly, bright | Customer service |
| `shimmer` | Clear, optimistic | Tutorials |

## Options

| Option | Description | Default |
| - | - | - |
| `--voice <name>` | Voice to use | `alloy` |
| `--file <path>` | Output file path | Auto-generated |
| `--json` | JSON output | `false` |

## Environment Variables

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Required for voice features
export OPENAI_API_KEY=sk-...
```

## SDK Usage

For programmatic voice usage:

```typescript theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import { createOpenAIVoice } from 'praisonai';

const voice = createOpenAIVoice();

// Text to speech
const audio = await voice.speak("Hello world", { voice: 'nova' });

// Speech to text
const text = await voice.listen(audioBuffer);
```

For more details, see the [Voice SDK documentation](https://praison.ai/docs/js/voice.md).

## Related

> [card] [Voice](https://praison.ai/docs/js/voice.md)
>
> Voice overview

> [card] [Audio](https://praison.ai/docs/js/audio.md)
>
> Audio overview


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.