EN ▾
Get API key

Integrating Uncensored Text APIs: A Developer Checklist

Integrating an uncensored text API requires careful attention to authentication, streaming responses, and token management. This checklist guides you through setting up your environment, handling edge cases, and verifying connectivity to ensure a reliable integration.

Developer workspace with streaming text interface and digital tokens

Setting Up Authentication and Base URLs

Before making any requests, you must configure your environment with the correct base URL and authentication credentials. The base URL for this service is https://api.unrestrictedaichat.cc/v1. You will need to include your API key in the Authorization header for every request. If the key is invalid, you will receive a 401 error, indicating that the key is either missing or incorrect. It is important to store your key securely and avoid hardcoding it in your source code if possible.

When you sign up, you can use Google or an email and password combination. The API key is displayed immediately after signup, so make sure to copy it before you leave the page. This key is your primary identifier for billing and rate limiting. Without a valid key, your requests will be rejected, and you will not be able to access the model.

Ensure that your HTTP client is configured to send POST requests to the /v1/chat/completions endpoint. This endpoint accepts JSON payloads containing the message history and parameters. The model ID to send is 'uncensored'. This specific model is uncensored, meaning it does not refuse lawful adult, fictional, security-research, or controversial topics. However, it does refuse requests involving sexual content with minors.

Always test your authentication setup with a simple request before integrating it into your main application. This helps you catch any configuration errors early. If you encounter a 402 error, it means you have no credit left. Since this service uses prepaid credit, you must top up your account to continue using the API. Errors and refusals are free, so you do not lose credit for failed requests.

Handling Streaming Responses and SSE

Streaming responses are essential for a good user experience, especially when generating long texts. This API supports streaming over Server-Sent Events (SSE). When you enable streaming, the response is sent in chunks, allowing you to display text to the user as it is generated. This is particularly useful for chat applications where latency can be a concern.

One important detail to note is that the usage data, including token counts, is included only in the last chunk of the stream. This means you need to handle the final chunk carefully to update your token balance and billing records. If you are using a library that abstracts away the SSE handling, ensure it correctly captures the final event.

To enable streaming, set the stream parameter to true in your request payload. The API will then send a series of events, each containing a partial response. You should concatenate these partial responses to form the complete text. This approach reduces the perceived latency for the user, as they see text appearing in real-time.

When implementing streaming, consider adding a fallback mechanism in case the connection drops. If the stream is interrupted, you may need to retry the request or handle the error gracefully. Also, be aware that the API has a rate limit of 300 requests per minute per key. If you exceed this limit, you will receive a 429 error. Streaming does not bypass this limit, so monitor your request rate carefully.

Managing Token Limits and Context Windows

The context window for this API is 100,000 tokens, which includes both the prompt and the completion. This is a significant limit, allowing for long conversations and detailed inputs. However, it is important to manage your token usage efficiently to avoid hitting this limit unexpectedly. If the total tokens exceed 100,000, the API may refuse the request or truncate the input, depending on the implementation.

To estimate your token usage, you can use the formula: (tokens divided by 1,000,000) times the per-million price. The input tokens cost $0.15 per million, and the output tokens cost $0.50 per million. Keep in mind that these prices are for real token usage, and errors are free. This pricing model encourages efficient token usage, as you only pay for what you consume.

When designing your application, consider implementing a token counter to track usage in real-time. This helps you stay within your budget and avoid unexpected charges. You can also set up alerts to notify you when you are approaching your token limit. This proactive approach ensures that you do not run out of credit unexpectedly.

If you are dealing with very long inputs, you might need to implement a truncation strategy. This involves removing older messages from the conversation history to make room for new ones. However, this can lead to loss of context, so it is important to balance between context retention and token usage. Always test your truncation logic thoroughly to ensure it does not negatively impact the quality of the responses.

Testing Function Calling and JSON Mode

Function calling is a powerful feature that allows the model to generate structured data, such as JSON, which can be used to trigger actions in your application. This API supports function calling, enabling you to define tools that the model can use. When you enable function calling, the model will return a structured response that includes the function name and arguments.

To use function calling, you need to define the functions in your request payload. The model will then decide which function to call based on the input. This is particularly useful for tasks like extracting information from text or triggering specific actions. You can also use JSON mode to force the model to output valid JSON, which simplifies parsing.

