> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slng.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# TTS caching

Speech synthesis is often the most expensive step in a voice agent. Greetings, confirmations, and hold messages repeat on every call. TTS caching stores the audio for a phrase the first time it is synthesized, then reuses it on later calls.

By policy, the cache is isolated per organization and PII-aware, so your audio is not stored where another customer can reach it. Cached audio expires on a sliding schedule: phrases that keep coming up stay cached, and unused ones age out.

## Skip the cache

TTS caching is on by default for every use case. It runs the same way whether the audio comes from an SLNG-hosted model or BYOK.

To skip the cache for a connection, send the `X-Slng-Cache-Bypass` header set to `true`. The gateway then neither reads nor writes cached audio for that connection. Leave the header out, or set it to `false`, to keep caching on.

```javascript Skip the cache theme={null}
import WebSocket from "ws";

const ws = new WebSocket(
  "wss://api.slng.ai/v1/tts/slng/deepgram/aura:2-en",
  {
    headers: {
      Authorization: `Bearer ${process.env.SLNG_API_KEY}`,
      "X-Slng-Cache-Bypass": "true",
    },
  }
);

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.
```

## SLNG models and your own keys

Caching works the same whether the agent uses an SLNG-hosted model or a model on your own provider key. There is nothing extra to set up for either.

## Regions

TTS caching is region-aware and organization-scoped: your speech is never synthesized or hosted in another region.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.