### Run STT List Models Example Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Execute the script to list available Speech-to-Text (STT) models. Ensure environment variables are set. ```bash python examples/01_stt_list_models.py ``` -------------------------------- ### Install GL Speech Library Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Use this command to install the GL Speech library via pip. Ensure you have Python and pip installed. ```bash pip install gl-speech ``` -------------------------------- ### Run Webhooks List Endpoints Example Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Execute the script to list available webhook endpoints. Ensure environment variables are set, including GLSPEECH_WEBHOOK_SIDE if needed. ```bash python examples/13_webhooks_list_endpoints.py ``` -------------------------------- ### Run TTS Synthesize Example Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Execute the script to synthesize speech from text using the Text-to-Speech (TTS) service. Ensure environment variables are set. ```bash python examples/07_tts_synthesize.py ``` -------------------------------- ### Manage Webhook Endpoints and Events Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Manage webhook endpoints and events using the appropriate client (STT or TTS). This includes listing, creating, getting, updating, deleting, rotating secrets, and testing endpoints, as well as listing and retrieving events and deliveries. ```python # Webhooks (use the client that matches the job type: STT or TTS) stt_client.webhooks.list_endpoints() stt_client.webhooks.create_endpoint(url="https://...", event_filters=["stt.job.completed"]) tts_client.webhooks.list_endpoints() tts_client.webhooks.create_endpoint(url="https://...", event_filters=["tts.job.completed"]) stt_client.webhooks.get_endpoint(endpoint_id) tts_client.webhooks.update_endpoint(endpoint_id, url="https://...") tts_client.webhooks.delete_endpoint(endpoint_id) tts_client.webhooks.rotate_secret(endpoint_id) tts_client.webhooks.list_events() tts_client.webhooks.get_event(event_id) tts_client.webhooks.test_endpoint(endpoint_id) tts_client.webhooks.list_deliveries(endpoint_id) ``` -------------------------------- ### STT Client Initialization Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Initialize the Speech-to-Text client using API key and base URL. Environment variables can also be used. ```APIDOC ## STT Client Initialization ### Description Initialize the Speech-to-Text client using API key and base URL. Environment variables can also be used. ### Method `SpeechClient` constructor ### Parameters - **api_key** (string) - Required - Your STT API key. - **base_url** (string) - Required - The base URL for the STT service. ### Request Example ```python from gl_speech import SpeechClient stt_client = SpeechClient( api_key="your-stt-api-key", # or from GLSPEECH_STT_API_KEY base_url="https://...", # or from GLSPEECH_STT_BASE_URL ) ``` ``` -------------------------------- ### TTS Client Initialization Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Initialize the Text-to-Speech client using API key and base URL. Environment variables can also be used. ```APIDOC ## TTS Client Initialization ### Description Initialize the Text-to-Speech client using API key and base URL. Environment variables can also be used. ### Method `SpeechClient` constructor ### Parameters - **api_key** (string) - Required - Your TTS API key. - **base_url** (string) - Required - The base URL for the TTS service. ### Request Example ```python from gl_speech import SpeechClient tts_client = SpeechClient( api_key="your-tts-api-key", # or from GLSPEECH_TTS_API_KEY base_url="https://...", # or from GLSPEECH_TTS_BASE_URL ) ``` ``` -------------------------------- ### Initialize STT and TTS Clients and Manage Webhooks Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Initialize separate SpeechClient instances for STT and TTS using API keys and base URLs. Configure and manage webhook endpoints for STT and TTS job completion events. ```python from gl_speech import SpeechClient stt_client = SpeechClient( api_key="your-stt-api-key", # or from GLSPEECH_STT_API_KEY base_url="https://...", # or from GLSPEECH_STT_BASE_URL ) tts_client = SpeechClient( api_key="your-tts-api-key", # or from GLSPEECH_TTS_API_KEY base_url="https://...", # or from GLSPEECH_TTS_BASE_URL ) # Webhooks: STT job events use stt_client.webhooks, TTS job events use tts_client.webhooks stt_client.webhooks.create_endpoint(url="https://...", event_filters=["stt.job.completed"]) tts_client.webhooks.create_endpoint(url="https://...", event_filters=["tts.job.completed"]) stt_client.webhooks.list_endpoints() # STT webhook endpoints tts_client.webhooks.list_endpoints() # TTS webhook endpoints ``` -------------------------------- ### Set GL Speech Environment Variables Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Configure your environment with API keys and base URLs for STT and TTS services. These variables are essential for authenticating and connecting to the GL Speech API endpoints. ```bash export GLSPEECH_STT_API_KEY="your-stt-api-key" export GLSPEECH_STT_BASE_URL="https://api.prosa.ai/v2/speech/" # or your STT endpoint export GLSPEECH_TTS_API_KEY="your-tts-api-key" export GLSPEECH_TTS_BASE_URL="https://api.prosa.ai/v2/speech/" # or your TTS endpoint ``` -------------------------------- ### Perform STT Operations Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Utilize the STT client to list available models, transcribe audio data, and manage transcription jobs. Requires `base64_audio` and `job_id` to be defined. ```python # STT stt_client.stt.list_models() stt_client.stt.transcribe(model="stt-general", data=base64_audio, wait=True) stt_client.stt.list_jobs(per_page=10) stt_client.stt.get_job(job_id) stt_client.stt.get_status(job_id) ``` -------------------------------- ### Perform TTS Operations Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Utilize the TTS client to list available models, synthesize text to speech, and manage synthesis jobs. Requires `job_id` to be defined. ```python # TTS tts_client.tts.list_models() tts_client.tts.synthesize(model="tts-dimas-formal", text="Hello", wait=True) tts_client.tts.list_jobs() tts_client.tts.get_job(job_id) tts_client.tts.get_status(job_id) tts_client.tts.archive(job_id) tts_client.tts.count_jobs() ``` -------------------------------- ### STT Webhook Management Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Manage STT webhook endpoints for receiving job completion events. ```APIDOC ## STT Webhook Management ### Description Manage STT webhook endpoints for receiving job completion events. ### Methods - **create_endpoint(url: str, event_filters: list[str])**: Creates a new STT webhook endpoint. - **list_endpoints()**: Lists all configured STT webhook endpoints. - **get_endpoint(endpoint_id: str)**: Retrieves details of a specific STT webhook endpoint. - **update_endpoint(endpoint_id: str, url: str)**: Updates an existing STT webhook endpoint URL. - **delete_endpoint(endpoint_id: str)**: Deletes an STT webhook endpoint. - **rotate_secret(endpoint_id: str)**: Rotates the secret for an STT webhook endpoint. - **list_events()**: Lists available STT event types. - **get_event(event_id: str)**: Retrieves details of a specific STT event. - **test_endpoint(endpoint_id: str)**: Tests an STT webhook endpoint. - **list_deliveries(endpoint_id: str)**: Lists webhook delivery attempts for an STT endpoint. ### Request Example (Create Endpoint) ```python stt_client.webhooks.create_endpoint(url="https://...", event_filters=["stt.job.completed"]) ``` ### Request Example (List Endpoints) ```python stt_client.webhooks.list_endpoints() ``` ``` -------------------------------- ### TTS Webhook Management Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Manage TTS webhook endpoints for receiving job completion events. ```APIDOC ## TTS Webhook Management ### Description Manage TTS webhook endpoints for receiving job completion events. ### Methods - **create_endpoint(url: str, event_filters: list[str])**: Creates a new TTS webhook endpoint. - **list_endpoints()**: Lists all configured TTS webhook endpoints. - **get_endpoint(endpoint_id: str)**: Retrieves details of a specific TTS webhook endpoint. - **update_endpoint(endpoint_id: str, url: str)**: Updates an existing TTS webhook endpoint URL. - **delete_endpoint(endpoint_id: str)**: Deletes a TTS webhook endpoint. - **rotate_secret(endpoint_id: str)**: Rotates the secret for a TTS webhook endpoint. - **list_events()**: Lists available TTS event types. - **get_event(event_id: str)**: Retrieves details of a specific TTS event. - **test_endpoint(endpoint_id: str)**: Tests a TTS webhook endpoint. - **list_deliveries(endpoint_id: str)**: Lists webhook delivery attempts for a TTS endpoint. ### Request Example (Create Endpoint) ```python tts_client.webhooks.create_endpoint(url="https://...", event_filters=["tts.job.completed"]) ``` ### Request Example (List Endpoints) ```python tts_client.webhooks.list_endpoints() ``` ``` -------------------------------- ### STT Operations Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Perform Speech-to-Text operations including listing models, transcribing audio, and managing jobs. ```APIDOC ## STT Operations ### Description Perform Speech-to-Text operations including listing models, transcribing audio, and managing jobs. ### Methods - **list_models()**: Lists available STT models. - **transcribe(model: str, data: str, wait: bool = False)**: Transcribes audio data. - **list_jobs(per_page: int = 10)**: Lists STT jobs. - **get_job(job_id: str)**: Retrieves details of a specific STT job. - **get_status(job_id: str)**: Retrieves the status of a specific STT job. ### Request Example (Transcribe) ```python base64_audio = "..." result = stt_client.stt.transcribe(model="stt-general", data=base64_audio, wait=True) ``` ### Request Example (List Jobs) ```python jobs = stt_client.stt.list_jobs(per_page=10) ``` ``` -------------------------------- ### TTS Operations Source: https://github.com/gdplabs/gl-speech-sdk-cookbook/blob/main/README.md Perform Text-to-Speech operations including listing models, synthesizing speech, and managing jobs. ```APIDOC ## TTS Operations ### Description Perform Text-to-Speech operations including listing models, synthesizing speech, and managing jobs. ### Methods - **list_models()**: Lists available TTS models. - **synthesize(model: str, text: str, wait: bool = False)**: Synthesizes speech from text. - **list_jobs()**: Lists TTS jobs. - **get_job(job_id: str)**: Retrieves details of a specific TTS job. - **get_status(job_id: str)**: Retrieves the status of a specific TTS job. - **archive(job_id: str)**: Archives a TTS job. - **count_jobs()**: Counts the total number of TTS jobs. ### Request Example (Synthesize) ```python audio_output = tts_client.tts.synthesize(model="tts-dimas-formal", text="Hello", wait=True) ``` ### Request Example (List Jobs) ```python jobs = tts_client.tts.list_jobs() ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.