The Speechall REST API provides powerful and flexible speech-to-text capabilities. It allows you to transcribe audio files using various underlying STT providers and models, optionally apply custom text replacement rules, and access results in multiple formats. The API includes standard endpoints for transcription and endpoints compatible with the OpenAI API structure.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 0.1.0
- Package version: 0.2.0
- Generator version: 7.13.0
- Build package: org.openapitools.codegen.languages.PythonPydanticV1ClientCodegen For more information, please visit https://speechall.com/contact
Python 3.7+
If the python package is hosted on a repository, you can install directly using:
pip install speechall
(you may need to run pip
with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
)
Then import the package:
import speechall
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install
to install the package for all users)
Then import the package:
import speechall
Execute pytest
to run the tests.
Please follow the installation procedure and then run the following:
import os
import speechall
from speechall.api.speech_to_text_api import SpeechToTextApi
from speechall.models.transcription_model_identifier import TranscriptionModelIdentifier
from speechall.models.transcript_language_code import TranscriptLanguageCode
from speechall.models.transcript_output_format import TranscriptOutputFormat
from speechall.rest import ApiException
# Defining the host is optional and defaults to https://api.speechall.com/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = speechall.Configuration(
host = "https://api.speechall.com/v1"
)
# Configure Bearer authorization (API Key): bearerAuth
configuration = speechall.Configuration(
access_token = os.environ["SPEECHALL_API_KEY"]
)
# Enter a context with an instance of the API client
with speechall.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = speechall.SpeechToTextApi(api_client)
# Path to your audio file
audio_file_path = "path/to/your/audio/file.wav"
try:
# Read the audio file
with open(audio_file_path, 'rb') as audio_file:
audio_data = audio_file.read()
# Transcribe the audio file
result = api_instance.transcribe(
model=TranscriptionModelIdentifier("openai.whisper-1"),
body=audio_data,
language=TranscriptLanguageCode("en"),
output_format=TranscriptOutputFormat.JSON,
punctuation=True
)
# Print the transcribed text
print("Transcription result:")
print(result.text)
except ApiException as e:
print("Exception when calling SpeechToTextApi->transcribe: %s\n" % e)
All URIs are relative to https://api.speechall.com/v1
Class | Method | HTTP request | Description |
---|---|---|---|
ReplacementRulesApi | create_replacement_ruleset | POST /replacement-rulesets | Create a reusable set of text replacement rules. |
SpeechToTextApi | list_speech_to_text_models | GET /speech-to-text-models | Retrieve a list of all available speech-to-text models. |
SpeechToTextApi | transcribe | POST /transcribe | Upload an audio file directly and receive a transcription. |
SpeechToTextApi | transcribe_remote | POST /transcribe-remote | Transcribe an audio file located at a remote URL. |
- BaseTranscriptionConfiguration
- CreateReplacementRuleset201Response
- CreateReplacementRulesetRequest
- ErrorResponse
- ExactRule
- OpenAICreateTranslationRequestModel
- OpenaiCompatibleCreateTranscription200Response
- OpenaiCompatibleCreateTranslation200Response
- RegexGroupRule
- RegexRule
- RemoteTranscriptionConfiguration
- ReplacementRule
- SpeechToTextModel
- TranscriptLanguageCode
- TranscriptOutputFormat
- TranscriptionDetailed
- TranscriptionModelIdentifier
- TranscriptionOnlyText
- TranscriptionProvider
- TranscriptionResponse
- TranscriptionSegment
- TranscriptionWord
Authentication schemes defined for the API:
- Type: Bearer authentication (API Key)