Integrating an OpenAI-Compatible Uncensored API
Switching from standard providers to an unrestricted model often requires minimal code changes if you use an OpenAI-compatible interface. This guide walks you through the integration process, covering SDK setup, endpoint configuration, and testing strategies. By following these steps, you can connect to our service and start generating text with fewer content restrictions.

Understanding the API Structure
Before diving into code, it is essential to understand the structure of the API you are integrating. Our service provides a hosted, OpenAI-compatible chat-completions API that serves a single uncensored open-weight text model. The interface is designed to be familiar to developers who have worked with standard language model providers, allowing for a smooth transition without the need for extensive refactoring.
The base URL for all requests is https://api.unrestrictedaimodel.cc/v1. This endpoint handles all incoming requests for chat completions, responses, and model information. By using a standard base URL structure, you can easily swap out the provider in your configuration files without altering the core logic of your application.
The API supports text input and text output, making it suitable for a wide range of use cases, from chatbots to content generation tools. The model ID you need to send in your requests is 'uncensored'. This identifier tells the server which model to use for processing your input.
Unlike some other services that offer multiple models or specialized endpoints for embeddings and image generation, this API focuses solely on text completion. This simplicity reduces the complexity of your integration, as you only need to manage one model type. However, it also means that if you need features like image generation or OCR, you will need to integrate additional services alongside this text API.
SDK Configuration and Setup
To begin the integration, you need to configure your SDK to communicate with our API. Most popular SDKs for OpenAI-compatible endpoints allow you to specify a custom base URL and API key. Start by installing the appropriate SDK for your programming language, such as Python, JavaScript, or Go.
Once the SDK is installed, you must set the base URL to https://api.unrestrictedaimodel.cc/v1. This ensures that all requests are directed to our servers. You will also need to generate an API key by signing up on our site. You can sign up using Google or an email and password, and the key will be shown immediately after registration.
Set the model parameter in your SDK configuration to 'uncensored'. This is important because the API serves only one model, and specifying the correct ID ensures that the requests are processed correctly. If you omit this or use a different ID, the API may return an error.
Authentication is handled via the API key, which should be passed in the Authorization header. Make sure to store your key securely, as it provides access to your prepaid credit. The key is unique to each account and allows you to make up to 300 requests per minute. If you exceed this limit, you will receive a 429 rate limit error.
Making Chat Completion Requests
With the SDK configured, you can now start making chat completion requests. The primary endpoint for this is POST /v1/chat/completions. This endpoint accepts a JSON payload containing the messages, model ID, and various parameters that control the model's behavior.
The messages parameter should be an array of objects representing the conversation history. Each object has a role (such as 'user' or 'assistant') and content. The model will generate a response based on this context. You can also include parameters like temperature, top_p, stop sequences, and seed to control the randomness and determinism of the output.
Streaming is supported over Server-Sent Events (SSE). This allows you to receive the response token by token, which is useful for real-time applications. The usage information, including token counts, is provided in the last chunk of the stream. This helps you track your credit usage in real-time.
Function calling is also supported, allowing you to define tools that the model can call. This is useful for building agents that can perform actions or retrieve data. The API supports JSON mode, which ensures that the model's output is valid JSON, making it easier to parse and use in your application.
Handling Errors and Limits
During integration, you will encounter various errors that need to be handled gracefully. The API returns specific HTTP status codes to indicate the state of your request. A 401 error indicates an invalid API key, which means you should check your credentials. A 402 error means you have no credit left, and a 429 error indicates that you have exceeded the rate limit of 300 requests per minute.
It is important to implement retry logic in your application to handle these errors. For rate limit errors, you can implement exponential backoff to wait before retrying. For credit errors, you may need to prompt the user to top up their account.
Errors and refusals are free, meaning you are not charged for tokens in these cases. This is beneficial for testing and debugging, as you can make multiple requests without worrying about credit consumption. However, be aware that the model has a hard content limit regarding sexual content involving minors, which will be refused.
Understanding these error codes and limits helps you build a more reliable application. By handling errors appropriately, you can ensure a smooth user experience even when issues arise. Always check the API documentation for the most up-to-date information on error handling and rate limits.
Testing and Validation
Testing your integration is important to ensure that everything works as expected. Start by sending simple test requests to the API to verify that the connection is established correctly. Use the GET /v1/models endpoint to check if the API is responsive and returns the correct model information.
Next, test the chat completion endpoint with various prompts to see how the model responds. Experiment with different parameters like temperature and top_p to understand how they affect the output. This will help you fine-tune the model's behavior for your specific use case.
Streaming should also be tested to ensure that the SSE events are received correctly. Verify that the usage information is provided in the last chunk and that the token counts are accurate. This is important for monitoring your credit usage and avoiding unexpected charges.
Function calling and JSON mode should be tested to ensure that the model can correctly call tools and return valid JSON. This is particularly important for building complex applications that rely on structured data. By thoroughly testing these features, you can ensure that your integration is reliable and reliable.
When This API Is Not the Right Choice
While our API is powerful for text generation, it may not be the right choice for every project. If your application requires image generation, audio processing, or video creation, this text-only API will not suffice. You would need to integrate additional services to handle these multimodal tasks.
Similarly, if you need embeddings for vector search or fine-tuning for custom model training, this API does not support those features. The API is designed specifically for chat completions and text generation, so if your workflow relies heavily on these other capabilities, you may need to look for a more comprehensive solution.
Additionally, if you require on-premises deployment for data privacy or compliance reasons, our hosted service may not meet your needs. The API is hosted on our servers, and we do not offer on-prem deployment options. If data residency is a critical factor, you might consider running a local model instead.
Finally, if you need a model with a very specific benchmark score or a particular brand recognition, our uncensored model may not fit your marketing or performance requirements. Our focus is on providing an unrestricted text model with a simple, open-source interface. If you need a model with a specific brand identity or benchmark performance, you should evaluate other options that specialize in those areas.
Addressing Common Developer Questions
Developers often ask about the practical implications of using an unrestricted model in different contexts. For instance, some users are concerned about the suitability of unrestricted AI for children, especially in light of recent discussions about age restrictions on platforms like ChatGPT and Gemini. While our model does not refuse lawful adult or controversial topics, it is important to consider the audience and context of your application.
Another common question relates to running unrestricted AI locally. Some developers prefer to run models on their own hardware to avoid external dependencies. While our API is hosted, you can still achieve similar results by running a local model if you have the necessary hardware, such as a GPU with at least 8GB of VRAM. This gives you more control over the model's behavior and data privacy.
Users also inquire about the best uncensored models available for local use. While there are many options, the choice depends on your specific needs, such as VRAM requirements and performance. Our API offers a convenient way to access an uncensored model without the need for local hardware, making it accessible to a wider range of developers.
Finally, there are concerns about the reliability of AI in educational settings, such as law exams. While AI can assist with tasks, it may not always provide accurate or complete information. It is important to use AI as a tool to enhance productivity rather than a replacement for critical thinking. By understanding these nuances, you can make informed decisions about how to integrate our API into your projects.
Frequently asked questions
How do I get an API key?
You can sign up on our site using Google or an email and password. The API key is shown immediately after registration.
What is the model ID?
The model ID is 'uncensored'. You must set this in your SDK configuration to use the correct model.
How is pricing calculated?
Pricing is based on token usage. You are charged $0.15 per 1M input tokens and $0.50 per 1M output tokens. Errors and refusals are free.
Can I stream responses?
Yes, the API supports streaming over Server-Sent Events (SSE). Usage information is provided in the last chunk of the stream.