The official Python SDK for the Rumik Silk text-to-speech API.
Project description
Rumik Python SDK
The official Python SDK for the Rumik Silk text-to-speech API.
Turn text into natural, expressive speech with a few lines of code.
Installation
pip install rumik
Real-time WebSocket streaming needs an extra dependency:
pip install "rumik[ws]"
Quickstart
from rumik import Rumik
client = Rumik(api_key="rk_live_...") # or set the RUMIK_API_KEY env var
audio = client.speech.create(
text="[happy] Namaste! Kaise hain aap?",
model="muga",
)
audio.save("hello.wav")
Controlling the voice (mulberry model)
audio = client.speech.create(
text="Hi there, how can I help you today?",
model="mulberry",
description="a warm 30s female voice, smooth timbre, conversational pacing",
speaker="speaker_2",
)
audio.save("greeting.wav")
Async
For servers and high-concurrency workloads, use AsyncRumik with async/await:
import asyncio
from rumik import AsyncRumik
async def main():
async with AsyncRumik() as client: # reads RUMIK_API_KEY
audio = await client.speech.create(text="Hello!", model="mulberry")
audio.save("hello.wav")
asyncio.run(main())
Fire many requests concurrently with asyncio.gather:
async with AsyncRumik() as client:
clips = await asyncio.gather(
client.speech.create(text="One"),
client.speech.create(text="Two"),
client.speech.create(text="Three"),
)
Real-time streaming
For voice agents and low-latency playback, stream PCM audio over a WebSocket as
it is generated. Requires the websockets extra (pip install "rumik[ws]").
from rumik import Rumik
client = Rumik()
with client.speech.stream(text="Streaming in real time.", model="mulberry") as stream:
for chunk in stream: # raw PCM (24 kHz mono 16-bit) as it arrives
play(chunk) # feed your audio device
# After the stream ends:
print(stream.request_id, stream.credits_used)
Save a stream straight to a playable WAV file:
with client.speech.stream(text="Hello!", model="mulberry") as stream:
stream.save("out.wav")
Async streaming mirrors this with async with / async for:
async with AsyncRumik() as client:
async with client.speech.stream(text="Hello!") as stream:
async for chunk in stream:
await play(chunk)
The SDK handles the two-step handshake (minting a session token, then opening the WebSocket) for you — you just iterate audio.
Voice-agent sessions (multi-utterance + barge-in)
For voice agents, open a persistent session: keep one WebSocket open for the
whole conversation, send() an utterance for each thing the agent says, and
interrupt() (or just send new text) to barge in.
from rumik import Rumik, AudioChunk, UtteranceDone
client = Rumik()
with client.speech.session(model="mulberry", speaker="speaker_1") as session:
session.send("Hello! How can I help you today?")
for event in session:
if isinstance(event, AudioChunk):
play(event.data)
if user_started_talking():
session.interrupt() # barge-in
session.send("Sorry, go ahead.")
elif isinstance(event, UtteranceDone):
break
Sending a new utterance while one is generating interrupts it — the older one
comes back as an UtteranceCancelled event with reason="interrupt". The async
client mirrors this with async with / async for, and you can await session.interrupt() / await session.send(...) from another task.
Models
| Model | Steering |
|---|---|
muga |
Expressive. Prefix text with a tone tag, e.g. [happy]. |
mulberry |
Faster. Use a natural-language description + speaker. |
Tone tags for muga: neutral, happy, sad, excited, angry, whisper.
Configuration
client = Rumik(
api_key="rk_live_...", # falls back to RUMIK_API_KEY
timeout=60.0, # per-request timeout (seconds)
max_retries=2, # automatic retries on 429 / 5xx / network errors
)
Error handling
from rumik import Rumik, RateLimitError, AuthenticationError, APIStatusError
client = Rumik()
try:
audio = client.speech.create(text="Hello")
except AuthenticationError:
print("Check your API key.")
except RateLimitError as e:
print(f"Slow down. Retry after {e.retry_after}s.")
except APIStatusError as e:
print(f"API error {e.status_code}: {e}")
Audio format
Rumik Silk returns 24 kHz, mono, signed 16-bit PCM. The HTTP API wraps it in a
WAV container, so audio.save("out.wav") produces a ready-to-play file.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rumik-0.3.0.tar.gz.
File metadata
- Download URL: rumik-0.3.0.tar.gz
- Upload date:
- Size: 38.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53496d38667d6d3ba72f7944e444912d66aa54f90ad27842961de89f01cf8baf
|
|
| MD5 |
4fc40a5c0e0b7c26ec64955712cfce83
|
|
| BLAKE2b-256 |
25a62f3d94e7118d818508035bb335dd0b4efbcd37a11506595b8bb2af97e71e
|
File details
Details for the file rumik-0.3.0-py3-none-any.whl.
File metadata
- Download URL: rumik-0.3.0-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf1311ce3e1a5057bfeb37d084e6b2bd1677b2638a14b53ffbefc1409c9ad5ed
|
|
| MD5 |
f8ba1043dd93863f67267316d9d498df
|
|
| BLAKE2b-256 |
f9ec0ae0e17f6657951062e1d9b5ace2d0be13ef796ecbd9eb6db4ffeac4f8e5
|