EN ▾
Get API key

Troubleshooting 429 Errors and Rate Limits in Uncensored Ollama API

Developers building proxy tools or high-throughput agents often worry about how the API handles mid-stream interruptions and rate limiting. This article explains how to manage HTTP 429 responses and retries for streaming requests, ensuring your client sees a complete response rather than a truncated one.

Digital dashboard showing streaming text tokens and a glowing 429 error icon

Understanding Rate Limits and 429 Errors

When you build applications that interact with our uncensored Ollama API, you must account for rate limits to ensure smooth operation. Our service enforces a limit of 300 requests per minute per API key. This limit is designed to maintain stability for all users while allowing high throughput for individual keys. If you exceed this threshold, the API returns an HTTP 429 Too Many Requests error. This error indicates that you have sent too many requests in a given amount of time. It is important to monitor your request frequency, especially if you are building a proxy or a tool that aggregates multiple keys.

Understanding how rate limits work is important for developers who rely on consistent API availability. Our API does not offer subscription tiers or monthly fees, so the rate limit applies uniformly to all prepaid accounts. This means that even if you have ample credit, you can still hit the rate limit if you send requests too quickly. The limit is calculated per key, so using multiple keys can help distribute the load. However, each key has its own 300 requests per minute limit.

When a 429 error occurs, your application should handle it gracefully. Instead of failing immediately, you can implement exponential backoff strategies to retry the request after a short delay. This approach helps prevent overwhelming the server and reduces the likelihood of consecutive failures. It is also useful to log these errors to identify patterns in your usage. By tracking when 429 errors occur, you can adjust your request pacing or scale your key usage.

For developers using our API for high-throughput agents, rate limits are a key consideration. The limit ensures that no single key dominates the server's resources. This balance allows for fair access across all users. If you are building a tool that rotates keys, you should ensure that each key stays within its limit. This strategy helps maintain consistent performance and minimizes the risk of interruptions. Always check the API documentation for the most current rate limit policies, as they may change based on server load.

Handling Mid-Stream Interruptions in SSE

Our API supports streaming responses over Server-Sent Events (SSE). This feature allows you to receive text tokens as they are generated, providing a faster and more interactive user experience. In a streaming response, the server sends data in chunks, with the final chunk containing usage information. This usage data includes token counts for input and output, which helps you track your credit usage in real time. However, streaming introduces complexity when it comes to handling interruptions.

One common issue is encountering a 429 error mid-stream. If the rate limit is hit while a streaming response is in progress, the connection may be terminated abruptly. This can result in a truncated response, where the client receives only part of the generated text. To mitigate this, your client should be prepared to handle incomplete streams. You can implement logic to detect unexpected end-of-stream events and trigger a retry.

When a mid-stream interruption occurs, the client should not assume the response is complete. Instead, it should wait for a signal that the stream has ended normally. If the connection drops or returns a 429 error, the client can retry the request. However, retrying a streaming request can be challenging because you need to reconstruct the full response. Some proxies handle this by retrying the entire completion, ensuring that the client receives a full response.

It is also important to note that not all 429 errors result in mid-stream interruptions. Sometimes, the error occurs before the stream starts, allowing you to retry without losing any data. In other cases, the error occurs after the stream has begun, requiring more sophisticated error handling. By understanding how streaming works and how interruptions manifest, you can build more reliable applications that handle rate limits effectively.

Implementing Retry Logic for Reliable Clients

To build reliable applications that interact with our uncensored Ollama API, you need to implement effective retry logic. Retry logic allows your client to recover from transient errors, such as 429 rate limit errors, without manual intervention. When a 429 error occurs, your client should wait for a specified period before retrying the request. This wait time, known as backoff, helps prevent overwhelming the server and reduces the chance of consecutive failures.

Exponential backoff is a common strategy where the wait time increases with each retry. For example, you might wait one second after the first failure, two seconds after the second, and so on. This approach balances responsiveness with server protection. It is also useful to set a maximum number of retries to avoid infinite loops. If the request fails too many times, you can report an error to the user or log the issue for further investigation.

When implementing retry logic, consider the type of request you are making. For non-streaming requests, retrying is straightforward: you simply resend the request and wait for a new response. For streaming requests, retrying can be more complex because you need to handle the stream's state. Some clients retry the entire completion, while others resume from the last known token. The choice depends on your application's requirements and the complexity of the stream handling.

It is also important to handle errors gracefully. If a retry fails, your client should provide feedback to the user. This feedback can include the error message, the number of retries attempted, and suggestions for resolving the issue. By providing clear and actionable feedback, you help users understand what went wrong and how to proceed. This improves the overall user experience and reduces frustration.

Managing Key Rotation and Load Distribution

If you are building a proxy or a tool that handles multiple API keys, key rotation can help you stay within rate limits. Our API allows you to generate multiple keys, each with its own 300 requests per minute limit. By rotating keys, you can distribute the load across multiple keys, effectively increasing your total throughput. This strategy is particularly useful for high-volume applications that need to maintain consistent performance.

