Mythic Infinity python client library.
Project description
MythicInfinity Python Client
Ultra-low latency realtime AI Text to Speech.
Sign Up for an API Key »
Read the docs
·
Report Bug
Overview
- Easy installation with pip.
- Streaming audio bytes and non-streaming both supported.
- Async/await and standard sync code both supported.
Installation
Install the python package as a dependency of your application.
$ pip install mythicinfinity
Basic Examples
from mythicinfinity import MythicInfinityClient
def main():
# Instantiate the client with your api key
client = MythicInfinityClient(api_key="YOUR_API_KEY")
# Call the TTS API. By default, stream is False.
audio_bytes = client.tts.generate(text="Hello world.")
with open('my_audio.wav', 'wb') as f:
f.write(audio_bytes)
if __name__ == "__main__":
main()
This sample calls the Text-To-Speech service and saves the resultant audio bytes to a file.
Streaming Example
from mythicinfinity import MythicInfinityClient
def main():
# Instantiate the client with your api key
client = MythicInfinityClient(api_key="YOUR_API_KEY")
# Call the TTS API with stream=True.
# This will stream the audio bytes in real-time,
# as they become available from the AI model.
audio_bytes_generator = client.tts.generate(text="Hello world.", stream=True)
with open('my_audio.wav', 'wb') as f:
for audio_bytes in audio_bytes_generator:
f.write(audio_bytes)
if __name__ == "__main__":
main()
Async Support
- Code relying on
async / awaitpatterns is fully supported.
import asyncio
from mythicinfinity import AsyncMythicInfinityClient
async def main():
# Instantiate the client with your api key
client = AsyncMythicInfinityClient(api_key="YOUR_API_KEY")
# Call the TTS API with stream=False.
audio_bytes = await client.tts.generate(text="Hello world.")
with open('my_async_audio_1.wav', 'wb') as f:
f.write(audio_bytes)
# Call the TTS API with stream=True.
# This will stream the audio bytes in real-time,
# as they become available from the AI model.
audio_bytes_generator = await client.tts.generate(text="Hello world.", stream=True)
with open('my_async_audio_2.wav', 'wb') as f:
async for audio_bytes in audio_bytes_generator:
f.write(audio_bytes)
if __name__ == "__main__":
asyncio.run(main())
This sample first calls the client.tts.generate method without streaming using await and then does the same with
streaming enabled.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mythicinfinity-0.1.0.tar.gz.
File metadata
- Download URL: mythicinfinity-0.1.0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0cfb4e5d42eaad6494fca5433249db3a26a9ceb8745edbb67b3abcd71302e75
|
|
| MD5 |
3d99316657faf0d4c87d569d4fb5b0ee
|
|
| BLAKE2b-256 |
8a1a82b4b1888c0994dfe2b299350c869efd6d80523f5a1e7c8053c21a630df5
|
Provenance
The following attestation bundles were made for mythicinfinity-0.1.0.tar.gz:
Publisher:
release.yml on MythicInfinity/mythicinfinity-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mythicinfinity-0.1.0.tar.gz -
Subject digest:
b0cfb4e5d42eaad6494fca5433249db3a26a9ceb8745edbb67b3abcd71302e75 - Sigstore transparency entry: 170839507
- Sigstore integration time:
-
Permalink:
MythicInfinity/mythicinfinity-python@4acae13df9f4051aac3a1bc8b6a6bdee8651242b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/MythicInfinity
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4acae13df9f4051aac3a1bc8b6a6bdee8651242b -
Trigger Event:
push
-
Statement type: