Integrating Uncensored LLM API with OpenAI SDK
Developers often seek uncensored text models for roleplay or research without complex local setups. This guide shows how to connect a hosted uncensored API using standard OpenAI SDK tools for smooth text workflows.

Understanding the Uncensored Text Model
When integrating an uncensored LLM API, the first step is understanding the model's core behavior. Unlike standard models that may refuse certain prompts, this service serves a single uncensored open-weight text model. The model ID you must send in your requests is simply 'uncensored'. This ensures that the API does not refuse lawful adult, fictional, security-research, or controversial topics. However, it is important to note that there is a hard content limit regarding sexual content involving minors, which will be refused.
The API is designed for text-in, text-out workflows. It does not support image, audio, video, or embedding generation. This focus on pure text makes it ideal for developers building chat interfaces, roleplay bots, or research tools that require unfiltered responses. By using a single model, you avoid the complexity of model routing and ensure consistent behavior across your application.
When you send a request, the model processes the input and generates a response based on its training. The uncensored nature means it is less likely to trigger safety filters that might interrupt the flow of conversation or creative writing. This is particularly useful for applications where the user expects a direct answer without moralizing or hedging.
It is important to remember that 'uncensored' does not mean 'unlimited'. The model still has a context window and token limits. Understanding these constraints helps you design your application to handle long conversations efficiently. You can manage the context window by monitoring the token count and truncating older messages if necessary.
Setting Up the OpenAI SDK Connection
Integrating with the uncensored API is straightforward because it uses the standard OpenAI-compatible endpoints. You can use the official OpenAI SDK for Python or Node.js to connect to the service. The base URL for the API is https://api.gemma4api.com/v1. This compatibility allows you to use familiar methods and structures in your code without needing to learn a new API format.
To begin, you need to install the OpenAI SDK in your project. For Python, you can use pip to install the package. Then, you configure the client with your API key and the base URL. The API key is generated when you sign up for an account. You can sign up using Google or an email and password combination. The key is shown immediately after signup, so make sure to copy it securely.
Once the client is configured, you can start sending requests. The primary endpoint for chat completions is POST /v1/chat/completions. This endpoint accepts a list of messages and returns a response. You can also use the POST /v1/responses endpoint for newer response formats. The GET /v1/models endpoint allows you to retrieve information about the available models, though in this case, there is only one model available.
The SDK handles the authentication and request formatting for you. You just need to provide the API key in the authorization header. The SDK will automatically include the key in your requests. This simplifies the integration process and reduces the chance of errors in your code. You can also use the SDK's built-in error handling to manage issues like invalid keys or rate limits.
Configuring Parameters for Uncensored Output
To get the best results from the uncensored model, you need to configure the parameters correctly. The API supports several parameters that control the generation process. These include temperature, top_p, stop sequences, seed, and penalties. Adjusting these parameters can help you fine-tune the model's behavior to suit your specific needs.
The temperature parameter controls the randomness of the output. A higher temperature leads to more creative and varied responses, while a lower temperature produces more deterministic and focused outputs. For uncensored roleplay or creative writing, you might want to experiment with higher temperatures to get more diverse responses. However, be aware that higher temperatures can also lead to more incoherent text.
The top_p parameter is another way to control randomness. It sets the cumulative probability cutoff for token selection. A lower value makes the output more focused, while a higher value allows for more variety. You can use top_p in combination with temperature to achieve the desired balance between creativity and coherence. The API also supports stop sequences, which allow you to specify strings that will stop the generation process.
Seed and penalties are additional controls for reproducibility and style. The seed parameter allows you to set a random seed for reproducible results. Penalties can be used to discourage certain words or phrases in the output. These parameters give you fine-grained control over the model's behavior, allowing you to tailor the output to your specific use case. You can also use the JSON mode to get structured output from the model.
Managing Tokens and Pricing
Understanding the pricing model is essential for budgeting your API usage. The uncensored API uses a prepaid credit system based on token usage. There is no monthly subscription or recurring fee. You pay $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. Errors and refusals are free, so you only pay for successful generations.
The context window for the model is 100,000 tokens, which includes both the prompt and the completion. This large context window allows you to send long conversations or documents to the model. However, you need to be mindful of the token count to avoid hitting the limit. You can monitor the token usage in the API responses to keep track of your consumption.
To top up your credit, you can use cryptocurrency. The API accepts USDT on the TRC20 network or USDC on the Base network. You can add any whole amount between $20 and $500 to your account. There are also bonus credits available for larger top-ups, ranging from +5% to +15% depending on the amount. This flexible payment method allows you to add credit as needed without committing to a long-term subscription.
It is important to note that paid credit never expires. You can use your balance over time without worrying about it expiring. This makes the prepaid model cost-effective for developers who do not need constant access to the API. You can also start with a trial credit of $0.50 when you sign up, allowing you to test the API without any initial investment.
Handling Streaming and Function Calling
The uncensored API supports streaming responses over Server-Sent Events (SSE). This allows you to receive the model's output in chunks as it is generated, rather than waiting for the entire response to complete. Streaming is useful for real-time chat applications where you want to display text as it is being typed. The SDK handles the streaming logic for you, making it easy to implement in your application.
In addition to streaming, the API supports function calling, also known as tools. This feature allows the model to call external functions based on the input. You can define functions in your API request, and the model will return a structured response indicating which function to call and with what arguments. This is particularly useful for building assistants that can interact with other services or databases.
To use function calling, you need to define the functions in your request and set the appropriate parameters. The model will then return a response that includes the function call details. You can then execute the function and send the result back to the model for further processing. This creates a loop where the model can use external tools to enhance its responses.
When implementing streaming and function calling, it is important to handle errors and edge cases carefully. The API returns specific error codes for different issues, such as 401 for invalid keys, 402 for no credit, and 429 for rate limits. You should implement error handling in your code to manage these situations gracefully. This ensures that your application remains stable and responsive even when issues arise.
When This API Is Not the Right Choice
While the uncensored API is powerful for text generation, it may not be the right choice for every developer. If you need image, audio, or video generation, this API will not meet your needs. It is strictly a text-in, text-out service. Similarly, if you require embeddings, OCR, or fine-tuning capabilities, you will need to look elsewhere.
The API also has a rate limit of 300 requests per minute per key. If your application requires higher throughput, you may need to implement rate limiting or use multiple API keys. Additionally, the payment method is limited to cryptocurrency. If you prefer to pay with credit cards, PayPal, or bank transfers, this API may not be suitable for you.
Another consideration is the lack of an SLA or certifications like SOC2 or HIPAA. If you are building a production application that requires high availability and data privacy guarantees, you may need to evaluate other providers. The uncensored API is best suited for developers who are comfortable with its limitations and are looking for a simple, uncensored text model.
Finally, if you need a model that can route between different models or versions, this API only serves one model. If your application requires dynamic model selection, you will need to implement that logic yourself or use a different provider. For most use cases involving roleplay, research, or creative writing, however, this API provides a reliable and flexible solution.
Addressing Common Developer Questions
Developers often ask about the best uncensored models for roleplay and ERP (ERP stands for Erotic Roleplay). Many users are looking for models that can handle complex narratives and character interactions without being overly filtered. The uncensored API is well-suited for these use cases, as it does not refuse controversial or adult topics. However, it is important to test the model with your specific prompts to ensure it meets your needs.
Another common question is how to find an uncensored LLM that is not 'spicy' or character-based. Some developers want a straightforward, unfiltered LLM that tells the truth without trying to be politically correct. The uncensored API provides this functionality, allowing you to get direct answers without unnecessary fluff. You can adjust the parameters to control the tone and style of the output.
Developers also inquire about the best uncensored LLM for coding and technical tasks. While the uncensored API is primarily designed for general text generation, it can be used for coding tasks as well. The model's ability to handle long context windows makes it useful for processing large codebases or complex technical documents. You can use the SDK to integrate it into your development workflow.
Finally, many users ask about the best uncensored LLM at the moment. The uncensored API offers a reliable and consistent experience with its single model. It is important to check the vendor's documentation for current prices, limits, and features, as these may change over time. By using the OpenAI SDK, you can easily integrate the API into your application and take advantage of its uncensored capabilities.
Frequently asked questions
How do I sign up for the uncensored API?
You can sign up using Google or an email and password. Your API key is shown immediately after signup, allowing you to start using the service right away.
What payment methods are accepted?
The API accepts crypto only, specifically USDT on TRC20 or USDC on Base. You can top up with amounts between $20 and $500.
Does the API support streaming?
Yes, the API supports streaming over Server-Sent Events (SSE). This allows you to receive responses in real-time as they are generated.
What is the context window size?
The context window is 100,000 tokens, which includes both the prompt and the completion. This allows for long conversations and large documents.