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

# Command-line interface

> Install the voiceai CLI and run text-to-speech, speech-to-text, and streaming examples from a terminal.

`voiceai` is a single static binary that wraps the SLNG API. Use it to generate audio, transcribe files, stream over WebSocket, and pipe audio between tools.

## Install

<CodeGroup>
  ```bash curl theme={null}
  curl -fsSL https://slng.ai/install.sh | sh
  ```

  ```bash Homebrew theme={null}
  brew install slng-ai/tap/voiceai
  ```

  ```bash npm theme={null}
  npm install -g voiceai-cli
  ```
</CodeGroup>

Verify the install:

```bash theme={null}
voiceai --help
```

<Note>
  On macOS, the `curl`-installed binary is unsigned. If the first run is blocked by Gatekeeper, run `xattr -d com.apple.quarantine $(which voiceai)` or right-click → Open in Finder once.
</Note>

## Authenticate

Get an SLNG key from [app.slng.ai](https://app.slng.ai/api-keys), then export it in your shell:

```bash theme={null}
export VOICEAI_API_KEY="zpka_..."
```

Or save it to the CLI config:

```bash theme={null}
voiceai config set api-key zpka_...
```

The config lives at `~/.config/voiceai/config.json`. Environment variables take precedence.

## Text-to-speech

Synthesize audio from text. By default the CLI plays the audio and saves a copy to `$TMPDIR/voiceai-tts/`.

```bash theme={null}
voiceai tts "Hello from sunny Barcelona!" \
  --model slng/deepgram/aura:2-en \
  --voice aura-2-thalia-en \
  --out hello.mp3
```

Pipe raw audio when stdout is not a terminal:

```bash theme={null}
voiceai tts "stream me" --model slng/deepgram/aura:2-en > out.mp3
```

Stream chunks over WebSocket for long text or low-latency playback:

```bash theme={null}
voiceai tts "long passage…" --stream | ffplay -
```

## Speech-to-text

Transcribe a file:

```bash theme={null}
voiceai stt micro-machines.wav --model slng/deepgram/nova:3-en
```

Stream from the microphone:

```bash theme={null}
voiceai stt --stream
```

Pipe raw PCM from `arecord` or any source:

```bash theme={null}
arecord -f S16_LE -r 16000 -c 1 | voiceai stt --stream --source stdin
```

## Discover models and voices

```bash theme={null}
voiceai models               # list all models
voiceai voices --model slng/deepgram/aura:2-en
```

## Configuration

Defaults that the CLI reads from `~/.config/voiceai/config.json`:

| Key                 | Purpose                                       |
| ------------------- | --------------------------------------------- |
| `api-key`           | Default `VOICEAI_API_KEY`                     |
| `default-tts-model` | Model used when `--model` is omitted on `tts` |
| `default-tts-voice` | Voice used when `--voice` is omitted on `tts` |
| `default-stt-model` | Model used when `--model` is omitted on `stt` |
| `base-url`          | Override the API host (rarely needed)         |

Set any of them with `voiceai config set <key> <value>`. Override per-invocation with the matching flag.

## Source and releases

* Source: [github.com/slng-ai/sdks](https://github.com/slng-ai/sdks)
* Releases: [github.com/slng-ai/sdks/releases](https://github.com/slng-ai/sdks/releases). Tags prefixed `cli-v*` are CLI builds; everything else is for the SDKs.
