Documentation Index
Fetch the complete documentation index at: https://docs.obiguard.ai/llms.txt
Use this file to discover all available pages before exploring further.
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:
Python SDK
OpenAI Python
cURL
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()
from openai import OpenAI
from obiguard import createHeaders
client = OpenAI(
base_url='https://gateway.obiguard.ai/v1',
api_key='sk-***', # Your OpenAI API key here
default_headers=createHeaders(
provider="openai",
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()
curl https://gateway.obiguard.ai/v1/audio/speech \
-H "Content-Type: application/json" \
-H "x-obiguard-api-key: vk-obg***" \
-d '{
"model": "tts-1",
"voice": "alloy",
"input": "Today is a wonderful day to build something people love!"
}' --output speech.mp3
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.
| Provider | Models |
|---|
| OpenAI | tts-1, tts-1-hd |
| Azure OpenAI | tts-1, tts-1-hd |
| Deepgram | Coming Soon |
| ElevenLabs | Coming Soon |