Speechall Python SDK
Python SDK for the Speechall API - A powerful speech-to-text transcription service supporting multiple AI models and providers.
Features
- Multiple AI Models: Access various speech-to-text models from different providers (OpenAI Whisper, and more)
- Flexible Input: Transcribe local audio files or remote URLs
- Rich Output Formats: Get results in text, JSON, SRT, or VTT formats
- Speaker Diarization: Identify and separate different speakers in audio
- Custom Vocabulary: Improve accuracy with domain-specific terms
- Replacement Rules: Apply custom text transformations to transcriptions
- Language Support: Auto-detect languages or specify from a wide range of supported languages
- Async Support: Built with async/await support using httpx
Installation
pip install speechall
Quick Start
Basic Transcription
import os
from speechall import SpeechallApi
# Initialize the client
client = SpeechallApi(token=os.getenv("SPEECHALL_API_TOKEN"))
# Transcribe a local audio file
with open("audio.mp3", "rb") as audio_file:
audio_data = audio_file.read()
response = client.speech_to_text.transcribe(
model="openai.whisper-1",
request=audio_data,
language="en",
output_format="json",
punctuation=True
)
print(response.text)
Transcribe Remote Audio
from speechall import SpeechallApi
client = SpeechallApi(token=os.getenv("SPEECHALL_API_TOKEN"))
response = client.speech_to_text.transcribe_remote(
file_url="https://example.com/audio.mp3",
model="openai.whisper-1",
language="auto", # Auto-detect language
output_format="json"
)
print(response.text)
Advanced Features
Speaker Diarization
Identify different speakers in your audio:
response = client.speech_to_text.transcribe(
model="openai.whisper-1",
request=audio_data,
language="en",
output_format="json",
diarization=True,
speakers_expected=2
)
for segment in response.segments:
print(f"[Speaker {segment.speaker}] {segment.text}")
Custom Vocabulary
Improve accuracy for specific terms:
response = client.speech_to_text.transcribe(
model="openai.whisper-1",
request=audio_data,
language="en",
output_format="json",
custom_vocabulary=["Kubernetes", "API", "Docker", "microservices"]
)
Replacement Rules
Apply custom text transformations:
from speechall import ReplacementRule, ExactRule
replacement_rules = [
ReplacementRule(
rule=ExactRule(find="API", replace="Application Programming Interface")
)
]
response = client.speech_to_text.transcribe_remote(
file_url="https://example.com/audio.mp3",
model="openai.whisper-1",
language="en",
output_format="json",
replacement_ruleset=replacement_rules
)
List Available Models
models = client.speech_to_text.list_speech_to_text_models()
for model in models:
print(f"{model.model_identifier}: {model.display_name}")
print(f" Provider: {model.provider}")
Configuration
Authentication
Get your API token from speechall.com and set it as an environment variable:
export SPEECHALL_API_TOKEN="your-token-here"
Or pass it directly when initializing the client:
from speechall import SpeechallApi
client = SpeechallApi(token="your-token-here")
Output Formats
text: Plain text transcriptionjson: JSON with detailed information (segments, timestamps, metadata)json_text: JSON with simplified text outputsrt: SubRip subtitle formatvtt: WebVTT subtitle format
Language Codes
Use ISO 639-1 language codes (e.g., en, es, fr, de) or auto for automatic detection.
API Reference
Client Classes
SpeechallApi: Main client for the Speechall APIAsyncSpeechallApi: Async client for the Speechall API
Main Methods
speech_to_text.transcribe()
Transcribe a local audio file.
Parameters:
model(str): Model identifier (e.g., "openai.whisper-1")request(bytes): Audio file contentlanguage(str): Language code or "auto"output_format(str): Output format (text, json, srt, vtt)punctuation(bool): Enable automatic punctuationdiarization(bool): Enable speaker identificationspeakers_expected(int, optional): Expected number of speakerscustom_vocabulary(list, optional): List of custom termsinitial_prompt(str, optional): Context prompt for the modeltemperature(float, optional): Model temperature (0.0-1.0)
speech_to_text.transcribe_remote()
Transcribe audio from a URL.
Parameters: Same as transcribe() but with file_url instead of request
speech_to_text.list_speech_to_text_models()
List all available models.
Examples
Check out the examples directory for more detailed usage examples:
- transcribe_local_file.py - Transcribe local audio files
- transcribe_remote_file.py - Transcribe remote audio URLs
Requirements
- Python 3.8+
- httpx >= 0.27.0
- pydantic >= 2.0.0
- typing-extensions >= 4.0.0
Development
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Type checking
mypy .
Support
- Documentation: docs.speechall.com
- GitHub: github.com/Speechall/speechall-python-sdk
- Issues: github.com/Speechall/speechall-python-sdk/issues
License
MIT License - see LICENSE file for details
Metadata
Release files for speechall 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| speechall-2.0.0.tar.gz | 32.4 kB | Without provenance | Details for speechall-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| speechall-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for speechall-2.0.0-py3-none-any.whl |
Total release size: 89.2 kB
Release files / speechall-2.0.0.tar.gz
| Download URL | speechall-2.0.0.tar.gz |
|---|---|
| Size | 32.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
479ebd6e6949920e1e6ccd3b653f4d796e8e19727dede4dd54da869b798c07ef
|
|
BLAKE2b-256 checksum How to use checksums |
3e88c0f41e790f44b03f66cb623795da6aa7a17d401f6be727dbefe72afc9d44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / speechall-2.0.0-py3-none-any.whl
| Download URL | speechall-2.0.0-py3-none-any.whl |
|---|---|
| Size | 56.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
946450ef6de577cc02fdd02f0f482807d214dae06364d8cb142c132b1f656c67
|
|
BLAKE2b-256 checksum How to use checksums |
39eacf16cdaff18bf6fbaf033aa1651e3c0fe0141f879e84a9ed364f73f6e0b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for speechall 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.