File size: 1,368 Bytes
69e3856
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# S2S server with Kokoro TTS (its own voice set) backed by the local vLLM.
# Needs espeak-ng on the host: sudo apt install espeak-ng
set -euo pipefail

VLLM_PORT=50000                # must match vLLM --port
VLLM_URL="http://127.0.0.1:${VLLM_PORT}/v1"
MODEL="qwen3.5-9b"             # must match vLLM --served-model-name
VENV="$HOME/.venvs/s2s"
WS_PORT=8765                   # where the robot connects
API_KEY=""                     # vLLM doesn't check it; set if your endpoint does

[ -d "$VENV" ] || python3 -m venv "$VENV"
source "$VENV/bin/activate"
pip install -qU pip
# CPU torch first, so nothing pulls the CUDA build in
pip install -q torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
pip install -q "kokoro>=0.9.2" soundfile speech-to-speech

curl -fsS "$VLLM_URL/models" >/dev/null || { echo "vLLM not reachable at $VLLM_URL" >&2; exit 1; }

# VAD loosened for the robot's quiet mic; 0.45 keeps its own echo from barging in
exec speech-to-speech \
  --mode realtime \
  --ws_port "$WS_PORT" \
  --thresh 0.45 --min_speech_ms 256 --min_speech_continuation_ms 128 \
  --device cpu \
  --stt parakeet-tdt \
  --llm_backend responses-api \
  --tts kokoro \
  --kokoro_device cpu \
  --model_name "$MODEL" \
  --responses_api_base_url "$VLLM_URL" \
  --responses_api_api_key "$API_KEY" \
  --responses_api_stream