> ## 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 organisation 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.

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

<Tabs>
  <Tab title="WSS" icon="code">
    You can activate or deactivate the SLNG TTS Caching with one header.

    ```javascript theme={null}
    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.
    ```
  </Tab>
</Tabs>

<Tip>
  The X-Slng-Cache-Bypass header works this way:

  False: Caching is Activated

  True: Caching is Disabled
</Tip>

## 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 synthesised or hosted in another region.
