docs

Quickstart

From API key to spoken audio in under five minutes.

Get an API key

Create a key in the console under API keys. Keys look like sk_live_… and are shown once at creation; store them in a secret manager or environment variable, never in client code or version control.

export SVARA_API_KEY="sk_live_..."

Make your first request

The fastest path is the OpenAI SDK you may already have installed: point it at the Svara base URL:

pip install openai
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://platform.kenpathlabs.com/v1",
    api_key=os.environ["SVARA_API_KEY"],
)

audio = client.audio.speech.create(
    model="svara-1",
    voice="3b5275e4f2",  # Tara
    input="The quick brown fox jumps over the lazy dog.",
    response_format="mp3",
)
audio.write_to_file("out.mp3")

Stream it

Buffered audio makes long text feel broken; stream by default. Set stream: true and consume chunks as they arrive; with pcm output the first bytes land in a few hundred milliseconds:

with client.audio.speech.with_streaming_response.create(
    model="svara-1",
    voice="3b5275e4f2",  # Tara
    input="This sentence starts playing before it finishes generating.",
    response_format="pcm",          # 24 kHz, 16-bit LE, mono
    extra_body={"stream": True},
) as response:
    for chunk in response.iter_bytes():
        player.feed(chunk)          # your audio sink

Full recipes for browsers, native apps, and telephony are on the Streaming page.

Explore voices and languages

These endpoints are public, no key required:

  • GET /v1/voices: the current voice roster, each with a preview_url
  • GET /v1/languages: all 80 supported languages, for building pickers
  • GET /v1/models: available models
Prefer clicking to curling? The console playground lets you try voices, languages, and multi-speaker scenes without writing code.