Understanding Talk API usage limits
The Talk API uses rate limiting to ensure fair usage and service stability. Rate limits are enforced per API key through the unified do.dev billing system.
Rate limits are determined by your do.dev billing plan and are shared across all services.
| Limit Type | Description |
|---|---|
| Requests per minute | Maximum API calls per minute per key |
| Requests per day | Maximum API calls per day per key |
Check your plan's limits in the do.dev Dashboard.
When you exceed rate limits, you'll receive a 429 Too Many Requests response:
{
"error": "Rate limit exceeded: 60 requests per minute"
}The response includes a Retry-After header indicating how long to wait (in seconds).
async function generateSpeechWithRetry(text, voice, maxRetries = 3) {
for (let attempt = 0; attempt < maxRetries; attempt++) {
const response = await fetch("https://api.do.dev/v1/talk/speech", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.DO_API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ text, voice })
});
if (response.ok) {
return response.blob();
}
if (response.status === 429) {
const retryAfter = response.headers.get("Retry-After") || 60;
console.log(`Rate limited. Waiting ${retryAfter} seconds...`);
await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
continue;
}
throw new Error(`API error: ${response.status}`);
}
throw new Error("Max retries exceeded");
}import time
import requests
import os
def generate_speech_with_retry(text, voice="aria", max_retries=3):
for attempt in range(max_retries):
response = requests.post(
"https://api.do.dev/v1/talk/speech",
headers={
"Authorization": f"Bearer {os.environ['DO_API_KEY']}",
"Content-Type": "application/json"
},
json={"text": text, "voice": voice}
)
if response.ok:
return response.content
if response.status_code == 429:
retry_after = int(response.headers.get("Retry-After", 60))
print(f"Rate limited. Waiting {retry_after} seconds...")
time.sleep(retry_after)
continue
response.raise_for_status()
raise Exception("Max retries exceeded")Track your API usage in the do.dev Dashboard:
To increase your rate limits, upgrade your plan in the do.dev Dashboard. Higher-tier plans include more requests per minute and per day across all do.dev services.