EN ▾
Get API key

Integrate Uncensored API with Python SDK

Developers often seek a reliable way to connect an unrestricted chatbot API to their applications for agentic workflows or custom interfaces. This guide outlines the integration steps, SDK configuration, and a tested checklist for smooth text-in, text-out workflows using our hosted service.

Developer workspace with laptop showing code and chat interface, crypto coin symbol, Python logo, dark background with neon accents

Understanding the API Endpoint Structure

Before writing any code, it is essential to understand the base URL and the specific endpoints available for your integration. The service provides a hosted, OpenAI-compatible chat-completions API that serves one uncensored open-weight text model. This model is identified by the string uncensored. The base URL for all requests is https://api.unrestrictedchatbot.com/v1. You will interact primarily with the POST /v1/chat/completions endpoint for standard conversations and the POST /v1/responses endpoint for more structured outputs. Additionally, you can use the GET /v1/models endpoint to verify the available model configuration.

Unlike other providers, this service does not offer embeddings, image generation, audio processing, or video capabilities. The focus is strictly on text input and text output. There is no OCR, fine-tuning, or model routing available. This simplicity means your integration code does not need to handle complex multi-modal data structures. You only need to manage text strings and JSON responses. This reduces the overhead in your Python scripts and makes debugging easier when things go wrong.

The context window for this API is 100,000 tokens, which includes both the prompt and the completion together. This is a generous limit for most applications, allowing you to pass large amounts of context in a single request. However, you must ensure your Python code handles large payloads efficiently. If you are building an agent that iterates through many steps, you should monitor the token count to avoid hitting the limit unexpectedly.

When designing your integration, keep in mind that the API is designed for uncensored content. The model does not refuse lawful adult, fictional, security-research, or controversial topics. This makes it ideal for creative writing, role-playing, or research applications where standard filters might interfere. However, there is a hard content limit regarding sexual content involving minors. Requests containing such content will be refused. Your application should handle these refusals gracefully without crashing.

Setting Up Your Python Environment

To start integrating the API, you need a Python environment with the necessary libraries installed. Since the API is OpenAI-compatible, you can use the official openai Python client or the standard requests library. The requests library is lightweight and sufficient for most use cases, especially if you only need to send simple POST requests. Install it using pip by running pip install requests in your terminal. This ensures you have the core functionality needed to communicate with the API endpoints.

If you prefer a more structured approach, you can install the OpenAI Python client. This library provides a higher-level interface that handles authentication and response parsing automatically. Run pip install openai to install it. This is particularly useful if you want to use features like streaming responses or function calling without writing custom parsing logic. The client supports all the parameters mentioned in the API documentation, including temperature, top_p, and stop sequences.

After installing the libraries, you need to configure your API key. The key is shown immediately after you sign up via Google or email and password. Store this key securely in your environment variables or a configuration file. Never hardcode the key in your source code, especially if you are sharing your project on GitHub. Use a library like python-dotenv to load the key from a .env file. This keeps your credentials safe and makes it easy to switch between different keys if you have multiple accounts.

Once your environment is set up, you can begin writing your first request. Start with a simple GET request to the /v1/models endpoint to verify that your authentication is working correctly. If you receive a successful response, you are ready to move on to sending chat completions. This step-by-step approach helps you isolate issues early in the development process. If the request fails, check your API key and ensure you have sufficient prepaid credit. Errors like 401 indicate an invalid key, while 402 means you have no credit left.

Sending Your First Chat Completion

Now that your environment is configured, you can send your first chat completion request. Use the POST /v1/chat/completions endpoint to send a message to the uncensored model. The request body should be a JSON object containing the model ID, the messages array, and any optional parameters. The model ID is always uncensored. The messages array should contain objects with a role (such as user or assistant) and a content string. This structure is identical to the OpenAI API format, making it easy to switch between providers if needed.

For example, you can send a simple greeting to test the connection. The response will include the model's reply in the choices array. You can access the text of the response using the message object. This basic interaction demonstrates the text-in, text-out nature of the API. You can iterate on this by adding more messages to the array to create a conversation history. The API maintains the context of the conversation within the 100,000 token limit.

You can also customize the response by setting parameters like temperature, top_p, and stop sequences. The temperature controls the randomness of the output, with higher values producing more creative responses. The top_p parameter limits the diversity of the generated tokens. The stop sequences allow you to define specific strings that should terminate the response. These parameters give you fine-grained control over the model's behavior, which is useful for consistent output in production environments.

When testing your integration, it is helpful to log the request and response bodies. This allows you to debug any issues with the API format or the model's output. You can also check the usage statistics in the response to monitor your token consumption. The API charges $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. Prepaid credit is charged by real token usage, and errors and refusals are free. This pricing model is transparent and easy to track in your Python scripts.

Handling Streaming Responses

For applications that require real-time feedback, such as chat interfaces or agentic workflows, streaming responses are essential. The API supports streaming over Server-Sent Events (SSE). When you set the stream parameter to true in your request, the API returns a stream of chunks instead of a single complete response. Each chunk contains a portion of the model's output, allowing you to display text as it is generated.

In Python, you can handle streaming responses using the requests library with the stream=True option. Iterate over the response.iter_lines() method to process each chunk. Each chunk is a JSON object that may contain partial text in the delta field. You can concatenate these text fragments to build the complete response. This approach provides a smoother user experience, especially for long responses that might take several seconds to generate.

When using streaming, pay attention to the last chunk in the stream. The API includes usage statistics in the last chunk, such as the number of input and output tokens. This allows you to track your token consumption in real-time. You can use this information to update your application's UI or to log the usage for billing purposes. The usage data is accurate and reflects the actual tokens processed by the model.

