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

# Getting started with SLNG

> Authenticate, send your first text-to-speech and speech-to-text requests, and stream over WebSocket with SLNG in about five minutes.

export const AudioPlayer = ({src, title = "Audio", description, autoPlay = false, loop = false, variant = "default"}) => {
  const audioId = useId();
  const isCompact = variant === "compact";
  const audioRef = useRef(null);
  const [isPlaying, setIsPlaying] = useState(false);
  const togglePlayback = () => {
    const audio = audioRef.current;
    if (!audio) return;
    if (audio.paused) {
      void audio.play();
      setIsPlaying(true);
      return;
    }
    audio.pause();
    setIsPlaying(false);
  };
  return <div className={`audio-player ${isCompact ? "compact" : ""}`}>
      {!isCompact && <div className="meta">
          <div className="titles">
            <div className="title">{title}</div>
            {description && <div className="description">{description}</div>}
          </div>

          <a className="download" href={src} download>
            Download
          </a>
        </div>}

      {isCompact ? <>
          <button type="button" className="compact-button" onClick={togglePlayback} aria-label={isPlaying ? "Pause audio sample" : "Play audio sample"}>
            <span className="compact-icon" aria-hidden="true">
              {isPlaying ? "❚❚" : "▶"}
            </span>
          </button>
          <audio id={audioId} ref={audioRef} preload="metadata" loop={loop} autoPlay={autoPlay} aria-label={title} src={src} onEnded={() => setIsPlaying(false)}>
            Your browser does not support the audio element.
          </audio>
        </> : <audio id={audioId} className="audio-control" controls preload="metadata" loop={loop} autoPlay={autoPlay} aria-label={title} src={src}>
          Your browser does not support the audio element.
        </audio>}
    </div>;
};

All your speech traffic routes through one platform. The quickest way to see it work is to send a text-to-speech and a speech-to-text request directly. Once you have, you can [point your existing stack at the gateway](/integrations/gateway) and keep the rest of your code.

## Prerequisites

* An SLNG account
* A SLNG key (get one at [app.slng.ai](https://app.slng.ai/api-keys))
* Basic knowledge of REST APIs or WebSockets

## Authentication

Every request needs an SLNG key in the `Authorization: Bearer SLNG_API_KEY` header. Get one from the [Dashboard](https://app.slng.ai/api-keys), and replace `SLNG_API_KEY` in the examples below with your key. For WebSocket auth, key rotation, and bringing your own provider key, see [Authentication & API Keys](/authentication).

## Your First Request

<Steps>
  <Step title="Text-to-Speech (HTTP)" titleSize="h3">
    A Text-to-Speech (TTS) request over HTTP turns text into an audio file:

    ```bash theme={null}
    curl https://api.slng.ai/v1/tts/slng/deepgram/aura:2-en \
      -H "Authorization: Bearer SLNG_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "aura-2-thalia-en",
        "text": "Hello from sunny Barcelona!"
      }' \
      --output hello.wav
    ```

    Replace `SLNG_API_KEY` with your SLNG key and run the command. Once the request completes, you have a `hello.wav` file in the current directory.

    It sounds like this:

    <AudioPlayer src="/audio/hello.wav" title="Hello from sunny Barcelona!" />
  </Step>

  <Step title="Speech-to-Text (HTTP)" titleSize="h3">
    Next, transcribe an audio file. The response is text you can process downstream.

    Download this sample file:

    <AudioPlayer src="/audio/micro-machines.wav" title="Micro Machines sample" description="Download this file to use with the STT example below." />

    Then run:

    ```bash theme={null}
    curl https://api.slng.ai/v1/stt/slng/deepgram/nova:3-en \
      -H "Authorization: Bearer SLNG_API_KEY" \
      -F "audio=@micro-machines.wav" \
      -F "language=en"
    ```

    Response:

    ```json theme={null}
    {
      "text": "is the micro machine man presenting the most midget miniature motorcade of micro machine...",
      "transcript": "is the micro machine man presenting the most midget miniature motorcade of micro machine...",
      "confidence": 0.9749991,
      "duration": 29.888374,
      "language": "en",
      "metadata": {
          "request_id": "f5778fa4-40f9-4d60-993b-2f43f0164221",
          "model": "nova-3",
          "duration": 29.888374,
          "channels": 1
      }
    }
    ```

    The same endpoint accepts a remote URL instead of an upload:

    ```bash theme={null}
    curl https://api.slng.ai/v1/stt/slng/deepgram/nova:3-multi \
      -H "Authorization: Bearer SLNG_API_KEY" \
      -H 'Content-Type: application/json' \
      --data '{"url":"https://docs.slng.ai/audio/micro-machines.wav", "language":"en"}'
    ```

    The response is identical to the upload version.
  </Step>
</Steps>

## Go Further

<CardGroup cols={3}>
  <Card title="Point your stack at SLNG" icon="plug" href="/integrations/gateway">
    Route your existing voice agent through the gateway and keep your code.
  </Card>

  <Card title="Use a framework plugin" icon="boxes" href="/integrations/overview">
    Native integrations for LiveKit, Cognigy, and Jambonz.
  </Card>

  <Card title="Explore the execution layer" icon="layers" href="/execution-layer">
    How SLNG routes and optimizes every turn between your app and the models.
  </Card>

  <Card title="Build a voice agent" icon="bot" href="/voice-agents">
    Combine streaming STT, low-latency TTS, and tool-calling to greet, route, and escalate calls.
  </Card>

  <Card title="HTTP vs. WebSocket" icon="arrow-left-right" href="/protocols">
    Understand when to use each protocol and their trade-offs.
  </Card>

  <Card title="Browse models" icon="cpu" href="/models">
    Explore all available TTS and STT models and find the right one for your use case.
  </Card>
</CardGroup>
