foreign-sapphire
foreign-sapphire2h ago

custom voice and doesn't work custom LLM

Hey team 👋 I’m working with a Custom Voice + Custom LLM setup. I found two related issues that look like an internal mismatch in how Vapi handles streaming when using custom providers: 1️⃣ When using my custom voice, the first message never plays unless I use a recorded URL workaround. Even with firstMessageMode: "assistant-speaks-first", Vapi doesn’t send the text to my TTS endpoint on the first turn. 2️⃣ Now, I’ve noticed that when my custom LLM streams via SSE, Vapi sometimes calls it with Accept: application/json instead of text/event-stream, even during voice calls with stream: true. → When this happens, my LLM returns JSON fine, but Vapi stays silent (no logs, no voice, nothing) and streaming doesn`t work also. So basically, Vapi sometimes: • Calls the LLM expecting SSE but doesn’t send the correct Accept header. • Or calls the voice endpoint in JSON mode when it should be streaming. Both issues break the real-time flow between my Custom LLM and Custom Voice. Environment: • Custom Voice → Cloud Run (SSE streaming implemented) • Custom LLM → Cloud Functions (SSE streaming implemented) • Region: europe-southwest1 Could you confirm if Vapi internally switches between JSON and SSE depending on the voice provider? And if there’s a way to force Vapi to always request Accept: text/event-stream for telephony or streaming assistants? The call id is: 0199ca2a-abd0-7cc4-93a7-f0640665c9da Thanks! 🙏🍉
1 Reply
Vapi
Vapi2h ago
Suggestion:
To help debug and potentially workaround the Accept header issue, add a request logging middleware to your custom LLM and TTS endpoints to capture and inspect all incoming headers. For example, in Express.js:
app.use('/api/synthesize', (req, res, next) => {
console.log('Headers:', req.headers);
next();
});
app.use('/api/synthesize', (req, res, next) => {
console.log('Headers:', req.headers);
next();
});
This will let you verify exactly what Vapi sends and help you identify if/when Accept: text/event-stream is missing, so you can adjust your endpoint logic or report the precise behavior to Vapi support for further assistance.
See the Vapi custom TTS docs for more debugging tips. Source: - Custom TTS integration
⤵️ Mention @Vapi Support Bot for follow-ups 🐥

Did you find this page helpful?