start here · 3 steps
1 · Get a key. Mint one on the API keys page — oled_sk_live_…, shown once.
2 · Install. Only what your stack needs:
// nothing to install — fetch + WebSocket are built into browsers & node 18+3 · Render. Press ▶ Run — audio appears below, free preview lane, never billed:
// render text -> one complete WAV. Runs LIVE when you press Run.
const API_KEY = process.env.OLED_API_KEY; // oled_sk_live_…
const res = await fetch(`https://oled-studio.onrender.com/v1/speech`, {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ text: "Hello from the docs — press Run and listen.", voice_id: "ada" }),
});
if (!res.ok) throw new Error(`render failed: ${res.status}`);
const wav = await res.arrayBuffer(); // audio/wav — save or play it
console.log("balance:", res.headers.get("x-balance-chars"));What this is. The key proves which wallet pays. Every speech call carries it in the Authorization header, the server debits that wallet 1 token per character, and tells you the remaining balance in the X-Balance-Chars response header.
how to use it
GET /health and GET /v1/voices are open: no key, never billed. Everything that synthesizes needs one.
What this is. A tiny JSON report saying the engine is alive: which provider is loaded, which model version, the sample rate, and how many voices are ready. It costs nothing and needs no key.
how to use it
voices is above zero and model_version matches what you tested against.ok: true means serving.// no auth needed — ping the engine
const res = await fetch(`https://oled-studio.onrender.com/health`);
const health = await res.json();
console.log(health);
// → { ok: true, provider: "piper-standin-0.1.0", voices: 4, ... }What this is. The full menu of voices the engine can speak with right now — ids, labels, accents, and which ones are switched on. Voice ids are what you pass as voice_id everywhere else.
how to use it
sample_url so people hear before they commit.voice_disabled, re-fetch this list — that voice was switched off.// list every voice the engine can render
const res = await fetch(`https://oled-studio.onrender.com/v1/voices`);
const { voices } = await res.json();
for (const v of voices) console.log(v.id, "-", v.label);What this is. The simplest way to speak: you send text (up to 2000 characters) and get back one complete WAV file. The audio IS the response body; the receipt — remaining balance, request id, voice used — rides in the response headers.
how to use it
voice_id and your key; save the response bytes as .wav and play them.X-Balance-Chars from the headers and update your UI before the next render.preview: true (≤200 chars) — real audio, costs nothing, never billed.| param | type | notes |
|---|---|---|
| text | string · 1–2000 | What gets spoken. |
| voice_id | string · optional | Defaults to your console voice. Unknown ids 404. |
| session_id | string · optional | Ephemeral generation session. |
| preview | bool · default false | Free lane: ≤200 chars, never billed. |
// render text -> one complete WAV. Runs LIVE when you press Run.
const API_KEY = process.env.OLED_API_KEY; // oled_sk_live_…
const res = await fetch(`https://oled-studio.onrender.com/v1/speech`, {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ text: "One WAV, one request — the simplest way to speak.", voice_id: "ada" }),
});
if (!res.ok) throw new Error(`render failed: ${res.status}`);
const wav = await res.arrayBuffer(); // audio/wav — save or play it
console.log("balance:", res.headers.get("x-balance-chars"));What this is. A WebSocket for long text: you send sentences down one socket and audio chunks stream back while the rest is still rendering, so playback starts after sentence one instead of after the whole document. A done frame closes with total bytes and your balance.
how to use it
{type: 'speak', text, voice_id, api_key} — include the key inside the message, not a header.done frame before closing — it carries balance_chars for your UI.Python and SDK streaming recipes live in the playground.
// STREAMING: text in, chunked WAV back on one socket. Runs LIVE on Run.
// First audio lands after the first sentence — the rest keeps flowing.
const ws = new WebSocket("wss://oled-studio.onrender.com/v1/talk");
ws.binaryType = "arraybuffer";
const chunks = []; // collect binary frames; frame[0] is the WAV header
ws.onopen = () => ws.send(JSON.stringify({
type: "speak",
request_id: "r-" + Math.random().toString(36).slice(2),
text: "Streaming speaks sentence by sentence.",
voice_id: "ada",
api_key: process.env.OLED_API_KEY, // oled_sk_live_…
}));
ws.onmessage = (ev) => {
if (typeof ev.data !== "string") return chunks.push(ev.data); // audio!
const msg = JSON.parse(ev.data);
if (msg.type === "done") {
const wav = new Blob(chunks, { type: "audio/wav" });
console.log(`done: ${msg.bytes} bytes, balance ${msg.balance_chars}`);
ws.close();
}
if (msg.type === "error") throw new Error(msg.code + ": " + msg.message);
};What this is. When anything goes wrong you get the same envelope every time — an HTTP status plus { error: { code, message } }. The code is stable and documented; the message is human flavor that may change, so branch your logic on the code.
how to use it
X-Request-ID if you contact support.400 · bad_request / voice_disabledMissing text, bad voice, or a disabled voice. Check ids against GET /v1/voices.401 · unauthorized / login_requiredNo (or bad) API key — or session expired. Sign in again or mint a key.402 · insufficient_creditsWallet empty for this render. Top up on the Billing page.404 · unknown_voiceNo such voice id. List voices first.429 · rate_limited / preview_budgetToo fast, or the free preview budget is spent. Slow down or run billed.500 · synthesis_failedThe engine stumbled. Retry once; if it persists, report the X-Request-ID.