Usage

The API follows the OpenAI format, allowing you to send input text and specify a voice option in your request. Supported output formats include mp3, opus, aac, flac, and pcm. Obiguard also enables real-time audio streaming for TTS models. Example:
from obiguard import Obiguard

client = Obiguard(
  provider='openai',
  obiguard_api_key='vk-obg***',  # Your Obiguard virtual key here
)

speech_file_path = Path(__file__).parent / "speech.mp3"

response = client.audio.speech.create(
  model="tts-1",
  voice="alloy",
  input="Today is a wonderful day to build something people love!"
)

f = open(speech_file_path, "wb")
f.write(response.content)
f.close()
After completion, the request will appear in the logs UI, displaying the associated cost and latency.

Supported Providers and Models

The following providers currently support text-to-speech. More providers will be added soon.
ProviderModels
OpenAItts-1, tts-1-hd
Azure OpenAItts-1, tts-1-hd
DeepgramComing Soon
ElevenLabsComing Soon