EN ▾
Start now

Troubleshooting Heretic AI API: Safety and Limits

Integrating an uncensored model requires careful handling of safety filters and error states. This guide covers common integration challenges, from rate limiting to content refusal, ensuring your application runs smoothly.

Server rack with glowing blue lights representing an AI API endpoint

Understanding Uncensored Outputs and Safety

When you send requests to our API, the model does not refuse lawful adult, fictional, security-research, or controversial topics. This means the output is uncensored, but it also means you must decide how to handle potentially sensitive content in your application. The only hard limit is that sexual content involving minors is refused. If your application requires stricter safety filters, you should implement your own safety layer on top of the raw output.

Developers often ask how to manage these outputs when building customer-facing applications. Since the model does not refuse based on general controversy, you might need to add post-processing steps to filter specific keywords or topics. This gives you full control over what your users see, rather than relying on the model's internal judgment.

It is important to note that uncensored does not mean unlimited. The model still adheres to the hard content limit regarding minors. If you send a request that violates this rule, the API will refuse it. For all other topics, the model will generate a response. This flexibility is useful for creative writing, role-playing, or research applications where traditional filters might be too restrictive.

When integrating this API, consider the context of your users. If they are expecting a strict safety filter, you might need to adjust your UI to indicate that the content is uncensored. This transparency helps manage user expectations and reduces support tickets related to unexpected outputs. Always test your integration with a variety of prompts to see how the model handles different types of content.

Managing Rate Limits and Request Frequency

Our API allows 300 requests per minute per key. This limit is designed to ensure fair usage and maintain service stability. If you exceed this limit, you will receive a 429 status code. It is important to handle this error gracefully in your application by implementing a retry mechanism with exponential backoff. This prevents your application from overwhelming the API and ensures a smooth user experience.

Developers often inquire about how to handle rate limits when building high-throughput applications. The key is to monitor your request frequency and adjust it based on the 429 responses you receive. You can also use the streaming feature to process responses in real-time, which can help manage the flow of data and reduce the perception of latency.

If you are building a application that requires a high volume of requests, consider implementing a queue system. This allows you to batch requests and process them in a controlled manner. You can also use the seed parameter to ensure reproducibility in your tests, which is useful for debugging and validating your integration.

Remember that the rate limit is per key, so if you have multiple keys, you can distribute the load across them. However, keep in mind that each key has its own limit. This flexibility allows you to scale your application as needed, but it also requires careful management of your API keys and request distribution.

Troubleshooting Common API Errors

When integrating with our API, you may encounter several common errors. The 401 error indicates an invalid key, which means you should verify that you are using the correct API key. The 402 error indicates no credit, which means you need to top up your account. The 429 error indicates a rate limit, which means you should slow down your request frequency.

It is important to handle these errors gracefully in your application. For the 401 error, you might want to prompt the user to re-enter their API key or check their account settings. For the 402 error, you can direct the user to the top-up page to add more credit. For the 429 error, you can implement a retry mechanism with exponential backoff.

Developers often ask how to debug these errors effectively. One useful approach is to log the status code and the request details. This allows you to identify patterns and troubleshoot issues more efficiently. You can also use the streaming feature to see where the response is failing, which can help pinpoint the source of the error.

Another common issue is handling errors during streaming. Since usage is reported in the last chunk, you might need to wait for the entire response before processing the error. This can be challenging, but it ensures that you have all the information needed to handle the error correctly. Always test your error handling logic with a variety of scenarios to ensure robustness.

Handling Crypto Payments and Credit Top-ups

Our API uses a prepaid credit system charged by real token usage. You can top up your account with crypto only, specifically 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, which ranges from +5% to +15%. This system ensures that you only pay for what you use, with no monthly fees or subscriptions.

Developers often inquire about the process for topping up their credit. The process is straightforward: you send the desired amount of crypto to the provided address, and the credit is added to your account. It is important to note that the top-up amount must be a whole number between $20 and $500. This ensures that the transaction is processed efficiently and accurately.

