Skip to content

Async Audio Jobs

Creating a Job

Terminal window
curl https://ghostmind.optdmsa.com/v1/audio/generations \
-H "Authorization: Bearer gmk_live_..." \
-H "Content-Type: application/json" \
-d '{
"input": "Hello, world!",
"voice": "ar-MA-Standard-A"
}'

Response (200):

{
"id": "job-uuid",
"status": "queued"
}

Timing: the upstream provider is browser-automation based — expect roughly 1–2 minutes per clip. Poll every 2–5 s; do not block a latency-sensitive request path on TTS.

Expiry: generated audio expires 24 hours after job creation — download and store the file on your side promptly.

Polling for Completion

import time
import requests
job_id = "job-uuid"
while True:
response = requests.get(
f"https://ghostmind.optdmsa.com/v1/audio/generations/{job_id}",
headers={"Authorization": "Bearer gmk_live_..."},
)
job = response.json()
if job["status"] == "completed":
break
elif job["status"] == "failed":
raise Exception(f"Job failed: {job.get('error_message')}")
time.sleep(2)

Downloading Audio

Terminal window
curl https://ghostmind.optdmsa.com/v1/audio/generations/{job_id}/content \
-H "Authorization: Bearer gmk_live_..." \
-o audio.wav

Next Steps