Skip to main content
silk
Documentation

Quickstart.

From signup to first synthesized audio in under 60 seconds.

1. Get an API key

Sign in with Google, then go to API Keys in your dashboard and create a new key. The full key is shown only once at creation — copy it somewhere safe before closing the dialog.

Go to dashboard

2. Synthesize speech

Pass your key as a Bearer token. The response body is a 24 kHz mono WAV (audio/wav) — write it straight to a file.

bash
curl https://silk-api.rumik.ai/v1/tts \
  -H "Authorization: Bearer rk_live_•••••••••" \
  -H "Content-Type: application/json" \
  -d '{ "model": "muga", "text": "Hello, world." }' \
  --output speech.wav

Optional fields: description (voice description, e.g. "deep male voice, slightly raspy"), temperature, top_p, max_new_tokens.

3. Stream the response

For real-time playback, mint a one-shot WebSocket session and connect to it. The server streams raw PCM int16 little-endian @ 24 kHz mono as binary frames, then sends a terminal {"type":"done"} JSON text frame.

javascript
// 1. Mint a session token (one-shot, short TTL)
const r = await fetch("https://silk-api.rumik.ai/v1/tts/ws-connect", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SILK_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ model: "muga", text: "Voice that ships in milliseconds." }),
});
const { ws_url, ws_token } = await r.json();

// 2. Connect to the WebSocket and consume PCM frames
const ws = new WebSocket(`${ws_url}?token=${ws_token}`);
ws.binaryType = "arraybuffer";

ws.onmessage = (e) => {
  if (e.data instanceof ArrayBuffer) {
    const pcm = new Int16Array(e.data); // 24kHz mono — feed to AudioWorklet
    // ...
  } else {
    const event = JSON.parse(e.data);
    if (event.type === "done") ws.close();
  }
};

Errors and rate limits

All errors return JSON of shape { errorCode, message }. Rate limits are enforced per API key; the response includes a Retry-After header when applicable.

StatusMeaning
400Malformed request body
401Bearer token missing, invalid, or expired
403Key revoked or account disabled
422Validation failed — check the message field
429Rate limit hit — see Retry-After
503Upstream temporarily unavailable — retry shortly