EN ▾
Get API key

Integrating Uncensored Text API with OpenAI SDK

Developers often seek a straightforward way to integrate uncensored text generation into their applications using familiar tools. This guide provides a tested checklist for configuring endpoint URLs, authentication headers, and system prompts to ensure reliable output.

Understanding the API Structure

This site is an independent service and is not affiliated with Google Gemini.

The foundation of integrating our service lies in understanding its structure. This API is hosted and designed to be OpenAI-compatible, meaning you can use existing SDKs without major modifications. The base URL for all requests is https://api.nsfwgemini.com/v1. This single endpoint handles all interactions, from sending messages to retrieving model information.

Unlike some providers that offer multiple endpoints for different tasks, our service focuses solely on text generation. You will not find endpoints for embeddings, image generation, audio processing, or video creation. This simplicity reduces complexity and ensures that your integration remains lightweight and easy to maintain.

The model identifier you must send in your requests is "uncensored". This tells the system which text model to use for generating responses. The model is an open-weight text model, meaning it is designed to handle a wide range of topics without the typical restrictions found in other services.

When you send a request, you are sending text in and receiving text out. This straightforward input-output mechanism makes it easy to integrate into various applications, from chatbots to content generation tools. The focus on text-only output ensures that the service remains fast and cost-effective for developers who need reliable text generation.

Configuring Authentication and Headers

Authentication is handled through API keys, which are generated when you sign up for an account. You can sign up using Google or by providing an email and password. Once you create an account, your API key is shown immediately, allowing you to start making requests right away. This key is essential for authenticating your requests and ensuring that your usage is tracked correctly.

When making requests, you need to include the API key in the authorization header. This header is standard in most OpenAI-compatible SDKs, so you do not need to write custom code to handle authentication. The key is unique to your account and should be kept secure to prevent unauthorized usage.

Errors related to authentication include a 401 status code, which indicates an invalid key. If you encounter this error, check that your key is correct and that it has not been revoked. Another common error is a 402 status code, which indicates that you have no credit left on your account. This error will occur when your prepaid balance is exhausted.

Rate limiting is also enforced, with a limit of 300 requests per minute per key. If you exceed this limit, you will receive a 429 status code. This limit helps ensure fair usage and prevents any single user from overwhelming the system. If you need to handle rate limits, you can implement retry logic in your application to wait and retry after a short delay.

Sending Requests with the OpenAI SDK

Using the OpenAI SDK to send requests to our API is straightforward. You need to configure the SDK with the base URL and your API key. Once configured, you can use the standard chat-completions endpoint to send messages. The endpoint is POST /v1/chat/completions, and it accepts a JSON payload containing the messages you want to send.

The messages payload should include a system message that defines the behavior of the model. For uncensored responses, you can set the system message to indicate that the model should not refuse lawful adult, fictional, security-research, or controversial topics. This helps ensure that the model generates the type of content you are looking for.

You can also use the streaming feature over Server-Sent Events (SSE) to receive responses in real-time. This is useful for applications that require immediate feedback, such as chatbots. The streaming feature includes usage information in the last chunk, allowing you to track token consumption as the response is generated.

Additionally, you can use function calling (tools) and JSON mode to structure your requests and responses. These features allow you to integrate the API more deeply into your application, enabling more complex interactions. The parameters temperature, top_p, stop, seed, and penalties can also be adjusted to fine-tune the model's output.

Managing Credits and Costs

Our service operates on a prepaid credit system, where you pay for actual token usage. The pricing is $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. This means that you are only charged for the tokens that are actually used in your requests, making it cost-effective for developers who need occasional text generation.

You can top up your credit using cryptocurrency, specifically USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. If you top up with $50 or more, you receive a bonus credit ranging from 5% to 15%. This bonus credit can help you get more value from your purchases.

Errors and refusals are free, meaning that you are not charged for tokens that are not generated. This includes cases where the model refuses a request due to content restrictions or when an error occurs during processing. This policy ensures that you are not penalized for issues outside your control.

Your paid credit never expires, so you can use it whenever you need it. There is no subscription or monthly fee, which means that you are not charged for inactivity. This flexibility is ideal for developers who may have variable usage patterns and do not want to commit to a recurring payment.

When Our API Is Not the Right Choice

While our API is excellent for uncensored text generation, it may not be the right choice for all use cases. If you need image generation, audio processing, or video creation, our service does not support these features. Similarly, if you require embeddings for semantic search or fine-tuning for custom model training, our API does not offer these capabilities.

Our service is also limited to text input and output. If you need OCR for extracting text from images or model routing for switching between different models, our API does not support these functions. Developers looking for a comprehensive AI solution with multiple modalities may need to consider other providers.

Additionally, if you require strict SLA guarantees or certifications such as SOC2, HIPAA, or ISO, our service does not provide these. Our service is designed for developers who need reliable text generation without the overhead of additional features and certifications.

Finally, if you are looking for a free unlimited tier, our service may not meet your needs. While we offer a trial credit of $0.50 for new accounts, ongoing usage requires prepaid credit. Developers who need a completely free solution may need to explore other options.

Addressing Community Concerns

Discussions on Reddit often highlight concerns about the quality and realism of NSFW AI chat bots. Users frequently mention that many apps feel like normal chatbots with a different coat of paint, lacking genuine wit or cleverness. This feedback suggests that developers should focus on improving the model's personality and responsiveness to create more engaging experiences.

Another common theme is the issue of over-moderation by big providers. Users appreciate uncensored models because they allow for more natural and unrestricted conversations. Our API addresses this by providing a model that does not refuse lawful adult or controversial topics, making it suitable for developers who want to offer a more authentic experience.

Users also discuss the importance of memorization and context in creating realistic characters. By setting appropriate system prompts and using features like function calling, developers can enhance the model's ability to maintain context and respond in a way that feels more organic.

Finally, some users mention the value of open-source tools like SillyTavern for creating scenarios. While our API is not open-source, it provides a reliable and scalable solution for developers who need to integrate uncensored text generation into their applications without managing their own infrastructure.

Best Practices for Integration

To ensure a smooth integration, start by testing your API key and endpoint configuration. Use the trial credit to send a few test requests and verify that the responses are as expected. This helps you identify any issues with authentication or request formatting before deploying to production.

Implement error handling for common status codes such as 401, 402, and 429. This ensures that your application can gracefully handle issues like invalid keys, insufficient credit, or rate limits. Retry logic can be particularly useful for rate limit errors, allowing your application to wait and retry after a short delay.

Use system prompts to define the behavior of the model. This helps ensure that the model generates the type of content you are looking for, whether it is uncensored text, fictional stories, or security research. Experiment with different prompts to find the best results for your specific use case.

Monitor your usage and costs regularly. Since you are charged by actual token consumption, keeping an eye on your usage can help you manage your budget effectively. Use the streaming feature to track token usage in real-time, and adjust your top-up frequency based on your usage patterns.

Frequently asked questions

How do I sign up for an account?

You can sign up using Google or by providing an email and password. Once you create an account, your API key is shown immediately, allowing you to start making requests right away.

What is the pricing for the API?

The pricing is $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. You are charged for actual token usage, and errors and refusals are free.

Can I use the API for image generation?

No, the API is text-only. It does not support image generation, audio processing, video creation, embeddings, or OCR. It is designed for text-in, text-out workflows.

How do I top up my credit?

You can top up using USDT on the TRC20 network or USDC on the Base network. The minimum top-up amount is $20, and the maximum is $500. Bonus credit is available for top-ups of $50 or more.