# Vietnamese voice agents on Vapi, LiveKit and Pipecat

Source: https://docs.vieneu.io/docs/integrations/voice-agents

A voice agent needs two things to work in Vietnamese: a voice that speaks it, and
a way to tell when the caller has **finished** speaking. VieNeu gives you the
first. The second belongs to the platform, and on all three platforms below the
smart end-of-turn models are weakest — or absent — for Vietnamese. This page
covers both halves.

## The voice: which VieNeu route per platform {#voice}

| Platform | VieNeu route | Notes |
|---|---|---|
| **Vapi** | `POST /v1/vapi/speech` (Vapi's `custom-voice` provider) | Raw PCM at the rate Vapi asks for. See [Vapi](../cloud-api/vapi.md). |
| **LiveKit Agents** | `POST /v1/audio/speech` through `livekit-plugins-openai` | Set `response_format="pcm"` and keep the plugin at 24 kHz. |
| **Pipecat** | `POST /v1/audio/speech` | Pipecat's `OpenAITTSService` **cannot** be used as shipped — see below. |

### LiveKit Agents {#livekit-voice}

```python
from livekit.plugins import openai

tts = openai.TTS(
    base_url="https://api.vieneu.io/api/v1",
    api_key="vn_sk_...",
    model="vieneu-v4",
    voice="Ngọc Lan",
    response_format="pcm",
)
```

What we measured against `livekit-plugins-openai` 1.8.12 with a stand-in for the
API:

- **Set `voice`.** The plugin's default voice is an OpenAI name, which VieNeu
  answers with 400.
- **Set `response_format="pcm"`.** The plugin then asks for a stream by itself
  (`stream_format` `audio` for `tts-1`, `sse` for any other model name) and audio
  starts before the sentence has finished rendering. Left at its default `mp3`,
  each sentence arrives as one complete file.
- **Leave the plugin's `sample_rate` at 24000.** It never sends a rate and never
  reads `X-Sample-Rate`, so at any other setting VieNeu's 24 kHz PCM plays at the
  wrong speed.

### Pipecat {#pipecat-voice}

Pipecat's `OpenAITTSService` (checked with `pipecat-ai` 1.16.0) checks `voice`
against OpenAI's thirteen voice names **before it sends anything**. A VieNeu voice
such as `Ngọc Lan` is refused on the client with an `ErrorFrame` and no request
is made; an OpenAI name gets through the client and is then refused by VieNeu,
which does not map those names. No value passes both sides.

Two more problems sit behind that one: the service never asks for a stream (each
sentence arrives only once it is fully rendered), and it stamps frames with the
pipeline's sample rate, so 24 kHz audio in a 16 kHz pipeline plays a third too
slow.

What works today: write a small `TTSService` of your own that posts to
`https://api.vieneu.io/api/v1/audio/speech` with `response_format: "pcm"`,
`stream_format: "audio"` and a `sample_rate` equal to your pipeline's output
rate, and pushes the bytes as they arrive. A packaged VieNeu service for Pipecat
is built and tested, but not published yet.

## Turn-taking in Vietnamese {#turn-taking}

The agent decides the caller is done either from **silence** (voice-activity
detection plus a wait) or from a **model** that reads the words or the audio and
guesses whether the sentence is complete. The model is what stops an agent from
jumping in at every pause. For Vietnamese it is weak or missing on every
platform here, so plan on silence-based endpointing that you tune yourself.

Checked against each platform's own documentation on 2026-11-30.

### Pipecat: Smart Turn covers Vietnamese, least accurately {#pipecat-turns}

Smart Turn v3 lists Vietnamese among its 23 languages, but Vietnamese is the
**lowest** row in the model's published benchmarks: **79.38 %** on v3.2 (CPU),
against 92.63 % overall and 96.96 % for the best language (Korean). Roughly one
end-of-turn call in five is wrong.

It still beats silence alone, and it is the default stop strategy in recent
Pipecat versions. Keep it, and keep the VAD's `stop_secs` short (0.2 s, the
default) as Smart Turn expects:

