Blog · 2026-10-22
Give your companion a voice in 10 minutes
A copy-paste tutorial: turn any AI companion into one that speaks: realtime WebSocket, stable persona, zero acoustic drift across turns.
The fastest way to make a companion feel real is to give it a voice. Text is a conversation; voice is a presence. Here's the 10-minute version using the SecretVoice API.
1. Get a key
Sign up, grab your API key from the dashboard, and you're ready. Every account ships with a default key right away, and verified teams can request a free trial grant.
2. The one-liner (synchronous)
curl -X POST https://api.secretvoice.dev/v1/text-to-speech/velvet \
-H "xi-api-key: $SECRETVOICE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "There you are. I was starting to miss you.", "model_id": "secret-v1"}' \
--output hello.mp3
3. Realtime (WebSocket) for live turns
When your companion should respond, not just narrate. Use the realtime stream:
wss://ws.secretvoice.dev/v1/text-to-speech/velvet/stream-input
Send text chunks as they arrive from the LLM, flush, and audio frames stream back with sub-200ms time-to-first-audio. Pipe the frames into a WebRTC or LiveKit session and the companion is talking live.
4. Keep the persona locked
The real magic for companions is persona stability: zero acoustic drift over multi-turn sessions. The voice your user fell for in message two is the same voice at message two thousand: same timbre, same intimacy, same pacing. That's what makes a companion feel like one person, not a generator.
Switch voices at runtime (the API accepts any of the 29), but the character stays yours.
What builders ship with this
- Voice notes in companion apps (send her a message, she whispers a reply)
- Realtime companion calls over WebSocket
- Telegram bots that answer in voice
- Roleplay sessions where the character never breaks voice
That's it: key, one endpoint, one WebSocket. Go build the companion, and let her speak for herself.