Overview
gnani-vachana is the official Python client for the Gnani Speech APIs. It wraps STT and TTS across all three transports — REST, SSE, and WebSocket — plus batch transcription jobs, so you never hand-roll multipart uploads, SSE frame parsing, WAV headers, or WebSocket lifecycles.
requests and websockets only — ships type hints (py.typed), and is maintained by Gnani.ai.
The PyPI package is
gnani-vachana, but the Python import package is gnani. Install gnani-vachana, then from gnani.stt import ....Installation
Authentication
You need a Gnani API key — generate one on the Gnani API platform. A single API key authenticates both STT and TTS; noorganization_id or user_id is required.
The recommended approach is the GNANI_API_KEY environment variable, which every client reads automatically:
AuthenticationError immediately — before any network call.
If you are upgrading from an SDK version older than
0.7.x, remove the organization_id and user_id constructor arguments. They are no longer accepted.Choosing a client
Each API has one class per transport. Pick by latency requirement, not by preference — they return the same audio and the same transcripts.Speech-to-Text
Text-to-Speech
Your first request
- Speech-to-Text
- Batch Speech-to-Text
- Text-to-Speech
Error handling
Each sub-package defines its own exception hierarchy, rooted atGnaniSTTError and GnaniTTSError. Catching the root class catches everything the SDK raises.
For the HTTP errors the APIs return, see Error Reference.
ValueError is raised — before any request leaves your process — for invalid parameter combinations such as an unknown voice, an unsupported sample rate, or speed outside 0.85–1.15.
Request IDs
Every method accepts an optionalrequest_id. When omitted, the SDK generates one and sends it as X-API-Request-ID. It is echoed back in STT REST responses and in TTS WebSocket events.
Pointing at a different environment
All clients takebase_url, defaulting to https://api.vachana.ai. The streaming clients derive their WebSocket URL from it automatically (https → wss).
Further Reading
Speech-to-Text
REST transcription and realtime streaming with the Python SDK.
Text-to-Speech
REST, SSE, and WebSocket synthesis with the Python SDK.
gnani-vachanaon PyPI — releases and changelog- STT REST API · STT Realtime API — underlying HTTP reference
- TTS REST · TTS SSE · TTS Realtime — underlying HTTP reference
- LiveKit Plugin · Pipecat Plugin — framework integrations built on these same APIs