---
title: "Speech in & out (STT / TTS)"
description: "AiHummer speaks and listens out of the box: free/local faster-whisper for STT and edge-tts for TTS, wired as sidecars and driven by POST /v1/voice/turn."
updated: "2026-09-15"
---

AiHummer handles **speech in and speech out of the box** — no paid speech API
required. An incoming audio clip is transcribed (STT), the text drives a normal
agent turn, and the answer is spoken back (TTS). Both engines are **free and
local** and run as [sidecars](/en/v1.7/architecture/sidecars/): faster-whisper for
transcription and edge-tts for synthesis.

## How a voice turn works

A voice turn is a normal agent turn with audio on both ends:

1. The gateway sends the inbound audio to the **STT sidecar** (`:8001`,
   faster-whisper) and gets back text.
2. That text drives the usual function-calling turn — same router, orchestrator,
   tools and memory as a text message.
3. The reply text is sent to the **TTS sidecar** (`:8002`, edge-tts) and the
   spoken audio is returned to the caller.

This is exposed as a single endpoint, `POST /v1/voice/turn`, so a channel or
client can hand over audio and receive audio without orchestrating the steps
itself.

## The endpoints

| Method | Endpoint | Purpose |
|---|---|---|
| `POST` | `/v1/voice/turn` | Audio in → agent turn → audio out |
| `GET` | `/v1/voice/config` | Current voice configuration (engines, tuning knobs) |

```http
POST /v1/voice/turn HTTP/1.1
Host: localhost:8780
Content-Type: application/json

{
  "audio": "<base64-encoded clip>",
  "format": "wav"
}
```

> [!NOTE]
> Speech features are part of **core** — they are not tied to the SIP plugin. The
> SIP channel uses these same STT/TTS engines for its `local` engine, but voice
> in/out works for any client that calls `/v1/voice/turn`.

## The voice sidecars

| Port | Sidecar | Engine | Role | Wired with |
|---|---|---|---|---|
| 8001 | STT | faster-whisper | speech → text | `AIHUMMER_STT_URL` |
| 8002 | TTS | edge-tts | text → speech | `AIHUMMER_TTS_URL` |

Both engines are free and local: nothing is sent to a paid speech vendor. As with
every sidecar, the gateway reaches them **by URL**, so you can run them next to
the gateway or point at a shared instance.

## Wiring

The host-native installer sets the STT and TTS URLs for you. They are **catalog
settings** — change them from the admin UI (**Management → Settings**) or with
`aihummer settings set`; `gateway.env` is bootstrap-only and ignored for these:

```bash
# Voice in/out (auto-configured by the installer)
aihummer settings set AIHUMMER_STT_URL http://127.0.0.1:8001
aihummer settings set AIHUMMER_TTS_URL http://127.0.0.1:8002
```

> [!TIP]
> Because each sidecar is just a URL, several gateways can share one STT/TTS
> instance. Centralise the heavier speech services instead of running a copy per
> host.

## Tuning the audio path

Voice quality knobs live in the **"Media · Voice"** settings group and are
configurable from the web admin UI — no redeploy needed. They cover the
real-time audio path:

| Knob | What it controls |
|---|---|
| Duplex | Full-duplex (listen while speaking) vs half-duplex |
| AEC | Acoustic echo cancellation |
| Noise suppression | Filters background noise before STT |
| AGC | Automatic gain control (level normalisation) |
| VAD threshold | Voice-activity detection sensitivity |
| Barge-in | Let the caller interrupt the agent mid-answer |

`GET /v1/voice/config` returns the effective configuration so a client can
discover the active engines and these settings.

## Automatic spoken replies

Three settings in the **“Media · Voice”** group (Web UI → **Manage →
Settings**) decide when a finished reply is spoken:

| Setting | Key | Values |
|---|---|---|
| Automatic voice replies | `AIHUMMER_TTS_AUTO_REPLY` | `off` — never; `always` — always; `inbound` (default) — only in response to incoming audio; `tagged` — when the agent explicitly tags the reply for speech |
| Spoken reply character limit | `AIHUMMER_TTS_MAX_CHARS` | `0` (default) — speak the full reply; `100`–`10000` — limit of the spoken text |
| Summarize long spoken replies | `AIHUMMER_TTS_SUMMARIZE` | on by default: a long reply is shortened by the model to the limit; if the model is unavailable, the beginning of the text is spoken |

The full reply text stays in the conversation history in every mode. `off`
disables only automatic speech — an explicit synthesis request through the
`tts` tool still works.

For a single conversation the agent can override these values at the
participant’s request with the `voice_preferences` tool (read the effective
values) and `set_voice_preferences` (set `auto`, `max_chars`, `summarize`; an
empty object restores the instance defaults). Writing is available only to a
member of the conversation. Spoken output picks up a provider connected after
the gateway started and respects the current user’s preferences.

## Where to next

- The transport model behind these services:
  [Sidecars](/en/v1.7/architecture/sidecars/).
- Speech translation and video understanding:
  [Speech translation & video](/en/v1.7/voice/diarization-translation-clone/).
- Voice on a phone line:
  [SIP telephony](/en/v1.7/channels/sip/).
