Developer guide · live APIs

Speech in.
Text or speech out.

Use standalone transcription and speech generation from your backend. Both run on Swarit’s resident speech stack and share its capacity routing.

01 · Access

Use OAuth.

Sign in to Swarit Cloud → Developers, configure your integration and complete the OAuth authorization-code flow with PKCE. Request vn:ai:execute for API resource https://cloud.swarit.ai/api/v1. Keep access and refresh tokens on your backend.

In Cloud Billing, set an additional-usage spending limit. Standalone speech is postpaid and does not consume your realtime plan’s included minutes. Read the authentication guide →

02 · STT

Transcribe real audio.

Upload raw, mono, 16-kHz signed PCM16 little-endian audio as audio/pcm, up to five minutes per request. English is the default; set the recording’s language explicitly.

For a WAV or MP3 recording, convert it first:

ffmpeg -i recording.wav -ac 1 -ar 16000 -f s16le recording.pcm
curl --no-buffer 'https://cloud.swarit.ai/api/voice/v1/audio/transcriptions?language=en' \
  -H "Authorization: Bearer $SWARIT_ACCESS_TOKEN" \
  -H 'Content-Type: audio/pcm' \
  --data-binary @recording.pcm

The response is NDJSON: transcript.partial, transcript.final, then transcription.done with audio_milliseconds. Use a backend HTTP client supporting duplex streaming to read transcripts while uploading. A terminal error event means the request did not complete; HTTP 200 alone is not a completion signal.

03 · TTS

Stream a named voice.

Send complete text as JSON, up to 10,000 UTF-16 code units. The response streams raw, mono, 24-kHz signed PCM16 little-endian audio. This endpoint accepts complete text per request; streaming text input belongs to the component playground.

curl 'https://cloud.swarit.ai/api/voice/v1/audio/speech' \
  -H "Authorization: Bearer $SWARIT_ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"text":"Hello. How can I help you?","language":"en","voice":"aditi"}' \
  --output speech.pcm

ffplay -f s16le -ar 24000 -ac 1 speech.pcm

Choose one of the 22 named voices, including aditi, kabir, kavya and kiran. The default is Aditi. female and male remain compatibility aliases for Aditi and Kabir.

04 · Languages

Twelve output languages.

Supported language codes: English en, Hindi hi, Marathi mr, Malayalam ml, Kannada kn, Tamil ta, Telugu te, Gujarati gu, Punjabi pa, Bengali bn, Assamese as and Odia or.

05 · Usage

Pay for speech usage.

STT: ₹0.245 per input audio minute. Completed input duration is metered; failed or cancelled requests without a completed transcription are not settled as successful transcription.

TTS: ₹1 per 1,000 Unicode code points. Accepted text is metered once audio output starts. Prices exclude 18% GST. Charges use the existing postpaid spending-limit and invoice flow; realtime minute plans remain unchanged. Fractional usage is rounded up only to the final paise charge for each request.

Requests wait for shared GPU capacity for up to 60 seconds; queue capacity is bounded. A request can run for up to 420 seconds. Cancel the request to stop its stream and release capacity. HTTP 401/403 concerns authorization, 402 requires a sufficient spending limit, 400/413 concerns input, and 503 means capacity or runtime is unavailable.

OpenAPI specification → · Current API pricing →