Authentication and Base URL
Our API follows the standard OpenAI chat-completions interface. You authenticate using an API key passed in the Authorization header. You can generate a key immediately by signing up with Google or an email address on the Get API key page. Once created, the key is displayed once, so save it securely.
The base URL for all requests is https://api.nsfwsearch.top/v1. You can use this with any OpenAI-compatible SDK by setting the base URL configuration. The only model ID you need to specify is uncensored, which runs our own tuned open-weight model optimized for high-volume text generation without content refusals.
There are no monthly fees or subscriptions. You pay strictly per token, with credits that never expire. If you encounter issues, contact support directly.
Sending Your First Request
To test the API, send a simple POST request to the /v1/chat/completions endpoint. The model will return text output based on your prompt. Ensure your request body includes the model field set to uncensored and a messages array with your user input.
The API accepts standard parameters like temperature and top_p to control creativity. For most use cases, you do not need to set these; defaults work well for general uncensored generation. Remember that errors and refusals do not consume your token credits, so you can retry failed requests safely.
Below is a basic example using curl to send a prompt and receive a completion.
curl https://api.nsfwsearch.top/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
}'
Python SDK Integration
Using the official OpenAI Python SDK is the most straightforward way to integrate our API. Set the base_url to our endpoint and provide your API key. The SDK handles serialization and response parsing automatically.
Since our API is strictly text-in, text-out, you can use the same code structure you would for GPT-4 or other standard models. Just ensure you are using the latest version of the SDK for best compatibility. The model parameter should always be set to uncensored.
This approach works for both synchronous and asynchronous applications. If you need to handle large volumes of requests, consider using async methods to improve throughput without hitting rate limits immediately.
Here is how you can initialize the client and make a request in Python.
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwsearch.top/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)
Node.js SDK Usage
For JavaScript and TypeScript developers, the OpenAI Node.js SDK works seamlessly with our base URL. Configure the client with your API key and the custom base URL provided above.
Node.js developers often need to handle streams for long-running responses. Our API supports streaming via Server-Sent Events (SSE), which allows you to receive tokens in real-time. This is crucial for chat applications where users expect immediate feedback.
Make sure to handle errors appropriately. If your credit balance is insufficient, you will receive a 402 error. If your API key is invalid, you will get a 401. Check the Pricing page to top up your credits using crypto.
See the example below for a standard Node.js request.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwsearch.top/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);
Streaming Responses
Enable streaming by setting the stream parameter to true in your request. The API will return a sequence of Server-Sent Events (SSE) instead of a single JSON response. Each event contains a partial token, allowing your application to render text progressively.
The final chunk in the stream contains the full token usage statistics for the request. This is important for tracking your credit consumption accurately. Streaming does not change the pricing; you still pay per input and output token.
This feature is ideal for chat interfaces, real-time data processing, or any application where latency matters more than waiting for the full completion. It also allows you to cancel requests early if the user changes their input, potentially saving tokens.
Here is an example of handling a stream in your client.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
JSON Mode, Tools, and Limits
Our API supports structured output and function calling. Set response_format to {"type": "json_object"} to force JSON output, which is useful for data extraction or programmatic workflows. You can also use the tools parameter for function calling, allowing the model to invoke specific functions based on your prompt.
Be aware of the hard limits: 300 requests per minute per key, 8 concurrent requests, and an 8 MB request body limit. The context window is 100,000 tokens, with no separate output cap. If you do not specify max_tokens, the response can run to the end of the window.
Content filtering is minimal but not absent: we strictly block sexual content involving minors. All other lawful adult, fictional, or controversial topics are allowed. This makes our API a reliable choice for NSFW-tolerant applications without the overhead of multimodal features you might not need.