import requests
import time
# 1. Create the task
response = requests.post(
"https://geoff.ai/api/v1/t2a/async",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"text": "Your long-form content here...",
"voice_id": "default",
"format": "mp3",
},
)
task_id = response.json()["data"]["task_id"]
# 2. Poll for completion
while True:
status = requests.get(
f"https://geoff.ai/api/v1/t2a/async/{task_id}",
headers={"Authorization": "Bearer YOUR_API_KEY"},
).json()
if status["data"]["status"] == "completed":
audio_url = status["data"]["audio_url"]
break
time.sleep(2)
print(f"Audio ready: {audio_url}")