Turn it on
TTS Caching can be activated for any use case. It runs the same way whether the audio comes from an SLNG-hosted model or BYOK.- WSS
You can activate or deactivate the SLNG TTS Caching with one header.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
import WebSocket from "ws";
const ws = new WebSocket(
"wss://api.slng.ai/v1/tts/slng/deepgram/aura:2-en",
{
headers: {
"X-Slng-Cache-Bypass": "false",
},
}
);
ws.on("open", () => {
ws.send(JSON.stringify({ type: "text", text: "Hello from sunny Barcelona!" }));
});
ws.on("message", (data) => {
playAudio(data); // play each chunk as it arrives
});
// Call ws.close() when the turn or session ends so the server releases resources.