The official Python SDK for SpeechCortex ASR platform.
Project description
SpeechCortex Python SDK
Official Python SDK for SpeechCortex ASR (Automatic Speech Recognition) platform.
Features
- Real-time Speech Recognition: WebSocket-based streaming ASR
- Pre-recorded Transcription: REST API for batch processing (coming soon)
- Easy Integration: Simple, intuitive API
- Async Support: Full async/await support for modern Python applications
Requirements
- Python 3.10 or higher
Installation
pip install "git+https://github.com/speechcortex/speechcortex-sdk.git@package_init"
export SPEECHCORTEX_API_KEY=your_api_key_here
export SPEECHCORTEX_HOST=wss://api.speechcortex.com
Quick Start
Real-time Transcription
from speechcortex import SpeechCortexClient, LiveTranscriptionEvents, LiveOptions
# Initialize the client
speechcortex = SpeechCortexClient(api_key="your_api_key_here")
# Get WebSocket connection
connection = speechcortex.listen.websocket.v("1")
# Set up event handlers
def on_message(self, result, **kwargs):
sentence = result.channel.alternatives[0].transcript
if result.is_final:
print(f"Final: {sentence}")
else:
print(f"Interim: {sentence}")
def on_error(self, error, **kwargs):
print(f"Error: {error}")
# Register event handlers
connection.on(LiveTranscriptionEvents.Transcript, on_message)
connection.on(LiveTranscriptionEvents.Error, on_error)
# Configure options
options = LiveOptions(
model="zeus-v1",
language="en-US",
smart_format=True,
)
# Start the connection
connection.start(options)
# Send audio data
connection.send(audio_data)
# Close when done
connection.finish()
Using with Microphone
from speechcortex import SpeechCortexClient, LiveTranscriptionEvents, LiveOptions, Microphone
speechcortex = SpeechCortexClient()
connection = speechcortex.listen.websocket.v("1")
# Set up event handlers...
connection.on(LiveTranscriptionEvents.Transcript, on_message)
# Start connection
options = LiveOptions(model="zeus-v1", smart_format=True)
connection.start(options)
# Use microphone helper
microphone = Microphone(connection.send)
microphone.start()
# Microphone will stream audio automatically
# Press Ctrl+C to stop
microphone.finish()
connection.finish()
Configuration
API Key
Set your API key via environment variable:
export SPEECHCORTEX_API_KEY=your_api_key_here
Or pass it directly:
speechcortex = SpeechCortexClient(api_key="your_api_key_here")
Custom Endpoints
from speechcortex import SpeechCortexClient, SpeechCortexClientOptions
config = SpeechCortexClientOptions(
api_key="your_api_key",
url="https://custom-api.speechcortex.com"
)
speechcortex = SpeechCortexClient(config=config)
Features
Real-time Transcription Options
model: ASR model to use (e.g., "zeus-v1")language: Language code (e.g., "en-US")smart_format: Enable smart formattingpunctuate: Enable punctuationinterim_results: Receive interim resultsutterance_end_ms: Utterance end timeout in millisecondsvad_events: Enable voice activity detection events
Events
Open: Connection openedTranscript: Transcription result receivedMetadata: Metadata receivedSpeechStarted: Speech detectedUtteranceEnd: End of utterance detectedClose: Connection closedError: Error occurredUnhandled: Unhandled message received
Development
Setup Development Environment
# Clone the repository
git clone https://github.com/speechcortex/speechcortex-sdk.git
cd speechcortex-sdk
# Install dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
# Run linting
pylint speechcortex/
# Format code
black speechcortex/
License
MIT License - see LICENSE file for details.
Support
For issues, questions, or contributions, please visit our GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file speechcortex_sdk-0.1.2.tar.gz.
File metadata
- Download URL: speechcortex_sdk-0.1.2.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ac3e38508dc1d96596867316eb2fdff82bf32fe445425f2b0fd8b3112cc4cde
|
|
| MD5 |
d16cb87b92def254d07088fda1598626
|
|
| BLAKE2b-256 |
611d49dc52dcd64445c398e68bf199edde40a92392039c5f0d250c19e2d6d162
|
Provenance
The following attestation bundles were made for speechcortex_sdk-0.1.2.tar.gz:
Publisher:
publish.yml on speechcortex/speechcortex-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechcortex_sdk-0.1.2.tar.gz -
Subject digest:
6ac3e38508dc1d96596867316eb2fdff82bf32fe445425f2b0fd8b3112cc4cde - Sigstore transparency entry: 968124943
- Sigstore integration time:
-
Permalink:
speechcortex/speechcortex-sdk@e272077b1209763517fb6b0c9624c127a802de52 -
Branch / Tag:
refs/heads/old_websocket_compatible - Owner: https://github.com/speechcortex
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e272077b1209763517fb6b0c9624c127a802de52 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file speechcortex_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: speechcortex_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc6e23a958b2365f82bb2d2c66b9d3fbd82ababdf2460d56f29ad6c47b9151d6
|
|
| MD5 |
863509c8df77f73ee37eba69bc0f041f
|
|
| BLAKE2b-256 |
9a8e68049b59ac91b3220f8b48d3cfe7dff1d70d9f727bbcc498e304c699b93c
|
Provenance
The following attestation bundles were made for speechcortex_sdk-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on speechcortex/speechcortex-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
speechcortex_sdk-0.1.2-py3-none-any.whl -
Subject digest:
dc6e23a958b2365f82bb2d2c66b9d3fbd82ababdf2460d56f29ad6c47b9151d6 - Sigstore transparency entry: 968125028
- Sigstore integration time:
-
Permalink:
speechcortex/speechcortex-sdk@e272077b1209763517fb6b0c9624c127a802de52 -
Branch / Tag:
refs/heads/old_websocket_compatible - Owner: https://github.com/speechcortex
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e272077b1209763517fb6b0c9624c127a802de52 -
Trigger Event:
workflow_dispatch
-
Statement type: