TTS extension for multiai using OpenAI and Google GenAI
Project description
multiai-tts
multiai-tts is an extension library for multiai that provides Text-to-Speech (TTS) capabilities using OpenAI and Google GenAI.
Prerequisites
API Key Configuration
This library relies on the configuration provided by multiai. You must set up your API keys (OpenAI API Key, Google API Key) using multiai's configuration files or environment variables before using this library.
For details on how to configure API keys, please refer to the multiai documentation.
Installation
You also need to install ffmpeg on your system if you want to save audio in formats other than WAV (e.g., MP3).
pip install multiai-tts
Usage
Google GenAI Example
import sys
import multiai_tts
provider = 'google'
model = 'gemini-2.5-flash-preview-tts'
client = multiai_tts.Prompt()
client.set_tts_model(provider, model)
client.tts_voice_google = 'charon'
# Speak directly
client.speak("Please speak the following. Hello, this is a test from Google model.")
if client.error:
print(client.error_message)
sys.exit(1)
# Save to file
client.save_tts("Please speak the following. Saving this audio to mp3.", "output_google.mp3")
if client.error:
print(client.error_message)
sys.exit(1)
OpenAI Example
import sys
import multiai_tts
provider = 'openai'
model = 'gpt-4o-mini-tts'
client = multiai_tts.Prompt()
client.set_tts_model(provider, model)
client.tts_voice_openai = 'marin'
# Speak directly
client.speak("Hello, this is a test from OpenAI model.")
if client.error:
print(client.error_message)
sys.exit(1)
# Save to file
client.save_tts("Saving this audio to mp3.", "output_openai.mp3")
if client.error:
print(client.error_message)
sys.exit(1)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file multiai_tts-0.1.0.tar.gz.
File metadata
- Download URL: multiai_tts-0.1.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a2739672a2f52042c8ceaa5baf163ac0af324c110072eea73cc72f39ddcb265
|
|
| MD5 |
e450c24849a08b4ab45a18bdf26d1def
|
|
| BLAKE2b-256 |
74867604fe595fb96b9663b30709899bfb6d1db8396fed81eaf9aac4cbf0033c
|
File details
Details for the file multiai_tts-0.1.0-py3-none-any.whl.
File metadata
- Download URL: multiai_tts-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c406c6d753d34064aac3e2f2bc854318fce724fd2be6e729829f3b3cb9c8f05
|
|
| MD5 |
d17888c7ecc798eddc88abafc77eec69
|
|
| BLAKE2b-256 |
64b3b6afdf662cfa01b9d8b6e0e8453aaf39fd1f463cbf09053a4611a3d02a6b
|