EN ▾

Uncensored API for developers.

Get API key

Integrate Uncensored Text API with SDK

Connecting an uncensored text model to your application requires understanding the specific integration points of an OpenAI-compatible endpoint. This guide walks you through the technical steps to authenticate, send requests, and verify that your text-in, text-out pipeline is functioning correctly with the uncensored model.

Illustration of an uncensored text AI API with data flowing from a terminal to a digital brain.

Understanding the API Structure

Before writing code, it is essential to understand the base URL and the specific model identifier. The service provides a hosted API that mimics the OpenAI chat-completions interface. You will send text in and receive text out using a single uncensored open-weight model. The model identifier you must use in your requests is simply uncensored. This simplicity allows you to swap out standard OpenAI clients without rewriting complex logic, provided you adjust the base URL.

The base URL for this service is https://api.openrouternsfw.cc/v1. Unlike some providers that offer multiple models or routing layers, this endpoint serves one specific model. This means your integration does not need to handle model selection logic. You only need to ensure your HTTP client points to the correct base URL and includes the uncensored model ID in the payload.

Authentication is handled via an API key. When you sign up using Google or an email and password, your key is shown immediately. You must include this key in the Authorization header of your requests. The service does not support other authentication methods like OAuth flows for third-party apps at this stage. Keep your key secure, as it is the only way to access your prepaid credit.

Errors are returned in standard HTTP format. A 401 error indicates an invalid key, while a 402 error means you have no credit. A 429 error signals that you have hit the rate limit of 300 requests per minute. Understanding these codes helps you debug your integration quickly without needing to parse complex JSON error messages.

Setting Up Your SDK

Most developers use the official OpenAI SDK for Python, JavaScript, or other languages. To integrate this uncensored service, you need to configure the SDK to point to the new base URL. This involves overriding the default endpoint settings. For example, in Python, you would set the base_url parameter in your client initialization. This ensures that all subsequent API calls are routed to the correct server.

You must also set the model parameter to uncensored. This tells the API which model to use for generating responses. Since this service only offers one model, this setting is constant. However, if you are building a flexible application that might switch providers, you can make this a configurable environment variable. This allows you to switch between different uncensored providers by changing a single variable.

Authentication is straightforward. You pass your API key to the SDK. In most SDKs, this is done via an environment variable or a direct parameter. Ensure that your key is valid and has not been revoked. The service does not support key rotation or multiple keys per account at this time. Each key is tied to a single balance of prepaid credit.

It is important to note that this service does not support embeddings, image generation, audio, or video. If your application requires these features, you will need to integrate additional APIs. This integration guide focuses solely on text generation. Keep your SDK configuration minimal to avoid unnecessary complexity. Test your connection early to ensure that the base URL and model ID are correct.

Sending Your First Request

Once your SDK is configured, you can send your first request. The API uses the standard POST /v1/chat/completions endpoint. You need to provide a list of messages, typically including a system prompt and a user message. The system prompt can be used to set the behavior of the model, such as instructing it to be uncensored or to follow specific formatting rules.

The user message contains the actual input you want the model to process. You can send simple text or more complex prompts with multiple turns. The API supports streaming over Server-Sent Events (SSE), which allows you to receive responses in real-time. This is useful for applications that display text as it is generated, such as chat interfaces. You can also receive the full response in a single chunk if streaming is not required.

Parameters like temperature, top_p, stop, and seed are supported. These allow you to control the randomness and reproducibility of the output. For example, setting a seed ensures that you get the same response for the same input, which is useful for testing. The temperature parameter controls the creativity of the model, with higher values producing more diverse outputs.

Function calling and JSON mode are also available. You can define tools that the model can call, or request that the output be in JSON format. This is useful for integrating the model with other parts of your application. The API returns the generated text in the choices array of the response. You can extract this text and use it in your application.

Verifying Text-In Text-Out

After sending a request, you need to verify that the text-in, text-out functionality is working correctly. This involves checking that the API returns a valid response with the expected text. You should also check for any errors or exceptions that might indicate a problem with your integration.

One way to verify functionality is to send a simple prompt and check that the response is non-empty. For example, you can send a prompt like Hello and check that the model responds with a greeting. This basic test ensures that the connection is established and the model is generating text.

