EN ▾

Uncensored text API for NSFW pipelines

https://api.nsfwflux.cc/v1uncensored

Get API key

Troubleshooting Uncensored Chat API: Safety and Risk Management

Developers often worry about content filters and API stability when handling uncensored text outputs. This guide addresses common risks, such as unexpected filtering or rate limits, and offers practical troubleshooting steps to ensure your chat application remains stable and safe for end-users.

Neon server rack representing API data flow and connectivity

Understanding Content Refusals and Hard Limits

When building an uncensored chat API, the most common surprise is not that the model generates wild content, but that it refuses specific types of it. Our API serves one uncensored open-weight text model, identified by the model id "uncensored". This model does not refuse lawful adult, fictional, security-research, or controversial topics. However, there is a hard content limit: no sexual content involving minors. Requests violating this rule are refused immediately.

This refusal is not a bug but a feature designed to keep the service usable for a broad audience. If your application sends a prompt that triggers this hard limit, the API will return a refusal response. It is important to design your frontend to handle these refusals gracefully. Users should see a clear message that the content was filtered, rather than a generic error.

Developers often test their applications with edge-case prompts to ensure stability. When testing, include prompts that might touch on the boundary of the hard limit. This helps you verify that your error handling logic works correctly. Remember that the model is uncensored for adult content, so you do not need to worry about standard moral filters blocking typical NSFW topics.

To troubleshoot refusal issues, check your prompt for keywords or scenarios involving minors. If the refusal is unexpected, review the prompt structure. Ensure that the context window is not filled with irrelevant data that might confuse the model about the subject's age. Keeping your prompts clear and focused helps minimize unnecessary refusals.

Managing Rate Limits and Request Frequency

Rate limits are a critical part of any API integration. Our API allows 300 requests per minute per key. If you exceed this limit, you will receive a 429 error. This limit is per key, so if you generate multiple keys, each key has its own 300 requests per minute allowance. This structure allows you to scale your application by distributing requests across multiple keys.

To avoid hitting the rate limit, monitor your request frequency. If you are processing a large batch of prompts, consider staggering your requests. You can also implement a retry logic with exponential backoff. This means that if you receive a 429 error, you wait a short period before retrying, and then wait longer for subsequent retries. This prevents overwhelming the API during peak usage.

It is also important to note that the rate limit applies to all requests, including those that result in errors or refusals. Every call to the API counts towards your limit. Therefore, efficient prompt design and error handling can help you stay within your limit. Avoid sending redundant or duplicate requests unless necessary.

If you find that 300 requests per minute is too low for your use case, consider using multiple API keys. You can generate new keys by signing up with Google or email and password. Each key provides an independent 300 requests per minute limit. This strategy allows you to handle higher volumes of traffic without hitting the rate limit.

Handling Authentication and Credit Errors

Authentication errors are common when integrating with any API. Our API uses a simple key-based authentication system. If you send a request with an invalid or missing key, you will receive a 401 error. This error indicates that the key is invalid or has been revoked. Check your key to ensure it is correct and has not been accidentally deleted or modified.

Another common error is the 402 error, which indicates that you have no credit. Our API charges for real token usage, with errors and refusals being free. If you run out of credit, you will receive a 402 error. To resolve this, you need to top up your credit. Top-ups are available in crypto only, specifically USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500.

When troubleshooting 401 or 402 errors, first verify your API key and check your account balance. If the key is valid and you have credit, ensure that your application is sending the key in the correct header. Incorrect header formats can also lead to authentication failures. Review your integration code to ensure the key is passed correctly.

It is also good practice to implement error handling for these specific codes. When you receive a 401 error, you might want to prompt the user to re-authenticate or check their key. For a 402 error, you can display a message indicating that credit is needed and provide a link to the top-up page. This improves the user experience by providing clear guidance on how to resolve the issue.

Optimizing Token Usage and Costs

Understanding token usage is essential for managing costs with our API. The pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. Your context window is 100,000 tokens, which includes both the prompt and the completion. This means that long prompts can consume a significant portion of your context window, potentially leading to higher costs if not managed properly.

To optimize costs, monitor your token usage closely. You can use the streaming feature to receive usage information in the last chunk of the response. This allows you to track token consumption in real-time. By monitoring usage, you can identify patterns that lead to high token counts and adjust your prompts accordingly.

