Audio

Text-to-Speech

Convert text into natural-sounding speech using the audio generation endpoint.

Python

python
import requests

BASE_URL = "https://api.oneinfer.ai"
token = requests.post(
    f"{BASE_URL}/v1/ula/oauth-authentication?api_key=YOUR_API_KEY"
).json()["access_token"]

response = requests.post(
    f"{BASE_URL}/v1/ula/chat/completions",
    headers={"Authorization": f"Bearer {token}", "Content-Type": "application/json"},
    json={
        "provider": "openai",
        "model": "tts-1",
        "messages": [{"role": "user", "content": "Welcome to OneInfer, your unified AI inference platform."}],
    },
)

audio_url = response.json()["data"].get("audios")
print("Audio:", audio_url)