EN ▾
Uncensored LLM API, zero refusals.
Claim trial key

Integrating Uncensored LLM APIs via SDK

Developers often seek uncensored text APIs to avoid excessive moderation in their applications. This guide outlines the specific SDK settings and integration steps needed for reliable connectivity with an open-weight model.

Developer desk with laptop and code, representing API integration

Understanding the API Endpoint Structure

When integrating an uncensored language model API, the first step is understanding the endpoint structure. Our service provides a hosted API that mimics the standard chat-completions interface used by major providers. This allows developers to swap in the API with minimal code changes. The base URL for all requests is https://api.aiunjailed.com/v1. You will interact primarily with the POST /v1/chat/completions endpoint for standard text interactions.

The API is designed to be straightforward. It accepts text input and returns text output. There are no complex routing layers or hidden middleware. You send a request with your model ID, which is simply "uncensored", and the system processes it. The model ID is fixed, so you do not need to manage model versions or switch between different model IDs for different tasks. This simplifies the integration process significantly.

It is important to note that this service focuses solely on text generation. It does not support embeddings, image generation, audio processing, or video creation. If your application requires multimodal capabilities, you may need to combine this text API with other tools. However, for pure text-based applications, this API provides a direct and efficient path to uncensored outputs. The simplicity of the endpoint structure reduces the likelihood of integration errors.

Developers should also be aware of the GET /v1/models endpoint. This allows you to verify the available models and their configurations. While the model ID is fixed, checking the models endpoint can help you stay updated on any structural changes to the API. It is a good practice to include this check in your initialization routine to ensure compatibility with the current API version.

Configuring SDK Settings for Streaming

Streaming responses are a critical feature for many applications, especially those that require real-time user feedback. Our API supports streaming over Server-Sent Events (SSE). This allows you to receive tokens as they are generated, rather than waiting for the entire response to complete. To enable streaming, you must set the stream parameter to true in your request payload. The SDK will then emit chunks of data as they become available.

One important detail to remember is that the usage information, such as token counts, is included in the last chunk of the stream. This means you need to parse the final chunk to get the total input and output token counts. This is useful for tracking your credit usage and ensuring you stay within your budget. The SDK handles the parsing of these chunks, but you must be prepared to handle the final chunk appropriately.

Streaming can improve the user experience by reducing perceived latency. Users see the text appearing character by character, which makes the interaction feel more responsive. However, it also increases the complexity of your code slightly, as you need to handle partial responses and potential stream interruptions. It is advisable to implement error handling for stream disconnections to ensure a smooth experience.

For applications that do not require real-time feedback, you can disable streaming by setting the stream parameter to false. This will return the complete response in a single chunk. This can be simpler to implement and is suitable for background tasks or batch processing. The choice between streaming and non-streaming depends on your specific use case and user experience goals.

Managing Tokens and Context Windows

The context window for this API is 100,000 tokens, which includes both the prompt and the completion. This is a generous limit that allows for extensive conversations and large documents. However, it is important to manage your tokens carefully to avoid exceeding this limit. If you send a prompt that is too large, the API may truncate the input or return an error.

Token management is important for controlling costs. The API charges $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. By monitoring your token usage, you can estimate your costs accurately. The SDK provides tools to count tokens in your prompts and responses. You can use these tools to optimize your prompts and reduce unnecessary token consumption.

It is also important to note that errors and refusals are free. This means that if your request fails due to a rate limit or an invalid key, you are not charged for the tokens. This can save you money if you are experimenting with different prompts or testing your integration. However, if the model refuses to answer due to content filters, you are still charged for the tokens used in that request.

To stay within your context window, you may need to implement a sliding window approach for long conversations. This involves keeping only the most recent messages in the context and discarding older ones. This ensures that you do not exceed the token limit while maintaining the relevance of the conversation. The API does not automatically manage this for you, so it is up to you to implement this logic in your application.

Handling Authentication and Rate Limits

Authentication is handled via API keys. When you sign up, you receive a key immediately, which you can use to authenticate your requests. The key is shown on the dashboard after you create an account. You can continue with Google or use an email and password to sign up. The key is unique to your account and should be kept secure.

Rate limits are enforced at 300 requests per minute per key. If you exceed this limit, you will receive a 429 error. This is important to consider if you are building a high-traffic application. You may need to implement rate limiting in your own code to prevent hitting the API limit. This can be done by tracking the number of requests sent in a given time window and pausing new requests if the limit is approaching.