Another way to manage costs is to use the JSON mode. This mode ensures that the output is structured in a specific format, which can reduce the need for post-processing. It also helps in maintaining consistency in the output, which can be beneficial for applications that require structured data. Additionally, using the seed parameter can help in generating consistent responses, which might reduce the need for multiple attempts.

It is also important to note that errors and refusals are free. This means that if a request fails or is refused, you do not pay for the tokens. This can be a significant cost saver, especially if you are testing different prompts or parameters. Make sure to handle errors efficiently to avoid unnecessary token consumption.

When Our API Is Not the Right Choice

While our uncensored chat API is powerful for text generation, it may not be the right choice for every project. Our API serves only one uncensored open-weight text model. It does not support embeddings, image generation, audio or video generation, OCR, or fine-tuning. If your application requires any of these features, our API might not be sufficient.

For example, if you need to generate images or videos, you would need a different API that supports these modalities. Similarly, if you need to perform OCR on images, our API cannot handle that. In such cases, you might need to integrate multiple APIs to achieve your desired functionality. Our API can be used for the text steps around these other capabilities.

Another consideration is the context window. Our API has a 100,000 token context window. If your application requires a larger context window, you might need to look for other options. Additionally, if you need model routing or multiple models to choose from, our API only serves one model. This limits your ability to experiment with different models for different tasks.

Finally, if you need advanced features like function calling with complex tools or specific JSON mode variations, ensure that our API supports the specific features you need. Our API supports function calling and JSON mode, but the implementation might differ from other APIs. Always check the documentation to ensure compatibility with your specific requirements.

Addressing Community Concerns on Reddit

Developers often discuss concerns about uncensored chat APIs on Reddit. Threads on r/JanitorAI_Refuges and other communities highlight issues such as proxies, tax implications, and the stability of free or low-cost alternatives. Users frequently ask about the reliability of these services and how to manage risks associated with them.

One common concern is the use of proxies to bypass restrictions or access the API from different regions. While our API does not explicitly mention proxy usage, it is a common practice in the community. Users should be aware that using proxies might affect the stability of their connections. It is important to test your application with and without proxies to ensure consistent performance.

Another topic of discussion is the financial aspect of using these APIs. Users often compare the costs of different services and discuss the value they provide. Our API offers prepaid credit with no monthly fee, which can be a cost-effective solution for many developers. However, users should always check the current prices and limits on the vendor's documentation to stay informed about any changes.

Additionally, users discuss the importance of safety and risk management. They share tips on how to handle content filters and rate limits. By reading these threads, developers can gain insights into common pitfalls and best practices. It is valuable to stay engaged with the community to learn from others' experiences and adapt your application accordingly.

Implementing Reliable Error Handling and Retries

Reliable error handling is important for maintaining a stable chat application. When integrating with our API, you should implement logic to handle common errors such as 401, 402, and 429. These errors indicate issues with authentication, credit, and rate limits, respectively. By handling these errors gracefully, you can prevent your application from crashing or providing a poor user experience.

Implementing retry logic is a best practice for dealing with transient errors. If you receive a 429 error, you can retry the request after a short delay. This helps to avoid overwhelming the API during peak usage. You can also use exponential backoff to increase the delay between retries, which further reduces the load on the API.

It is also important to log errors for debugging purposes. When an error occurs, log the error code, the request details, and the response. This information can be invaluable when troubleshooting issues. By analyzing error logs, you can identify patterns and take proactive steps to prevent future errors.

Finally, consider implementing a fallback mechanism for critical operations. If the API is unavailable or returns an error, you might want to use a cached response or a default message. This ensures that your application continues to function even when the API is down. A well-designed fallback mechanism can significantly improve the reliability of your chat application.

Frequently asked questions

How do I top up my credit?

You can top up your credit using crypto only. We accept USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. You can also receive bonus credit from $50.

What happens if I exceed the rate limit?

If you exceed the rate limit of 300 requests per minute per key, you will receive a 429 error. You should implement retry logic with exponential backoff to handle this error gracefully.

Does the API support image generation?

No, our API serves only one uncensored open-weight text model. It does not support image, audio, or video generation. It is designed for text in and text out operations.

How is pricing calculated?

Pricing is based on token usage. It costs $0.15 per 1M input tokens and $0.50 per 1M output tokens. Errors and refusals are free, so you only pay for successful token usage.