Streaming also helps with error handling. If the connection is interrupted, you can retry the request from the last known state. This is particularly useful for agentic workflows where the model might be performing multiple steps. By streaming the output, you can monitor the progress of each step and react to errors or changes in the model's behavior. This flexibility makes the API well-suited for complex applications that require real-time interaction.

Managing Errors and Rate Limits

Any reliable integration must handle errors gracefully. The API returns standard HTTP status codes to indicate the outcome of your requests. A 401 status code means your API key is invalid. A 402 status code indicates that you have no prepaid credit left. A 429 status code means you have exceeded the rate limit of 300 requests per minute per key. You should implement logic in your Python code to handle these errors appropriately.

For 401 errors, check your API key and ensure it is correctly formatted. If the key is valid, you may need to generate a new one. For 402 errors, you will need to top up your prepaid credit. The service accepts crypto payments only, specifically USDT on TRC20 or USDC on Base. You can top up any whole amount from $20 to $500. Bonus credit is available for amounts of $50 or more, ranging from +5% to +15%. Once you have topped up, your credit will be available for use immediately.

For 429 errors, you should implement exponential backoff in your Python code. This means waiting for a short period before retrying the request, and increasing the wait time with each subsequent attempt. This prevents your application from overwhelming the API and ensures a smooth user experience. You can also monitor the rate limit headers in the response to adjust your request frequency dynamically.

It is also important to handle network errors and timeouts. Use try-except blocks in your Python code to catch exceptions and retry failed requests. This ensures that your application remains stable even if the API experiences temporary issues. By handling errors and rate limits effectively, you can build a reliable integration that works smoothly in production.

When This API Is Not the Right Choice

While this API is excellent for text-based applications, it may not be the right choice for everyone. If you need image generation, audio processing, or video creation, this service does not support those features. The API is strictly for text input and text output. You cannot use it for OCR, fine-tuning, or model routing. If your application requires multi-modal capabilities, you will need to integrate additional services or use a different provider.

Additionally, if you require a service with a free unlimited tier, this may not be the best option. The service offers a $0.50 trial credit for new accounts, but subsequent usage requires prepaid credit. There is no subscription or monthly fee, but you must top up your credit using crypto. If you prefer to pay with credit cards or PayPal, this service may not meet your needs. The payment options are limited to USDT on TRC20 or USDC on Base.

Another consideration is the lack of an SLA or certifications. The service does not guarantee specific uptime percentages or offer certifications like SOC2, HIPAA, or ISO. If your application requires strict compliance with these standards, you may need to evaluate other providers. The service is an independent platform, and it does not claim to serve another vendor's model. It offers its own uncensored open-weight text model.

Finally, if you need a service with named customers or benchmark scores, this may not be the right fit. The service does not publish these metrics. It focuses on providing a reliable, uncensored text API for developers and indie builders. If you need a service with a large track record of enterprise customers, you may want to explore other options. However, for most text-based applications, this API offers a flexible and cost-effective solution.

Addressing Community Questions on Reddit

Developers discussing this topic on Reddit often ask about linking uncensored AI APIs to agentic workflows or frontend tools. For example, users on r/BlackboxAI_ have inquired about connecting APIs like Kryven's to Blackbox for agentic workflows. They want to know if it is possible to get it working smoothly. The answer is yes, as long as the API supports the OpenAI-compatible format. You can use the standard Python SDK to connect the API to your frontend or agentic tools.

Another common question from r/Chatbots and r/startup is whether developers would pay for a reliable, uncensored LLM API. The consensus is that many developers are willing to pay for a service that offers uncensored content without the restrictions of major providers. This service offers a prepaid credit model with no monthly fees, which appeals to developers who want control over their costs. The ability to top up with crypto also attracts users who value privacy and flexibility.

Users on r/CustomAI and r/WritingWithAI often look for solutions for complex personalities or nsfw stories. They mention trying services like Grok, Gemini, Claude, and ChatGPT, but find that they refuse content too often. This service offers an uncensored model that does not refuse lawful adult or controversial topics. This makes it ideal for creative writing and role-playing applications. Developers can integrate this API to provide a more flexible and less restrictive experience for their users.

Finally, users on r/ChatbotRefugees discuss the decline of services like Kindroid, which used to claim to be entirely private and uncensored. They look for alternatives that offer similar features. This service provides a reliable, uncensored text API that can be integrated into various applications. By using the Python SDK, developers can build custom interfaces that meet the needs of users who want more control over their AI interactions. The community values the transparency and flexibility of the prepaid credit model.

Frequently asked questions

How do I authenticate with the API?

You authenticate using an API key, which is shown immediately after you sign up via Google or email. Include this key in the Authorization header of your requests. The key is unique to your account and allows you to access the uncensored model.

What payment methods are accepted?

The service accepts crypto payments only. You can top up your prepaid credit using USDT on TRC20 or USDC on Base. The minimum top-up amount is $20, and the maximum is $500. Credit cards, PayPal, and bank transfers are not accepted.

Does the API support streaming?

Yes, the API supports streaming over Server-Sent Events (SSE). You can enable streaming by setting the stream parameter to true in your request. The API returns chunks of text as they are generated, allowing for real-time updates in your application.

What happens if I run out of credit?

If you run out of credit, you will receive a 402 error. You can top up your prepaid credit using crypto. The credit never expires, and you can top up any whole amount from $20 to $500. Bonus credit is available for amounts of $50 or more.