When testing function calling, start with simple functions and gradually increase the complexity. This helps you identify any issues with the function definitions or the model's ability to call them correctly. You should also test edge cases, such as when the model needs to call multiple functions or when the function arguments are complex.

Ensure that your application can handle the structured responses correctly. If the model returns invalid JSON, you may need to implement error handling to retry the request or prompt the user for more information. Function calling can significantly enhance the functionality of your application, but it requires careful testing and validation to ensure reliability.

When This API Is Not the Right Choice

While this API is powerful for text generation, it may not be the right choice for every use case. If you need image, audio, or video generation, this service does not support those capabilities. It is a text-only API, so if your application requires multimodal outputs, you will need to look elsewhere.

Similarly, if you need embeddings, OCR, or fine-tuning, this API does not offer those features. It is designed for chat-completions and responses, so if your workflow requires these additional capabilities, you may need to integrate with other services. The API also does not support model routing, meaning you are locked into the 'uncensored' model.

If you are looking for a service with an SLA guarantee or certifications like SOC2 or HIPAA, this API does not provide those. It is an independent service, and while it is reliable, it does not offer the same level of enterprise-grade guarantees as some larger providers. If these are critical for your business, you may want to consider other options.

Finally, if you need to deploy the model on-premises, this API is a hosted service. If you require on-prem deployment for data privacy or other reasons, this API may not fit your needs. It is important to evaluate your specific requirements before integrating this API to ensure it aligns with your application's needs.

Addressing Common Developer Concerns

Developers often ask about the best uncensored models available and how to run them locally. While this API provides a hosted solution, some developers prefer to run models on their own hardware. If you are interested in local deployment, you can run uncensored AI on your PC with at least 8GB of VRAM. This gives you more control over the model and data privacy.

Another common concern is the impact of unrestricted AI on children. Some regions are considering blocking AI tools for users under 16 due to concerns about emotional mimicry and excessive usage. If you are building an application for a younger audience, you may need to implement additional restrictions or monitoring to ensure a safe experience.

Developers also discuss the quality of uncensored models compared to restricted ones. Some users find that uncensored models can be more creative and less restrictive, while others find them less reliable. It is important to test the model with your specific use case to determine if it meets your needs. The 'uncensored' model on this API is designed to handle a wide range of topics without refusing lawful inputs.

Finally, some developers are concerned about the cost of using uncensored APIs. This API offers a prepaid credit system with no monthly fee, which can be cost-effective for many users. The trial credit of $0.50 allows you to test the API without any commitment. If you need more credit, you can top up with crypto, which is the only payment method accepted.

Troubleshooting and Best Practices

When integrating this API, you may encounter various errors. A 401 error indicates an invalid key, so check your authentication header. A 402 error means you have no credit, so you need to top up your account. A 429 error indicates a rate limit, so you may need to slow down your requests. These errors are common, and having a reliable error handling mechanism is essential.

To ensure a smooth integration, follow these best practices. Always use the latest version of the API endpoints. Keep your API key secure and avoid exposing it in your code. Use streaming for better user experience, and monitor your token usage to stay within your budget. Test your integration thoroughly with different inputs and edge cases.

If you encounter issues with function calling, check your function definitions and ensure they are correctly formatted. If the model returns invalid JSON, implement error handling to retry the request. Also, consider using JSON mode to force valid JSON output, which simplifies parsing.

Finally, stay updated with any changes to the API documentation. The API may introduce new features or change existing ones, so it is important to keep your integration up to date. By following these best practices, you can ensure a reliable and efficient integration with the uncensored text API.

Frequently asked questions

How do I top up my credit?

You can top up your credit using crypto only, specifically USDT on TRC20 or USDC on Base. The minimum amount is $20, and the maximum is $500. You can also receive bonus credit if you top up $50 or more.

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 slow down your request rate or implement a retry mechanism with exponential backoff to handle this error gracefully.

Can I use this API for image generation?

No, this API is a text-only service. It does not support image, audio, or video generation. If you need multimodal capabilities, you will need to integrate with other services that offer those features.

Is there a free trial available?

Yes, every new account gets $0.50 of trial credit, and no card is needed. This allows you to test the API without any financial commitment. Errors and refusals are free, so you do not lose credit for failed requests.