- NsfwImage Cc
- Quickstart: Integrate Uncensored Text into Your NSFW Image App
Quickstart: Integrate Uncensored Text into Your NSFW Image App
Integrate an uncensored LLM into your NSFW image pipeline for prompt generation and metadata handling. This guide covers the essential steps to connect your application to our text API using standard OpenAI-compatible SDKs.
Authentication & Base URL
To start using the API, you need an API key from the Get API key page. Authentication is handled via the standard Authorization header. The base URL for all requests is https://api.nsfwimage.cc/v1. You can use any OpenAI-compatible client by updating the base URL and providing your key. This setup ensures compatibility with existing tools used in NSFW image generation workflows.
Sending Requests to /v1/chat/completions
The core endpoint is POST /v1/chat/completions. Send your prompt context as a JSON object with the model field set to uncensored. This model is tuned to answer without content refusals for lawful adult use. The response returns generated text, which you can use as input for image generation tools or to extract metadata.
curl https://api.nsfwimage.cc/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."}]
}'Ensure your requests include the necessary headers and follow the standard chat-completions format for seamless integration into your pipeline.
Configuring JSON Mode for Structured Output
For automated NSFW image pipelines, structured output is critical. Use the response_format parameter set to {"type": "json_object"} to enforce JSON responses. This ensures predictable data structures for tool logic and post-processing. JSON mode works alongside other parameters like temperature and top_p to control creativity and format adherence. This feature is essential for parsing prompts or metadata programmatically.
from openai import OpenAI
client = OpenAI(base_url="https://api.nsfwimage.cc/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)By enforcing strict JSON output, you reduce the need for complex parsing logic in your NSFW image generation scripts.
Handling Streaming Responses (SSE)
For real-time applications, enable streaming by setting stream: true. The API returns Server-Sent Events (SSE), delivering tokens incrementally. The final chunk contains the token usage statistics for billing and monitoring. Streaming is ideal for user-facing interfaces where immediate feedback is needed during NSFW image prompt generation. It allows you to display progress without waiting for the full response.
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)Handle the stream events appropriately to update your UI or log token usage accurately.
Managing Token Limits & Context Window
The model supports a 64,000-token context window, combining prompt and completion. The maximum output per request is 16,000 tokens, or 2,048 if max_tokens is unset. This capacity is sufficient for complex NSFW image prompt engineering and metadata extraction. Monitor token usage to optimize costs, as billing is based on actual token consumption. Errors and refusals do not incur charges.
Error Handling & Token Usage
Common errors include 401 (invalid key), 402 (insufficient credit), and 429 (rate limit). The rate limit is 300 requests per minute per key. Handle these errors gracefully in your NSFW image pipeline to maintain reliability. Token usage is detailed in the final streaming chunk or response headers. Errors are free, so failed requests do not affect your prepaid credit. Use the Support page for refund issues or double charges.
Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nsfwimage.cc/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);Questions and answers
What is the uncensored model's capability for NSFW content?
The model is tuned to answer without content refusals for lawful adult, fictional, or controversial topics. It does not block standard NSFW content, making it ideal for NSFW image pipelines. However, it always refuses sexual content involving minors.
How do I pay for the API?
Payments are crypto-only, accepting USDT (TRC20) or USDC (Base). You can top up from $10 to $500, with bonus credit for larger amounts. No credit cards or PayPal are accepted. Trial credit is available for new accounts.
Is this API suitable for generating images directly?
No, this is a text-only API. It generates text for prompts, metadata, or post-processing. It does not generate images, audio, or video. Use it to power the text engine in your NSFW image generation tool.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
Get API key