When implementing key rotation, it is important to track which key is being used and how many requests it has made. You can use a simple counter to monitor each key's usage. When a key approaches its limit, you can switch to another key. This approach ensures that no single key is overwhelmed, reducing the risk of 429 errors. It is also useful to randomize the order of key selection to avoid predictable patterns.

Key rotation can also help you manage mid-stream interruptions. If a key hits a rate limit mid-stream, you can switch to another key and continue the response. This requires your client to handle stream resumption, which can be complex. However, it allows you to maintain a continuous flow of text even when individual keys are rate-limited. By combining key rotation with effective retry logic, you can build a highly resilient application.

It is also important to monitor the health of each key. If a key consistently returns errors, you may need to investigate the issue. This could be due to invalid keys, insufficient credit, or other problems. By tracking key performance, you can identify and resolve issues before they impact your application. Regular monitoring helps ensure that your key rotation strategy remains effective over time.

When Our API Is Not the Right Choice

While our uncensored Ollama API is excellent for text-based tasks, it may not be the right choice for all use cases. Our service serves a single uncensored open-weight text model, providing text in and text out. It does not support embeddings, image generation, audio, video, OCR, or fine-tuning. If your application requires these capabilities, our API may not meet your needs.

For example, if you need to generate images or process audio, you should look for a service that offers those specific features. Our API focuses on text generation, so it is ideal for chatbots, content creation, and data analysis. However, it is not designed for multimedia tasks. If you need to embed text for search or recommendation systems, our API does not provide embedding endpoints.

Additionally, our API does not offer fine-tuning capabilities. If you need to train a model on custom data, you should consider a service that supports fine-tuning. Our API allows you to use the model as-is, with parameters like temperature and top_p to control generation. But it does not allow you to modify the model's weights or train it on new data.

Finally, if you need model routing or multiple model support, our API may not be suitable. We serve a single model, identified by the ID 'uncensored'. If you need to switch between different models or use a routing service to select the best model for each request, you should look for a service that offers those features. Our API is designed for simplicity and consistency, focusing on providing a reliable text generation service.

Addressing Common Developer Questions

Developers often ask how our API handles rate limits during streaming requests. The answer is that the API returns a 429 error if the rate limit is exceeded, which can interrupt the stream. Clients should implement retry logic to handle these interruptions. Some developers also ask about the difference between streaming and non-streaming responses. Streaming responses send data in chunks, while non-streaming responses wait for the full completion. Both modes are supported, and the choice depends on your application's needs.

Another common question is how to manage multiple keys. Our API allows you to generate multiple keys, each with its own rate limit. By rotating keys, you can distribute the load and stay within limits. Developers also ask about the trial credit. Every new account gets $0.50 of trial credit, which can be used to test the API without paying. This trial credit is a good way to evaluate the service before committing to a purchase.

Users also inquire about the payment methods. Our API accepts only crypto payments, specifically USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. There is no card or PayPal option. This crypto-only approach allows for fast and borderless transactions. Developers appreciate the simplicity of the payment process, especially for international users.

Finally, developers often ask about the context window. Our API supports a context window of 100,000 tokens, which includes both the prompt and the completion. This large context window allows for long conversations and complex tasks. It is important to manage the context size to avoid exceeding the limit. By understanding these common questions, you can better utilize our API and build more effective applications.

Best Practices for High-Throughput Agents

For developers building high-throughput agents, there are several best practices to ensure smooth operation with our uncensored Ollama API. First, always implement retry logic with exponential backoff to handle 429 errors gracefully. This prevents overwhelming the server and reduces the likelihood of consecutive failures. Second, monitor your request frequency and key usage to stay within the 300 requests per minute limit. This proactive approach helps you avoid rate limit issues before they occur.

Third, consider using key rotation to distribute the load across multiple keys. This strategy allows you to increase your total throughput while staying within individual key limits. Fourth, handle mid-stream interruptions by implementing logic to detect and retry truncated streams. This ensures that your clients receive complete responses even when rate limits are hit. Fifth, log errors and usage patterns to identify issues and optimize your application.

Finally, keep your clients updated with the latest API documentation. Our API supports streaming, function calling, JSON mode, and various parameters. By using these features, you can build more sophisticated and responsive applications. Always check the API documentation for current prices, limits, and features, as they may change. By following these best practices, you can build reliable and reliable applications that make the most of our uncensored Ollama API.

Frequently asked questions

What happens if I hit the rate limit during a streaming request?

If you hit the rate limit during a streaming request, the API returns a 429 error, which can interrupt the stream. Your client should implement retry logic to handle this interruption and ensure the user receives a complete response.

Can I use multiple API keys to increase my throughput?

Yes, you can generate multiple API keys, each with its own 300 requests per minute limit. By rotating keys, you can distribute the load and effectively increase your total throughput while staying within the limits of each key.

Does the API support image or audio generation?

No, the API serves a single uncensored open-weight text model. It does not support image, audio, video, or embedding generation. It is designed specifically for text-in, text-out tasks.

How do I top up my credit?

You can top up your credit using crypto only. The API accepts USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. There is no option for card or PayPal payments.