Why Speech to Text API Returns 429 & How to Fix
In this article
Speech-to-text API requests return HTTP 429 (Too Many Requests) when you exceed the rate limit or quota set by the provider. The fix is to reduce request frequency, increase your quota, or implement exponential backoff with retries.
What Does a 429 Error Mean?
HTTP 429 is a standard status code defined in RFC 6585. It tells the client that it has sent too many requests in a given time window. For speech-to-text APIs, this usually happens because:
- You exceed the number of requests per minute (RPM) or per day.
- You exceed the concurrent request limit.
- Your audio duration exceeds the allowed minutes per month.
- The API key or project has a low default quota.
Unlike a 500 error (server fault), a 429 is a client-side issue—your code is making more calls than the service allows. The response typically includes a Retry-After header or a JSON body with details.
Why Speech-to-Text APIs Enforce Limits
Speech recognition is computationally expensive. Processing audio involves neural networks that consume significant CPU/GPU resources. Providers like Google Cloud, AWS Transcribe, Azure Speech, and IBM Watson impose limits to:
- Protect the service from abuse or accidental infinite loops.
- Ensure fair usage among all customers.
- Manage infrastructure capacity during peak times.
Limits are usually tiered—free tiers have lower limits, while paid tiers allow more. For example, Google’s Speech-to-Text has a default of 60 requests per minute for short audio, but you can request an increase.
Common Causes of 429 Errors
Besides simply making too many calls, other frequent triggers include:
- Bursts: Sending many requests at once (e.g., processing a batch of files in parallel without throttling).
- Missing retry logic: Not handling transient 429s, so failures pile up.
- Long audio: Some APIs count minutes of audio, not just requests. Long files can exhaust your quota quickly.
- Shared API key: Multiple services or users using the same key collectively hit the limit.
- Wrong region: Some providers have separate quotas per region; you might be hitting a regional limit.
How to Fix a 429 Error
Here are the steps to resolve and prevent 429 responses:
- Check the error details: Read the response body and headers. Look for
Retry-After(seconds to wait) or aquotafield. - Implement exponential backoff: When you get a 429, wait and retry. Start with 1 second, double the wait each attempt (e.g., 1, 2, 4, 8 seconds), and cap at a maximum (e.g., 60 seconds). Add jitter (random delay) to avoid thundering herd.
- Reduce concurrency: If you’re sending multiple requests in parallel, limit the number of simultaneous calls. Use a semaphore or queue.
- Increase your quota: In the provider’s console (e.g., Google Cloud Console, AWS Service Quotas), request a quota increase. You may need to provide justification and wait for approval.
- Use asynchronous processing: For long audio, switch to long-running operations (e.g., Google’s
LongRunningRecognize, AWS Transcribe jobs). These have separate, often higher, limits. - Optimize audio: Reduce sample rate or compress audio to lower the processing cost, which may count against your quota.
- Spread requests over time: Add a small delay between requests (e.g., 100ms) to stay under the per-minute limit.
Best Practices for Production Systems
In a production environment, you should design for 429s as a normal event:
- Use a client library that has built-in retry logic (most official SDKs do).
- Monitor your usage via provider dashboards or logs.
- Set up alerts when you approach 80% of your quota.
- Implement a circuit breaker: if you get repeated 429s, stop making calls for a cooldown period.
- Cache results for identical audio files to avoid reprocessing.
Comparing Major Providers
Different providers have different limits and error formats:
- Google Cloud Speech-to-Text: Returns 429 with a
Retry-Afterheader. Quotas are per-minute and per-day. You can request increases. - AWS Transcribe: For batch jobs, limits are based on concurrent jobs. For real-time streaming, it’s transactions per second. Errors include
LimitExceededException. - Azure Speech: Returns 429 with
Retry-After. Free tier has 5 transactions per second. Paid tiers can be increased. - IBM Watson Speech to Text: Uses a rate limit of 100 requests per minute for standard plans. Returns 429 with a
Retry-Afterheader.
Always check the provider’s documentation for exact numbers, as they change.
Frequently Asked Questions
What is the difference between a rate limit and a quota?
A rate limit is the maximum number of requests you can make in a short period (e.g., per minute). A quota is a longer-term allowance (e.g., per day or per month). A 429 can be triggered by either. For example, you might be under the per-minute limit but have exhausted your daily minutes of audio.
Can I bypass a 429 by using a different API key?
Technically, yes, but it’s not recommended. It violates the provider’s terms of service and can lead to account suspension. Instead, request a quota increase or optimize your usage.
How long should I wait before retrying?
Use the Retry-After header if present. If not, start with 1 second and double up to a maximum of 60 seconds. For streaming APIs, you might need to reconnect after a short delay.
Does sending shorter audio files reduce the chance of a 429?
Yes, if the provider counts audio minutes. Shorter files consume less quota. However, if the limit is purely on request count, it won’t help—you’ll still hit the same number of requests.
Why do I get 429 even when I make only one request?
This can happen if your API key is shared, or if the provider has a very low default quota for new accounts. Check the error message for specifics—it might say “daily limit exceeded” or “concurrent requests exceeded.”
Is a 429 error permanent?
No, it’s transient. It means you’ve hit a temporary limit. Once the time window resets (e.g., a minute or a day), you can make requests again. If you keep getting 429s, you need to adjust your code or quota.