ian
12/05/2025, 1:59 AMVapi Support Bot
12/05/2025, 2:00 AMtypescript
res.setHeader("Content-Type", "text/event-stream");
res.write(`data: ${JSON.stringify({ delta: "Working on it..." })}\n\n`);
// Call your LLM and stream its output
for await (const chunk of openAIResponse) {
res.write(`data: ${JSON.stringify(chunk)}\n\n`);
}
res.write("data: [DONE]\n\n");
res.end();
This lets you immediately inform the user, then stream the LLM's response as it becomes available.
For more details, see the [Vapi Custom LLM tool-calling integration guide](https://docs.vapi.ai/customization/tool-calling-integration).
Source:
- [Custom LLM Tool Calling Integration](https://docs.vapi.ai/customization/tool-calling-integration)