```python
from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import LocalSmartTurnAnalyzerV3
from pipecat.audio.vad.silero import SileroVADAnalyzer
from pipecat.audio.vad.vad_analyzer import VADParams
from pipecat.processors.aggregators.llm_response_universal import (
    LLMContextAggregatorPair,
    LLMUserAggregatorParams,
)
from pipecat.turns.user_stop import TurnAnalyzerUserTurnStopStrategy
from pipecat.turns.user_turn_strategies import UserTurnStrategies

user_aggregator, assistant_aggregator = LLMContextAggregatorPair(
    context,
    user_params=LLMUserAggregatorParams(
        user_turn_strategies=UserTurnStrategies(
            stop=[TurnAnalyzerUserTurnStopStrategy(turn_analyzer=LocalSmartTurnAnalyzerV3())]
        ),
        vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.2)),
    ),
)
```

Smart Turn's own `stop_secs` (default 3 s) is the backstop: after that much
silence the turn ends even if the model judged it incomplete. Import paths move
between Pipecat releases; check them against yours.

### LiveKit Agents: the turn detector does not list Vietnamese {#livekit-turns}

LiveKit's turn-detector models list 14 languages, and Vietnamese is not one of
them. LiveKit's guidance for a language the model does not cover is VAD-only turn
detection, which you choose yourself:

```python
from livekit.agents import AgentSession
from livekit.plugins import silero

session = AgentSession(
    vad=silero.VAD.load(),
    turn_handling={
        "turn_detection": "vad",
        "endpointing": {"min_delay": 0.5, "max_delay": 3.0},
        "interruption": {"min_duration": 0.5, "min_words": 0},
    },
    # stt=..., llm=..., tts=...
)
```

The values shown are LiveKit's defaults. The two that matter most in Vietnamese:

- `endpointing.min_delay` — the silence that ends a turn. Raise it if the agent
  cuts callers off mid-thought; lower it if replies feel slow.
- `interruption.min_words` — how many transcribed words it takes to interrupt
  the agent (needs STT). At `0`, any sound interrupts, including a caller's
  "ừ… dạ" while listening.

`turn_handling` also takes a `TurnHandlingOptions` object. These options moved
into it in recent 1.x releases; older versions took flat arguments on
`AgentSession`. Check the names against your version.

### Vapi: use transcription endpointing, and fill in the phrase lists {#vapi-turns}

Vapi's `livekit` smart endpointing is English-only; for other languages Vapi
recommends its own `vapi` provider, which waits on punctuation in the transcript
(`transcriptionEndpointingPlan`). Interruptions are governed by
`stopSpeakingPlan`, which has two lists you supply yourself:

- `acknowledgementPhrases` — phrases that **never** interrupt the assistant;
- `interruptionPhrases` — phrases that **always** interrupt it at once.

