Skip to main content
In about five minutes, you will generate an audio file from text and transcribe an audio recording.

Prerequisites

  • An SLNG API account
  • An API key (get one at app.slng.ai)
  • Basic knowledge of REST APIs or WebSockets

Authentication

All API requests require authentication using an API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Replace YOUR_API_KEY with the actual API key you got from the Dashboard.

Your First Request

1

Text-to-Speech (HTTP)

Let’s start by making a simple Text-to-Speech (TTS) request using the HTTP API.You can turn any text into an audio file, like this:
curl https://api.slng.ai/v1/tts/slng/deepgram/aura:2 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello from sunny Barcelona!"
  }' \
  --output hello.wav
Replace YOUR_API_KEY with your actual API key and run this command in your terminal.After a few seconds when the request completes, you should have a hello.wav audio file in the current directory.It will sound like this:
2

Speech-to-Text (HTTP)

Now we want to transcribe an audio file. It turns the audio into a text we can manipulate and analyze later. First, you need to download this sample audio file on your machine.And then run the following code snippet in your terminal:
curl https://api.slng.ai/v1/stt/slng/deepgram/nova:3 \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "audio=@micro-machines.wav" \
  -F "language=en"
And after a few seconds you should get the following response:
{
  "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
  }
}
This works with local files but it also works with remote files by providing a URL instead of uploading the audio data directly. Here is how you would do that:
curl https://api.slng.ai/v1/stt/slng/deepgram/nova:3-multi \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"url":"https://docs.slng.ai/audio/micro-machines.wav", "language":"en"}'
And it should give you the same response as the previous example.

Go Further

Now that you’ve made your first API calls, you can explore more advanced features and examples.

Try TTS live

Test text-to-speech in the browser without writing code.

Build your first voice agent

Combine streaming STT, low-latency TTS, and tool-calling to greet, route, and escalate calls.

Explore TTS examples

Copy-paste ready examples in cURL, JavaScript, and Python for text-to-speech.

Explore STT examples

Transcribe audio files and streams with examples in multiple languages.

Browse models

Explore all available TTS and STT models and find the right one for your use case.

HTTP vs. WebSocket

Understand when to use each protocol and their trade-offs.

Set up the Dashboard

Create API keys, configure telephony, and manage agents from the dashboard.