Python SDK Documentation
Official Python SDK for the OrbitalsAI API with synchronous, asynchronous, and real-time streaming support. Build powerful African language transcription into your Python applications.
Installation
Install the core SDK using pip:
To enable streaming and audio helpers, use the optional extras defined in the Python package:
Authentication
Get your API key from the dashboard and initialize the client:
Best Practice
Basic Usage
The sync client lets you upload audio and get back transcripts. The subsections below cover uploading and waiting, language and model selection, SRT generation, and listing past tasks.
Upload & Transcribe
Transcribe an audio file with automatic waiting:
Automatic Waiting
transcribe() method automatically waits for the transcription to complete before returning.Specify a Language
Transcribe with a specific African language:
See the full list of supported languages.
Model Selection
Choose the best AI model for your needs. You can list available models and their pricing:
Generate SRT Subtitles
Generate subtitle files in SRT format:
List Past Tasks
List all transcription tasks (paginated):
Paginate task history
page and page_size to paginate large task histories.Async Usage
Use the async client for non-blocking operations:
Concurrent Processing
Manual Task Control
Submit a transcription task without waiting and poll for completion. Use wait=False to get back a task immediately, then poll with get_task() or block with wait_for_task().
Error Handling
Handle common batch transcription errors gracefully:
Balance Management
Check your account balance and usage:
Complete Example
A complete batch transcription example with error handling and balance checking:
Real-time streaming from Python
The Python SDK ships with a dedicated streaming module at orbitalsai.streaming for real-time transcription over WebSockets. Use the async client for most applications. The subsections below cover streaming from files, microphone input, configuration, and error handling.
Stream from Audio Files (MP3, WAV, M4A…)
Use AudioConverter to convert common audio formats to PCM16 before streaming.
Install audio extras
pip install "orbitalsai[audio]" to get AudioConverter and its dependencies (soundfile, librosa).Stream from Microphone
Local environment only
pip install "orbitalsai[all]" to include sounddevice.Word-Level Timestamps
When using streaming (via AsyncStreamingClient), you can request per-word timing by passing return_timestamps=True in the StreamingConfig. When enabled, each final event includes a timestamps list with entries shaped { "start": float, "end": float, "text": str }. These timestamps are also stored in the database for completed sessions and can be retrieved via GET /api/v1/audio/status/{task_id}.
Timestamps in saved sessions
GET /api/v1/audio/status/{task_id} — the response includes a timestamps field with the same { start, end, text } format.StreamingConfig Reference
StreamingConfig controls audio, language, and connection settings for each session.
Reference
| Field | Type | Description |
|---|---|---|
sample_rate | int | Audio sample rate in Hz (8000–48000). |
chunk_size | int | Samples per chunk (8000 ≈ 500ms at 16kHz). |
language | str | Target language: english, hausa, igbo, yoruba. |
interim_results | bool | Receive partial transcripts as speech is recognized. |
auto_flush | bool | Server flushes automatically on silence. |
return_timestamps | bool | Include per-word timestamps in final events. |
max_retries | int | Max reconnection attempts after unexpected disconnect. |
retry_delay | float | Initial retry delay in seconds (exponential backoff). |
connection_timeout | float | WebSocket connection timeout in seconds. |