Docs/Official SDKs
Official SDKs.
Maintained by us, kept feature-flat with the REST and WebSocket APIs, every release pushed within a week of the underlying change.
Python
Synchronous and async clients. Streaming via aiohttp; works inside FastAPI, Django Channels, and plain scripts.
bash
pip install leanvoice
python
from leanvoice import LeanVoice client = LeanVoice() # reads LEANVOICE_API_KEY from env # one-shot audio = client.speech.create(voice="meera", input="Hello, world.") # streaming with client.realtime.connect(voice="arjun") as session: session.send_text("Streaming voice in real time.") for chunk in session.audio_chunks(): speaker.write(chunk)
Node.js / TypeScript
bash
npm i @leanvoice/sdk
javascript
import { LeanVoice } from "@leanvoice/sdk"; const client = new LeanVoice(); // reads LEANVOICE_API_KEY const audio = await client.speech.create({ voice: "meera", input: "Hello, world.", }); // streaming with an async iterator for await (const chunk of client.realtime.stream({ voice: "arjun", input: "Real time." })) { speaker.write(chunk); }
Go
bash
go get github.com/leanvoice/leanvoice-go
Ruby
bash
gem install leanvoice
cURL recipes
Useful for shell scripts, CI, and quick sanity checks.
bash
# Save synthesised WAV curl -sS https://api.leanvoice.ai/v1/audio/speech \ -H "Authorization: Bearer $LEANVOICE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"voice":"meera","input":"Hello."}' \ --output hello.wav # Pipe directly into ffplay for instant playback curl -sS https://api.leanvoice.ai/v1/audio/speech \ -H "Authorization: Bearer $LEANVOICE_API_KEY" \ -H "Content-Type: application/json" \ -d '{"voice":"saanvi","input":"Hello.","format":"mp3"}' \ | ffplay -nodisp -autoexit -
OpenAI SDK works too
If you'd rather not add another dependency, the openai SDK with base_url swapped to ours covers the REST surface. See OpenAI compatibility.