You can also test the streaming functionality by sending a request with the stream parameter set to true. This allows you to receive the response in chunks, which can be processed in real-time. You should verify that the chunks are received in the correct order and that the final response is complete.

Another important check is to verify that the API respects the context window. The service supports a context window of 100,000 tokens. You can test this by sending a very long prompt and checking that the model can handle it without errors. This ensures that your application can handle large inputs without hitting limits.

Pricing and Credit Management

Understanding the pricing model is important for managing your API usage. The service charges $0.15 per 1 million input tokens and $0.50 per 1 million output tokens. This means that the cost of a request depends on the number of tokens in the prompt and the response. You can estimate the cost of a request by counting the tokens and applying these rates.

Credit is prepaid and charged by real token usage. Errors and refusals are free, which means you do not pay for requests that fail or are rejected by the content filter. This is a significant advantage for developers who are testing their applications or dealing with variable input sizes. Paid credit never expires, so you can use it at any time.

To add credit, you can use crypto. The service accepts USDT on the TRC20 network or USDC on the Base network. You can top up with any whole amount between $20 and $500. There is also a bonus credit program for top-ups of $50 or more, which gives you between 5% and 15% extra credit. This makes larger top-ups more cost-effective.

New accounts receive $0.50 of trial credit, which allows you to test the API without committing to a purchase. This trial credit is sufficient for a few test requests, allowing you to verify that your integration is working correctly before buying more credit. Keep an eye on your balance to ensure that you have enough credit for your usage.

When This API Is Not the Right Choice

While this uncensored text API is powerful for text generation, it is not suitable for every use case. If your application requires image generation, audio processing, or video creation, this API will not meet your needs. The service is strictly text-in, text-out, so you will need to integrate other APIs for multimedia tasks.

Similarly, if you need embeddings for vector search, this API does not provide that feature. You will need to use a separate embedding API to generate vectors from your text data. The same applies to OCR, fine-tuning, and model routing. If your workflow relies on these capabilities, you will need to build a more complex integration that combines multiple services.

Another limitation is the lack of an SLA or certification. If your application requires high availability or compliance with standards like SOC2 or HIPAA, this service may not be the best fit. The service is an independent provider and does not offer enterprise-grade guarantees. For critical applications, you might prefer a provider with a established track record of uptime and compliance.

Finally, if you need to switch between multiple models dynamically, this API might be limiting. Since it only serves one uncensored model, you cannot easily switch to a different model for different tasks. If your application requires a variety of models for different purposes, you might need a more flexible routing service. However, for focused text generation tasks, this API offers a simple and effective solution.

Addressing Community Concerns

Developers often discuss the reliability and value of AI APIs in online communities. Threads on r/LocalLLaMA and r/technology highlight concerns about pricing, model quality, and the future of AI gateways. Users frequently question whether third-party wrappers offer genuine value or simply markup on cheaper models. This uncensored API addresses some of these concerns by offering a direct, uncensored model without complex routing layers.

Some users worry about the stability of smaller providers. With the acquisition of major players like OpenRouter by Stripe, there is concern about monopoly and price increases. This service offers an alternative by providing a stable, uncensored model at a fixed price. The prepaid credit model ensures that you know exactly what you are paying for, without hidden fees or subscription traps.

Another common topic is the decline of certain models on gateways. Users often seek out uncensored models for specific use cases, such as creative writing or security research. This API caters to that need by offering a model that does not refuse lawful adult or controversial topics. This makes it a valuable tool for developers who need flexibility in their AI interactions.

Finally, users often discuss the cost of API usage. By offering a transparent pricing model with prepaid credit, this service allows developers to control their costs. You can top up as needed and use the credit whenever you want. This flexibility is appealing to indie builders and small teams who want to avoid long-term commitments.

Frequently asked questions

How do I authenticate with the API?

You authenticate by including your API key in the Authorization header of your requests. Your key is shown immediately after signup and is used for all subsequent calls.

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 inputs.

Can I use streaming for real-time responses?

Yes, the API supports streaming over Server-Sent Events (SSE). You can receive responses in chunks as they are generated, which is ideal for chat interfaces.

What happens if I run out of credit?

If you run out of credit, you will receive a 402 error. You can add more credit by topping up with USDT on TRC20 or USDC on Base, with amounts between $20 and $500.