If you are building an application that requires automatic top-ups, you might need to integrate with a crypto payment gateway. This allows you to automate the process and ensure that your users always have sufficient credit. However, keep in mind that the top-up process is manual, so you might need to implement a check for credit balance before each request.

Remember that errors and refusals are free, so you only pay for successful completions. This can help you manage your budget more effectively, as you are not charged for failed requests. Always monitor your credit balance and top up as needed to ensure uninterrupted service.

When Our API Is Not the Right Choice

While our API is powerful for text generation, it is not the right choice for every use case. If you need embeddings, image generation, audio, video, OCR, or fine-tuning, our API does not support these features. It is a text-in, text-out API that serves one uncensored open-weight text model. If your application requires multi-modal capabilities, you might need to consider other options.

Developers often ask if our API can handle complex tasks like image recognition or audio transcription. The answer is no, as our API is focused on text generation. If you need these features, you might need to use a different API or combine our API with other tools. This is an important consideration when designing your application architecture.

Another limitation is the context window, which is 100,000 tokens. If your application requires a larger context window, you might need to consider other options. However, for most text generation tasks, this limit is sufficient. It is important to understand the limitations of our API and design your application accordingly.

Finally, if you need a hosted solution with SLA guarantees or certifications like SOC2 or HIPAA, our API might not be the right choice. We do not claim these features, so if they are critical for your application, you might need to consider other providers. Always evaluate your specific needs before choosing an API provider.

Integrating Streaming and Function Calling

Our API supports streaming over SSE, which allows you to process responses in real-time. This is useful for applications that require immediate feedback, such as chatbots or interactive games. The usage information is reported in the last chunk, so you need to wait for the entire response before processing the usage data. This ensures that you have all the information needed to handle the response correctly.

Function calling is another powerful feature of our API. You can define tools and functions that the model can call, allowing for more complex interactions. This is useful for applications that require the model to perform specific actions, such as querying a database or sending an email. You can also use JSON mode to ensure that the output is in a specific format, which makes it easier to parse and process.

Developers often ask how to implement function calling effectively. The key is to define the tools and functions clearly and provide the model with the necessary context. You can also use the temperature and top_p parameters to control the creativity and diversity of the output. This allows you to fine-tune the model's behavior to suit your specific needs.

Remember to test your integration thoroughly to ensure that the streaming and function calling features work as expected. You can use the seed parameter to ensure reproducibility in your tests, which is useful for debugging and validating your integration. Always monitor the performance of your application to ensure that it meets your requirements.

Best Practices for Integration and Testing

When integrating with our API, it is important to follow best practices to ensure a smooth experience. First, always verify your API key and credit balance before making requests. This helps prevent errors and ensures that your application runs smoothly. You can also use the streaming feature to process responses in real-time, which can help manage the flow of data and reduce latency.

Second, implement error handling for common errors like 401, 402, and 429. This ensures that your application can recover from errors and continue functioning. You can also use the seed parameter to ensure reproducibility in your tests, which is useful for debugging and validating your integration. Always test your integration with a variety of prompts to see how the model handles different types of content.

Third, monitor your request frequency and adjust it based on the rate limit. This helps prevent exceeding the limit and receiving 429 errors. You can also use the top-up feature to add more credit as needed, ensuring that your application always has sufficient resources. Remember that errors and refusals are free, so you only pay for successful completions.

Finally, consider the safety and content limits of the model. Since the model is uncensored, you might need to implement your own safety layer to filter specific keywords or topics. This ensures that your application meets your specific requirements and provides a good user experience. Always test your integration thoroughly to ensure that it meets your needs.

Frequently asked questions

What is the context window size?

The context window is 100,000 tokens, which includes both the prompt and the completion. This allows for long conversations and large inputs.

How do I top up my credit?

You can top up your credit with USDT on TRC20 or USDC on Base. The minimum amount is $20 and the maximum is $500. Bonus credit is available for top-ups of $50 or more.

Does the API support image generation?

No, the API is text-only. It does not support image, audio, video, or OCR generation. It serves one uncensored open-weight text model.

What happens if I exceed the rate limit?

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