Skip to content

pattern-ai-labs/swaram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

swaram — real-time Malayalam voice API

swaram is a real-time Malayalam voice API. You stream a user's voice over a WebSocket and natural Malayalam speech streams back — speech in, Malayalam out. You bring the context (your instructions, tools, and data); swaram is the voice.

Already use a Realtime voice client? You're basically done.

swaram speaks the OpenAI Realtime event protocol, so most existing real-time voice clients work by changing just three things:

  1. URLwss://api.swaram.live/v1/realtime
  2. API key → your swaram_… key
  3. modelmal-realtime-simple (or mal-realtime-premium)

Everything else — the events, tools, and audio format — is the same.

The whole loop in 30 seconds

import asyncio, base64, json, websockets

URL = "wss://api.swaram.live/v1/realtime?model=mal-realtime-simple"

async def main():
    headers = {"Authorization": "Bearer swaram_your_key_here"}
    async with websockets.connect(URL, additional_headers=headers) as ws:
        await ws.send(json.dumps({"type": "session.update", "session": {
            "instructions": "You are a friendly Malayalam assistant.",
            "voice": "mal-female",
        }}))
        await ws.send(json.dumps({"type": "input_audio_buffer.append",
                                  "audio": base64.b64encode(pcm16_chunk).decode()}))
        async for raw in ws:
            event = json.loads(raw)
            if event["type"] == "response.output_audio.delta":
                play(base64.b64decode(event["delta"]))   # PCM16 @ 24 kHz
asyncio.run(main())

Full walkthrough (Python / Node / Browser): docs/quickstart.md.

Quick reference

Values
model mal-realtime-simple · mal-realtime-premium Simple = low cost · Premium = lower latency + more expressive
voice mal-female (default) · mal-male Same voices in both modes
Audio PCM16 · 24 kHz · mono · base64 Same in and out

See docs/models.md for the full reference.

Working examples — clone and start building

Ready-to-run example apps live in github.com/pattern-ai-labs/swaram-apps. Clone it and start from a working integration.

Documentation

Get started

  • Introduction — what swaram is, the base URL, the two modes.
  • Quickstart — connect, configure, stream audio, play the reply (Python/Node/Browser).
  • Authentication — server-side keys and short-lived browser tokens.

Build

  • Models & voices — the literal model/voice ids and the audio format.
  • Sessions & context — configure instructions/voice/tools; lifetime, reconnection & limits.
  • Function calling — give swaram tools to act on; the call/return round-trip.
  • Audio — PCM16 in/out, chunking, playback, echo cancellation.
  • Transcripts — read what the user said and what swaram said back.
  • Turn-taking & barge-in — automatic turns, interrupting, sending only the user's voice.

Reference

  • Events reference — every client and server event, plus close codes.
  • Errors — error events, close codes, and reconnection.

Help

  • FAQ — modes, languages, phone calls, billing, and data.

For AI agents

These docs are plain Markdown, designed to be read by tooling and agents. The whole set is also served as a single file you can drop into an agent for the entire API in one read:

License

Documentation licensed under the MIT License.


swaram.live · Dashboard · Docs

About

Developer documentation for swaram — a real-time Malayalam voice API for building voice agents.

Topics

Resources

License

Stars

15 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors