Integrating an OpenAI-Compatible NSFW API
Developers often seek uncensored text models for roleplay, creative writing, or research. This guide explains how to integrate a hosted, OpenAI-compatible endpoint that supports the standard chat-completions interface. You will learn to configure your client, manage prepaid crypto credits, and verify that your integration handles streaming and tool use correctly.

Setting Up the Base URL and Client
Most developers already have code written for the standard OpenAI interface. To switch to an uncensored endpoint, you only need to change the base URL. Our API sits at https://api.openainsfw.cc/v1. This URL replaces the default OpenAI endpoint in your SDK configuration. By keeping the same endpoint structure, you avoid rewriting large portions of your application logic.
The model identifier you must send is "uncensored". This tells the server which model to use for the generation. The API supports both the /v1/chat/completions and /v1/responses endpoints. You can also use GET /v1/models to verify connectivity. This simplicity allows you to drop the new client into existing projects with minimal friction.
When initializing your client, ensure you pass your API key in the Authorization header. The key is shown immediately after signup, so you can use it right away. You can sign up using Google or an email and password. There is no need to provide a credit card for the trial credit, which is $0.50 for new accounts.
This approach maintains compatibility with libraries like LangChain or LlamaIndex. You can continue to use the same function calling and JSON mode features. The only difference is the base URL and the model name. This makes the transition smooth for teams that want to test uncensored capabilities without a full rewrite.
Managing Crypto Payments and Credits
Our service uses a prepaid credit system charged by real token usage. Errors and refusals are free, so you only pay for successful completions. The price is $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. These rates are fixed and do not change based on subscription tiers.
Top-ups are available only in cryptocurrency. You can use 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 $50 or more, you receive bonus credit ranging from +5% to +15%. This bonus is added to your balance immediately.
There are no monthly fees or subscriptions. Your paid credit never expires, so you can top up when convenient. This is useful for projects with irregular usage patterns. You do not need to worry about losing unused credits at the end of a billing cycle.
To check your balance, you can use the /v1/models endpoint or check your dashboard. The key is shown immediately after signup, so you can start using the trial credit of $0.50 right away. This allows you to test the API before committing to a larger top-up.
Handling Streaming and Usage Data
Streaming is supported over Server-Sent Events (SSE). This allows you to receive responses in real-time, which is essential for chat applications. The API sends usage data in the last chunk of the stream. This means you can track token consumption as the response is generated.
To enable streaming, set the stream parameter to true in your request. The SDK will yield chunks as they arrive. You can concatenate these chunks to form the full response. This is useful for displaying text as it is generated, improving the user experience.
The API supports several parameters that affect the output. You can adjust temperature, top_p, stop sequences, and seed. These parameters allow you to control the randomness and creativity of the model. You can also set penalties to discourage certain patterns.
When using streaming, ensure your client handles the final chunk correctly. This is where you will find the usage information. If you do not handle the final chunk, you might miss important data about token consumption. This is important for monitoring costs and ensuring your integration is working correctly.
Function Calling and JSON Mode
Our API supports function calling, also known as tools. This allows the model to generate structured data that your application can execute. You can define functions in your request, and the model will return arguments that match the function schema.
JSON mode is also available. This forces the model to output valid JSON, which is useful for parsing responses. You can enable JSON mode by setting the response_format parameter. This ensures that the output is always valid JSON, reducing the need for error handling in your code.
When using function calling, ensure your client handles the tool calls correctly. The model may return multiple tool calls in a single response. You need to execute these tools and send the results back to the model. This loop continues until the model returns a final response.
This feature is powerful for building agentic workflows. You can use it to extract data, perform actions, or interact with other APIs. The uncensored model can handle complex instructions and generate accurate function calls. This makes it suitable for a wide range of applications.
Error Handling and Rate Limits
Our API returns specific error codes to help you debug issues. A 401 error indicates an invalid API key. A 402 error means you have no credit left. A 429 error indicates that you have exceeded the rate limit of 300 requests per minute per key.
When you encounter a 402 error, you need to top up your credits. You can do this using USDT on TRC20 or USDC on Base. The top-up process is straightforward, and the credits are added immediately. You can then retry your request.
Rate limits are enforced per key. If you exceed 300 requests per minute, you will receive a 429 error. You can implement exponential backoff in your client to handle this gracefully. This prevents overwhelming the API and ensures a smooth user experience.
Errors and refusals are free, so you do not pay for failed requests. This is useful for testing and debugging. You can send multiple requests to test different scenarios without worrying about costs. This makes it easy to iterate on your integration.
When This API Is Not the Right Choice
Our API is designed for text-in, text-out interactions. If you need image, audio, video generation, embeddings, OCR, or fine-tuning, this API is not the right choice. It does not support these features, so you will need to use a different service for those capabilities.
The context window is 100,000 tokens, which is sufficient for many applications. However, if you need a larger context window, you may need to consider other options. The model is uncensored, meaning it does not refuse lawful adult, fictional, or controversial topics. This is a key feature for some users.
The API is hosted, so you do not need to manage infrastructure. This is a benefit for teams that want to focus on application development. However, if you need on-premises deployment, this API is not suitable. You would need to run the model locally or use a different hosted service.
Payment is crypto-only, which may not be suitable for all users. If you prefer to pay with a credit card or PayPal, you may need to use a different service. The trial credit of $0.50 is a good way to test the API, but you will need to top up for continued use.
Addressing Common Developer Questions
Developers often ask how to handle the uncensored nature of the model. The model does not refuse lawful adult or controversial topics, which is useful for roleplay and creative writing. However, it does refuse sexual content involving minors. This is a hard limit that cannot be bypassed.
Another common question is about the quality of the model. Users discuss that some chatbot apps feel repetitive because of bad models or wrong settings. Our API uses a single uncensored open-weight model. You can adjust parameters like temperature and top_p to improve the quality of the output.
Users also ask about the difference between our API and other vendors. While other vendors may offer similar features, our API is focused on simplicity and uncensored text generation. We do not claim to be the best in every metric, but we provide a reliable and straightforward interface.
Finally, developers ask about the ease of integration. Our API is compatible with the OpenAI SDK, making it easy to switch. You can use the same code structure and only change the base URL. This reduces the learning curve and allows you to get started quickly.
Frequently asked questions
How do I top up my credits?
You can top up using USDT on TRC20 or USDC on Base. The minimum amount is $20, and the maximum is $500. Bonus credit is available for top-ups of $50 or more.
What is the context window size?
The context window is 100,000 tokens, including both prompt and completion. This is sufficient for most text-based applications.
Does the API support streaming?
Yes, the API supports streaming over Server-Sent Events (SSE). Usage data is provided in the final chunk of the stream.
What happens if I run out of credit?
You will receive a 402 error. You can top up your credits using crypto, and the credits will be added immediately. Errors and refusals are free.