Welcome to the ai|coustics API Python Examples repository! This repository contains example scripts and tutorials on how to use the ai|coustics API with Python.
ai|coustics provides AI-driven speech enhancement to enriching media experiences and natural conversations. This repository provides sample code to help you quickly integrate the ai|coustics API into your Python applications.
- Python 3.12.4
- An ai|coustics API key. You can get one by signing up on our developer portal.
- Clone the repository:
git clone https://github.com/ai-coustics/api-tutorials.git
cd api-tutorials-
Create a virtual environment, activate it, and install the dependencies:
- Recommended: using the
uv(documentation). Runuv sync - Or by using the python
venvmodule and therequirements.txtfile
- Recommended: using the
-
Create the
.envfile that would includeAPI_KEYand optionally theWEBHOOK_SIGNATUREvalues. Check the description of the environment values at the configs.py
The upload.py and download.py are simple examples. The advanced.py is implementing the whole cycle: uploading, catching an update using webhook, and downloading an enhanced media file.
Every example file has the entry point in the bottom where you can set your values. For instance in the download.py you are required to set the generated_name variable value, as a generated name of a file is unique.
- Upload
python -m src.examples.upload- Download
python -m src.examples.downloadDon't forget to change the generated_name, using the value returned from the upload example.
python -m src.examples.advanced- Expose the
localhost:8002adress to the internent. There are multiple options of how you can do this, but for testing you can consider such free services like ngrok. Optionally, at the entry point you can change the default values of thewebhook_server_hostandwebhook_server_portvariables, which are"localhost"and8002respectively. - Create a webhook on the developer portal. The
URLshould be routing to the<exposed_address>/callbacks, as the advacned script is listening for thehttp://localhost:8002/callbacksendpoint. If you configured theWEBHOOK_SIGNATUREenvironment variable, use it as theSignaturevalue.
To better understand where media files are comming from, review the mocks.py file and change the mock_get_media_queue_period variable's value.
You can find the full API documentation here.
This project is licensed under the MIT License.
For any questions, feel free to reach out to us at support@ai-coustics.com or visit our website ai-coustics.com.