Integrating Uncensored AI Text API: SDK Setup & Checklist
Connecting to an uncensored text API requires precise configuration to ensure smooth communication between your application and the model. This guide walks you through the essential steps for SDK setup, header management, and response handling, focusing on the specific capabilities of our text-in, text-out service.

Understanding the API Structure
The foundation of any integration lies in understanding the specific structure of the API you are connecting to. Our service provides a hosted, OpenAI-compatible chat-completions endpoint that serves a single uncensored open-weight text model. The model identifier you must send in your requests is simply "uncensored". This simplicity reduces the complexity of model routing, as there is only one model to manage. You do not need to worry about selecting different versions or variants; the API routes all requests to this single, consistent model.
The base URL for all interactions is https://api.unsensoredai.com/v1. This is the only base URL you need to configure in your SDK settings. All subsequent endpoints are relative to this base. The API supports three main endpoints: POST /v1/chat/completions for standard chat interactions, POST /v1/responses for a different response format, and GET /v1/models to verify available models. Keeping these endpoints in mind ensures that your application sends requests to the correct location.
It is important to note that this service is strictly for text processing. It does not support embeddings, image generation, audio processing, video generation, OCR, fine-tuning, or model routing. If your application requires any of these capabilities, you will need to integrate additional services or tools alongside this text API. The API is designed for text in and text out, making it ideal for applications that focus on conversational AI, content generation, or data processing without multimedia needs.
Understanding the scope of the API helps in setting realistic expectations for your integration. By focusing on text-only capabilities, the service maintains a straightforward structure that is easy to integrate. Developers can rely on the consistent behavior of the single model, knowing that the API will handle the text processing efficiently. This clarity allows for more predictable error handling and response parsing in your application.
SDK Initialization and Authentication
Initializing the SDK is the first practical step in your integration process. The API supports standard authentication methods, requiring an API key for access. You can sign up for an account using Google or by providing an email and password. Upon signup, your API key is shown immediately, allowing you to begin configuration without delay. This key is essential for authenticating your requests and ensuring that your usage is tracked correctly against your prepaid credit.
When initializing the SDK, you need to set the API key in the authorization header. This header authenticates your requests and ensures that the API recognizes your account. The SDK documentation for your preferred language will guide you on how to set this header correctly. It is important to keep your API key secure and avoid exposing it in public repositories or client-side code. Treat your API key like a password, as it provides access to your account and credits.
The API enforces a rate limit of 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 error. Understanding this limit helps in designing your application to handle rate limiting gracefully, perhaps by implementing exponential backoff strategies. This ensures that your application does not overwhelm the API during peak usage periods.
Errors are also handled through specific HTTP status codes. A 401 error indicates an invalid key, while a 402 error signifies that you have no credit remaining. These errors provide clear feedback on the status of your requests. By handling these errors appropriately, you can ensure that your application continues to function smoothly even when issues arise. This reliable error handling is a key component of a reliable integration.
Configuring Parameters and Modes
The API supports a range of parameters that allow you to fine-tune the behavior of the model. You can control the randomness of the output using the temperature parameter, which influences how creative or deterministic the responses are. The top_p parameter allows you to control the diversity of the output by filtering tokens based on their cumulative probability. These parameters give you precise control over the generation process, enabling you to tailor the output to your specific needs.
Additionally, you can use the stop parameter to define sequences that signal the end of a response. This is useful for controlling the length of the output or for stopping generation at specific points. The seed parameter allows you to set a starting point for the random number generator, enabling reproducible results. This is particularly useful for testing and debugging, as it allows you to generate the same output multiple times.
The API also supports penalties, which allow you to adjust the frequency of certain tokens in the output. This can be useful for avoiding repetitive phrases or for emphasizing specific topics. By configuring these parameters, you can optimize the API for your specific use case, whether it be creative writing, data extraction, or conversational AI. The flexibility of these parameters makes the API suitable for a wide range of applications.
Streaming is supported over Server-Sent Events (SSE), allowing you to receive responses in real-time. This is particularly useful for applications that require immediate feedback, such as chat interfaces. The usage information is included in the last chunk of the stream, providing you with the token counts for the request. This real-time feedback enhances the user experience by providing immediate responses and keeping the user engaged.
Handling Responses and Errors
Handling responses correctly is important for a smooth integration. The API returns standard JSON responses that include the generated text, along with metadata such as token counts and usage information. Parsing these responses requires understanding the structure of the JSON object returned by the API. Most SDKs provide utilities for parsing JSON, which simplifies this process. Ensure that your application handles both successful responses and errors appropriately.
Errors are returned as HTTP status codes, as mentioned earlier. A 401 error indicates an invalid key, while a 402 error signifies that you have no credit remaining. A 429 error indicates that you have exceeded the rate limit. By handling these errors gracefully, you can ensure that your application continues to function smoothly even when issues arise. Implementing retry logic with exponential backoff can help manage rate limiting effectively.
It is also important to handle the case where the API refuses a request due to the hard content limit. The API refuses requests involving sexual content with minors, but otherwise allows a wide range of topics. This refusal is handled by the API, and you will receive a response indicating that the request was refused. Understanding this limit helps in designing your application to handle these refusals appropriately, perhaps by informing the user or adjusting the input.
Function calling is supported, allowing you to define tools that the model can use. This is useful for applications that require the model to interact with external systems or perform specific actions. The API supports the standard function calling format, making it easy to integrate with existing tools. By using function calling, you can extend the capabilities of the model and create more interactive and dynamic applications.
Managing Credits and Payments
Understanding the pricing and payment structure is essential for managing your integration. The API uses a prepaid credit system, where you pay $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. This pricing model is straightforward and allows you to pay only for what you use. There are no monthly fees or subscriptions, and your prepaid credit never expires. This flexibility makes it easy to manage your budget and scale your usage as needed.
Top-ups are available in cryptocurrency only, specifically USDT on the TRC20 network or USDC on the Base network. You can top up any whole amount from $20 to $500. Additionally, there is a bonus credit system for top-ups of $50 or more, ranging from +5% to +15%. This bonus credit provides additional value for larger top-ups. The API does not accept credit cards, PayPal, or bank transfers, so ensure that you have a crypto wallet ready for transactions.
New accounts receive $0.50 of trial credit, allowing you to test the API without immediate payment. This trial credit is a great way to explore the API and determine if it meets your needs. Errors and refusals are free, meaning that you are not charged for failed requests or requests that are refused due to content limits. This can help reduce costs, especially during the testing phase.
Monitoring your credit balance is important to ensure that your application continues to function. The API provides endpoints to check your balance and usage. By keeping track of your credit, you can avoid unexpected service interruptions. Implementing alerts for low balance can help you top up in advance, ensuring a smooth experience for your users.
When This API Is Not the Right Choice
While the API is powerful for text processing, it may not be the right choice for all applications. If your application requires image generation, audio processing, or video generation, this text-only API will not suffice. You will need to integrate additional services or tools to handle these multimedia capabilities. The API is designed specifically for text in and text out, so it lacks the functionality for other media types.
Similarly, if you need embeddings for semantic search or vector databases, this API does not provide that capability. You will need to use a separate embedding service to generate embeddings from the text outputs of this API. The same applies to OCR, fine-tuning, and model routing. If your application relies on any of these features, you will need to incorporate additional tools to meet your needs.
Additionally, if you require a specific model other than the uncensored open-weight model provided, this API may not be suitable. The API serves only one model, so if you need access to multiple models or specific model variants, you will need to look elsewhere. The simplicity of the single-model approach is a strength for text processing but a limitation for applications requiring model diversity.
Finally, if you need real-time audio or video streaming, this API will not support that directly. It is focused on text responses, so any multimedia streaming would need to be handled by other services. By understanding these limitations, you can determine if this API is the right fit for your project or if you need a more comprehensive solution.
Addressing Common Developer Questions
Developers often ask about the privacy and functionality of uncensored AI assistants. In discussions on platforms like r/AIToolsAndTips, users frequently mention the desire for an assistant that avoids pre-packaged lectures and offers a more direct interaction. This API meets that need by providing an uncensored model that does not refuse lawful adult, fictional, or controversial topics. The focus is on delivering text responses without the usual constraints, making it ideal for developers building custom AI experiences.
Another common question relates to the availability of free options. While the API offers a trial credit of $0.50, it is not entirely free for ongoing use. Users on r/AIJailbreak often seek out free uncensored AI tools, and this API provides a paid alternative with a prepaid credit system. The trial credit allows users to test the service before committing to a purchase, which is a valuable feature for developers evaluating different solutions.
Developers also inquire about the ease of integration and the support for standard APIs. The OpenAI-compatible format of this API makes it easy to integrate with existing tools and libraries. Users on r/AIToolBench appreciate the straightforward setup and the ability to use standard parameters. This compatibility reduces the learning curve and allows developers to use their existing knowledge of API integrations.
Finally, there is interest in the ability to create custom characters and scenarios. Users on r/CharacterAIrevolution often look for ways to build personalized AI characters. While this API does not offer built-in character creation, it provides the text foundation for developers to build their own character systems. By integrating this API with custom logic, developers can create unique and engaging AI experiences tailored to their users.
Frequently asked questions
How do I get an API key?
You can sign up using Google or email and password. Your API key is shown immediately after signup, allowing you to start using the service right away.
What happens if I run out of credit?
You will receive a 402 error. You can top up your credit using USDT on TRC20 or USDC on Base, with amounts ranging from $20 to $500.
Does the API support image generation?
No, the API is text-only. It does not support image, audio, or video generation. You will need to use other tools for those capabilities.
Is there a free tier?
New accounts receive $0.50 of trial credit. There is no free unlimited tier, but errors and refusals do not consume credit.