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 theAuthorization header:
YOUR_API_KEY with the actual API key you got from the Dashboard.
Your First Request
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: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: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:And after a few seconds you should get the following response: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: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.