Before you begin
SetSLNG_API_KEY in your environment. If you need a key, follow
Create your API key.
If you already have one, see
Store and use your key.
The model requests below go to https://eu-west.slng.ai.ai and send your key as a
bearer token.
Synthesize speech
Text to speech takes some text and a voice and returns audio. Pick the model in the request path and pass the text in the body. This example uses the Deepgram Aura model, where you choose the voice with themodel parameter in the body.
The endpoint returns binary audio, so write the response straight to a file.
- curl
- JavaScript
- SDK
- Python
- CLI
Transcribe audio
Speech to text takes an audio file and returns the transcript. Send the file as multipart form data and read the text from the first alternative. The examples below transcribe this sample:- curl
- JavaScript
- SDK
- Python
- CLI
results.channels[0].alternatives[0].transcript.
Change the model or parameters
The model is part of the request path. Swap it to change the voice engine or the language, and keep the rest of the call the same. Prefer a variant under theslng/ prefix where one exists: those run on SLNG infrastructure in the region
closest to you, so each call skips the hop to an outside provider.
Each model has its own endpoint and its own parameters, so the field that picks
the voice differs by provider. Deepgram Aura uses model, Rime Arcana uses
speaker.
languagesets the recognition language.diarize=truelabels each speaker.punctuate=trueadds punctuation.
Stream in real time
For low-latency, turn-by-turn audio, connect over WebSocket atwss://eu-west.slng.ai.ai instead of posting a whole file.
Find other models and API details
- Which models are available and the model catalog, including views by region and language.
- Text to speech API and speech to text API.
- Authentication, rate limits, and error codes.
Next steps
- Ready to build a full voice agent instead? See create an agent.
- Already run an agent elsewhere? See improve an existing agent.