Use this file to discover all available pages before exploring further.
This guide shows you how to generate your first audio clip with Rime’s text-to-speech (TTS) API and experiment with different voices and speech customizations.
Configure a payload specifying the details of the request:
payload = { "text": "Hello! This is Rime speaking.", "speaker": "celeste", "modelId": "arcana"}
This payload includes the three required parameters:
text adds the text that the model converts to speech.
speaker sets the voice that the agent uses (view your options on our Voices page).
modelId specifies which model the agent uses. Use arcana for the most realistic voices, or mistv3 for faster synthesis.
The Arcana API reference details the many optional parameters you can add to request payloads.Now that you’ve created the headers and payload, make a POST request to the Rime API and write the streamed audio response to a file:
data = json.dumps(payload).encode("utf-8")request = urllib.request.Request( "https://users.rime.ai/v1/rime-tts", data=data, headers=headers, method="POST")with urllib.request.urlopen(request) as response: with open("output.mp3", "wb") as f: while chunk := response.read(4096): f.write(chunk)print("Audio saved to output.mp3")
Streaming allows audio playback to begin before generation completes. This enables conversational flow, as the user can start listening to responses before the entire audio clip has been generated.Although streaming is less important in this example, because we’re writing to a file, it’s vital when using models in real-time conversations. If this sounds interesting, follow the LiveKit quickstart to create your first conversational agent.
The mistv2 and mistv3 models let you specify the pronunciation of brand names or uncommon words using Rime’s phonetic alphabet. Add the custom pronunciation in curly brackets and set phonemizeBetweenBrackets to true:
Now that you can generate TTS audio, try following the LiveKit quickstart guide to learn how you can set up a real-time conversation with an agent.Check out these resources to get more familiar with Rime: