🗣️TTS Generations

Ever wanted a hot girl to say your name? Here you go.


import requests

# Define the URL for the Shard AI API endpoint.
api_url = "https://api.shard-ai.xyz/v1/audio/speech"

# Define the data to be sent in the request.
request_data = {
    "model": "gtts",
    "input": "kitty"
}

# Provide the authorization token for accessing the API.
authorization_token = "Bearer shard-xxx"

# Define request headers.
headers = {
    "Content-Type": "application/json",
    "Authorization": authorization_token
}

# Make the request.
response = requests.post(api_url, json=request_data, headers=headers)

# Check if the request was successful.
if response.ok:
    # Write the response to a file.
    with open("output.mp3", "wb") as f:
        f.write(response.content)
    print("File written successfully: output.mp3")
else:
    print("Error:", response.status_code)

Returns binary data.

Last updated