Their defaults are English, so a Vietnamese agent needs its own (see
[the word lists below](#word-lists)):

```json
{
  "startSpeakingPlan": {
    "smartEndpointingPlan": { "provider": "vapi" },
    "transcriptionEndpointingPlan": {
      "onPunctuationSeconds": 0.1,
      "onNoPunctuationSeconds": 1.5,
      "onNumberSeconds": 0.5
    }
  },
  "stopSpeakingPlan": {
    "numWords": 2,
    "acknowledgementPhrases": ["…Vietnamese acknowledgements…"],
    "interruptionPhrases": ["…Vietnamese stop phrases…"]
  }
}
```

The timing values are Vapi's defaults. `numWords` above 0 makes the assistant
wait for that many transcribed words before yielding, so a lone "dạ" does not
stop it. Vapi does not document whether your lists replace or extend the English
defaults, nor how phrases are matched; test with real calls.

Pick a transcriber that supports Vietnamese, and check its language list; Vapi's
multilingual guide names which providers detect languages automatically.

## Vietnamese word lists for turn-taking {#word-lists}

These lists and timings come from VieNeu's own Vietnamese voice assistant. They
are a starting point; adjust them to how your callers talk.

Transcripts are compared word by word after lowercasing. Vietnamese writes each
syllable apart, so `đúng rồi` is two words.

**Hesitations** — sounds that are never a turn and never an interruption:

```text
à ạ á ả ơ ờ ớ ở ồ ô ố ừm ừa ờm hừm hừ ư um uhm uh ah oh er erm hmm hm mm mhm
```

**Acknowledgements** — the listener following along. Not an interruption,
**unless the agent has just asked a question**: after "Bạn muốn nghe tiếp
không?", a lone `có` is the answer, not noise.

```text
ừ dạ vâng ok okay oke kê yeah yes yep no nope được có không đúng rồi thế hả
```

**Stop phrases** — when a talk-over **starts** with one of these, the agent stops,
whatever follows:

```text
dừng · ngừng · thôi · khoan · đợi · chờ · im · stop · wait · hold on · sai rồi · nhầm rồi · không phải
```

### Plugging them in

- **Vapi:** put the hesitations and acknowledgements in
  `stopSpeakingPlan.acknowledgementPhrases` and the stop phrases in
  `interruptionPhrases`. A fixed list cannot tell `có` the acknowledgement from
  `có` the answer, so if your agent asks yes/no questions, leave `có`, `không`,
  `được`, `yes` and `no` out of the acknowledgements.
- **LiveKit and Pipecat** have no phrase lists. Check what the caller said over
  the agent in your own code, from the platform's user-transcript event:

```python
import re
import unicodedata

HESITATIONS = set("à ạ á ả ơ ờ ớ ở ồ ô ố ừm ừa ờm hừm hừ ư um uhm uh ah oh er erm hmm hm mm mhm".split())
ACKNOWLEDGEMENTS = set("ừ dạ vâng ok okay oke kê yeah yes yep no nope được có không đúng rồi thế hả".split())
STOPS = [("dừng",), ("ngừng",), ("thôi",), ("khoan",), ("đợi",), ("chờ",), ("im",), ("stop",),
         ("wait",), ("hold", "on"), ("sai", "rồi"), ("nhầm", "rồi"), ("không", "phải")]


def words(text: str) -> list[str]:
    return re.findall(r"[^\W_]+(?:['’][^\W_]+)*", unicodedata.normalize("NFC", text or "").lower())


def starts_with_stop(text: str) -> bool:
    w = words(text)
    return any(tuple(w[: len(s)]) == s for s in STOPS)


def says_something(text: str, agent_just_asked: bool = False) -> bool:
    """False when the caller only hesitated or acknowledged."""
    return any(
        w not in HESITATIONS and (agent_just_asked or w not in ACKNOWLEDGEMENTS)
        for w in words(text)
    )
```

Stop the agent when `starts_with_stop(...)` is true; let it carry on when
`says_something(...)` is false; otherwise treat the talk-over as a new turn.

### Timing that worked

- **0.7 s of silence** ends a short turn ("xin chào", "có").
- **After 1.5 s of speech, wait 1.1 s** instead. People who talk longer pause
  mid-thought, and a single 0.7 s rule cut them off.

These map onto LiveKit's `endpointing.min_delay` / `max_delay`, Vapi's
`onNoPunctuationSeconds`, and Smart Turn's `stop_secs` backstop. We did not find
a setting on these platforms that changes the wait by how long the caller has
been speaking, so pick a value between the two and adjust from real calls.

## See also

- [Vapi](../cloud-api/vapi.md) — the custom-voice route in detail, and its
  latency.
- [Streaming](../cloud-api/streaming.md) — the streaming routes compared.
- [Drop-in for OpenAI-compatible apps](./openai-clients.md) — the shared
  `/v1/audio/speech` setup and troubleshooting.