Other common errors include 401 for invalid keys and 402 for insufficient credit. It is important to handle these errors gracefully in your application. A 401 error indicates that your key is invalid or expired, while a 402 error means you need to top up your credit. By handling these errors appropriately, you can provide a better user experience and avoid unexpected failures.

It is also worth noting that the API does not support multiple keys per account. Each account has a single key, which is used for all requests. This simplifies the authentication process but means that you need to be careful with key management. If you lose your key, you may need to generate a new one, which could disrupt your service.

Payment Methods and Credit Management

Credit management is straightforward with this API. You can top up your account using cryptocurrency. The supported currencies are USDT on the TRC20 network and USDC on the Base network. You can top up with any whole amount between $20 and $500. There are no minimum or maximum limits beyond this range, and you can top up as often as you like.

One benefit of topping up is that you may receive bonus credit. If you top up with $50 or more, you receive a bonus ranging from 5% to 15%. This bonus is added to your account and can be used for future requests. It is a good way to get more value for your money, especially if you are a heavy user of the API.

It is important to note that credit never expires. You can top up your account and use the credit at any time in the future. This is useful if you are building an application that may have variable usage patterns. You can top up during low-usage periods and use the credit during high-usage periods without worrying about expiration.

Payments are processed immediately, and the credit is added to your account right away. This allows you to start using the API immediately after topping up. There are no monthly fees or subscriptions, so you only pay for what you use. This pay-as-you-go model is ideal for developers who want to control their costs and avoid recurring charges.

When This API Is Not the Right Choice

While this API is excellent for uncensored text generation, it may not be the right choice for every developer. If you need multimodal capabilities, such as image or video generation, this API alone will not suffice. You would need to combine it with other services to achieve those results. The API focuses solely on text, so any requirement for visual or audio output must be handled separately.

Another consideration is the lack of fine-tuning capabilities. If you need to train the model on your specific data, this API does not support fine-tuning. You would need to use a different service that offers fine-tuning options. The API provides access to a pre-trained model, but you cannot modify the model's weights or behavior through fine-tuning.

Additionally, if you require high availability guarantees or specific certifications, this API may not meet your needs. The service does not offer SLA percentages or certifications like SOC2 or HIPAA. If your application requires these guarantees for compliance reasons, you may need to choose a different provider. The API is designed for flexibility and uncensored output, not for enterprise-grade reliability.

Finally, if you need a free unlimited tier, this API may not be suitable. The service offers a small trial credit, but ongoing usage requires payment. If you are looking for a completely free solution, you may need to explore other options. The API is designed for developers who are willing to pay for uncensored output, so it may not be the best fit for those seeking a free alternative.

Addressing Common Developer Concerns

Developers often ask about the best uncensored models available. In discussions on Reddit, users frequently compare various models like Qwen and Gemma. Many developers are looking for models that are genuinely unrestricted and free from alignment-based filtering. The key takeaway is that while many models claim to be uncensored, the quality and reliability can vary. It is important to test different models to find the one that best fits your needs.

Another common concern is the issue of moderation. Many developers find that online providers like ChatGPT or Gemini are overly moderating, which can lead to frustrating user experiences. The goal of using an uncensored API is to avoid these issues and provide a more natural conversation. By using an API that does not impose artificial filters, you can create a more authentic interaction with your users.

Hardware requirements are also a topic of discussion. Some developers prefer to run models locally to have full control over the output. However, running large models locally can be resource-intensive. Using a hosted API like this one allows you to offload the computational burden to the server, which can be a significant advantage for developers with limited hardware resources.

Finally, developers often ask about the ease of integration. The API is designed to be easy to integrate, with a simple endpoint structure and clear documentation. By following the SDK settings and best practices outlined in this guide, you can ensure a smooth integration process. The API supports standard features like function calling and JSON mode, which make it compatible with many existing applications.

Frequently asked questions

How do I top up my credit?

You can top up your credit using USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. You can top up with any whole amount within this range.

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 rate limiting in your own code to prevent hitting the API limit and ensure a smooth experience.

Does the credit expire?

No, the credit never expires. You can top up your account and use the credit at any time in the future. This is useful for applications with variable usage patterns.

Can I use the API for image generation?

No, the API focuses solely on text generation. It does not support image, audio, or video generation. If you need multimodal capabilities, you may need to combine this API with other services.