Base URL & Authentication
Our API follows the OpenAI compatibility standard, meaning you can use existing SDKs with minimal changes. The base URL is https://api.sdxlnsfw.top/v1. You authenticate using a Bearer token in the Authorization header. Unlike many competitors, we do not require a phone number for signup; you can create an account via Google or email and receive your key immediately.
Each account supports one active key at a time. If you generate a new key, the old one is revoked instantly. Ensure your Authorization header is set to Bearer YOUR_API_KEY for all requests. This endpoint handles all text processing, from prompt generation to captioning, without interfering with your image or audio pipelines.
Send Your First Request
Start by sending a simple text completion request to verify connectivity. The model ID is uncensored. This model is tuned to answer without content refusals for lawful adult use, making it ideal for NSFW prompt engineering. You can send up to 100,000 tokens in the context window, with no separate output cap per request.
Below is a basic cURL example to test the endpoint. Replace YOUR_API_KEY with your key. If you receive a JSON response with content, your integration is working. Errors like 401 indicate an invalid key, while 402 means you need to top up your credit.
Prompt Generation for sdxl nsfw
Use the API to generate detailed prompts for your SDXL NSFW pipelines. The uncensored model handles specific tags, anatomy descriptions, and artistic styles without filtering. You can pass a system prompt to define the model's role, ensuring consistent output for your workflow. For example, ask it to expand a simple concept into a full prompt with lighting and camera details.
The API is text-only, so it does not generate the image itself. It provides the text infrastructure that powers your generation step. This ensures your metadata and prompts remain uncensored, preserving the exact intent of your creative direction. Use the temperature parameter to control creativity; higher values yield more varied prompts.
Function Calling & Tools
Integrate structured data extraction or tool use into your pipeline. The API supports function calling, allowing you to define tools that the model can invoke. This is useful for parsing unstructured text or triggering specific actions in your script. Set tool_choice to control whether the model must use a tool or can choose freely.
Define your functions in the tools array. The model will return a response with tool calls if appropriate. This feature is available for all requests, enabling complex logic in your NSFW detection or captioning workflows. Ensure your function definitions are valid JSON to avoid parsing errors.
Streaming Responses
For real-time applications, use Server-Sent Events (SSE) to stream token-by-token responses. This reduces perceived latency and allows you to display progress as the model generates text. Streaming is enabled by setting stream: true in your request. Each chunk contains partial content, and the final chunk includes token usage statistics.
This is particularly useful for long prompt generation or script writing. You can process tokens as they arrive, building the final text incrementally. Remember that errors during streaming may still return a final chunk with error details. Handle network interruptions gracefully, as streaming connections can drop.
JSON Mode for Structured Data
Ensure consistent output for automated pipelines by using JSON mode. Set response_format to {"type": "json_object"} to force the model to return valid JSON. This is critical for parsing responses in your code without complex regex or post-processing. The model will adhere to the structure you define in your system prompt or few-shot examples.
Use this for generating metadata, extracting tags, or formatting prompts for downstream tools. JSON mode ensures reliability, reducing the chance of malformed responses breaking your pipeline. Note that JSON mode may slightly increase latency due to validation overhead. Always validate the output in your code, as the model can still produce invalid JSON in edge cases.
cURL
curl https://api.sdxlnsfw.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
from openai import OpenAI
client = OpenAI(base_url="https://api.sdxlnsfw.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
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.sdxlnsfw.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
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)