Skip to content

Audio — Text-to-Speech & Speech-to-Text

For an audio model that runs asynchronously, you may either set webhook_url on one request or register an organization Model Webhook. Synchronous calls and LLM calls do not support task callbacks; if they contain this field, SandBase ignores it and schedules no callback. See Webhooks.

POST/v1/run

Generate speech from text (TTS) or transcribe audio to text (STT).

Text-to-Speech

python
response = client.post("/v1/run", json={
    "model": "openai/tts-1",
    "input": "Hello, welcome to SandBase!",
    "voice": "alloy"
})
# Returns audio URL
print(response.json()["outputs"][0]["url"])

Speech-to-Text

python
response = client.post("/v1/run", json={
    "model": "openai/whisper-1",
    "audio_url": "https://example.com/audio.mp3"
})
print(response.json()["outputs"][0]["text"])

Per-task callback (async only)

Set webhook_url only when the selected audio model resolves to asynchronous execution:

python
response = client.post("/v1/run", json={
    "model": "example/async-audio-model",
    "mode": "async",
    "input": "Hello, welcome to SandBase!",
    "webhook_url": "https://hooks.example.com/sandbase/task?token=opaque-token"
})
generation_id = response.json()["id"]

SandBase sends the completed, failed, or timeout event to that URL with X-Event-ID. Delivery is at-least-once, so deduplicate by that ID and return 2xx quickly. The URL must be public HTTPS. When webhook_url is present, it is the only callback target for this task and registered organization Model Webhooks are skipped; failures retry the same task URL without fallback. Per-task callbacks do not include X-Signature; omit webhook_url and use an organization Model Webhook when HMAC verification is required.

Available Models

ModelTypeProvider
openai/tts-1TTSOpenAI
openai/tts-1-hdTTS (HD)OpenAI
openai/whisper-1STTOpenAI
fish-audio/speech-1TTSFish Audio

Browse all audio models