Quickstart for Qwen NSFW users
Swap your base URL and API key to start generating uncensored text with our OpenAI-compatible endpoint. This guide shows how to integrate the 'uncensored' model using standard SDKs.
Install Your SDK
Our API uses the standard OpenAI protocol, so you can use the official SDKs you already know. Install the package for your language of choice. This allows you to leverage existing client code for qwen nsfw style generation without writing custom HTTP handlers.
- Python:
pip install openai - Node.js:
npm install openai
Ensure your SDK version is recent enough to support streaming and JSON mode features.
Configure Base URL
Point your client to our dedicated endpoint. Change the base_url to https://api.qwennsff.com/v1 and set your API key. This replaces the standard OpenAI endpoint, allowing you to use the same client logic for uncensored outputs. Verify your credentials by checking the /v1/models endpoint.
If you are migrating from another provider, ensure your environment variables for OPENAI_API_KEY and BASE_URL are updated before running your script.
Send Your First Request
Send a standard chat completion request. The model ID is uncensored. This request will return a text response without the typical content filters found in standard models. Use this to test connectivity and response quality.
curl https://api.qwennsfw.com/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."}]
}'Check the response status code. A 200 OK confirms successful integration. If you receive a 401, verify your API key is correct. If you see a 402, your prepaid credit is exhausted.
Handle Streaming Responses
Enable streaming by setting stream: true in your request. The API returns a Server-Sent Events (SSE) stream. Each chunk contains partial text. The final chunk includes the token usage statistics for billing. This is ideal for real-time UI updates.
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)Parse the SSE events to collect the full response. Ensure your client handles potential network interruptions gracefully, as streaming connections may drop.
Enable Function Calling
Define tools in your request to enable function calling. The model supports structured tool use, allowing it to return JSON-formatted arguments. Specify tools via the tools parameter and set tool_choice to auto or a specific function. This is useful for building agents that need to interact with external APIs.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.qwennsfw.com/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);Ensure your tool definitions match the expected input schema. The model will return a tool call object if it determines a function should be invoked.
Force JSON Output
For reliable structured data, set response_format to {"type": "json_object"}. This constrains the model to output valid JSON, preventing parsing errors in your application. This is particularly useful for data extraction tasks or when feeding outputs into other systems.
- Set
temperatureto a lower value for more consistent JSON structure. - Ensure your JSON schema is well-defined to guide the model effectively.
Python
from openai import OpenAI
client = OpenAI(base_url="https://api.qwennsfw.com/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)Under the hood: specs
A quick checklist for developers: format, limits, features, billing.
| Spec | Value |
|---|---|
| Protocol | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| Base URL | https://api.qwennsfw.com/v1 |
| Authentication | Authorization: Bearer YOUR_KEY |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Model | uncensored |
| Streaming | Supported (stream: true), usage included at the end |
| Max context | 100,000 tokens, input and output combined |
| Sampling parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| Tools / tool calls | Supported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages |
| JSON mode | JSON object mode via response_format json_object |
| Completion length | up to the rest of the 100,000-token window; max_tokens optional (no separate cap) |
| Rate limit | 300/min per key |
| Request size | 8 MB request body |
| Parallel requests | 8 requests at the same time per key |
| Response headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Top-up | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| Price | $0.15 per 1M input tokens · $0.50 per 1M output tokens |
| Free trial | $0.50 for 7 days, no card · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up |
| Credit expiry | no monthly fee; paid credit does not expire |
| Volume bonus | +5% from $50, +10% from $100, +15% from $200 |
| How you pay | prepaid credit, charged by real token usage; errors and refusals are free |
| Content | uncensored for adults; the only hard rule: no sexual content involving minors |
| Keys | one key per account, regenerate any time (the old one stops working) |
| Sign-in | Google or e-mail and password |
Errors and what to do
Errors come back as JSON with a stable type; failed and refused requests are not billed.
| HTTP | Type | What to do |
|---|---|---|
400 | bad_request | invalid JSON, empty messages, bad parameter, or a prompt longer than the window — fix and resend |
401 | missing_key · invalid_key · key_revoked | no key, wrong key, or a key replaced by a newer one |
402 | no_credit | balance is empty — top up, requests resume at once |
403 | content_blocked | sexual content involving minors — refused, not billed |
404 | not_found | only /v1/chat/completions and /v1/models exist |
413 | request_too_large | body over 8 MB |
429 | rate_limited · concurrency | over 300/min or 8 parallel — back off and retry |
503 | upstream_busy | temporary overload, retry shortly |
Questions and answers
Is this the official Qwen NSFW API?
No, this is an independent service. We host our own uncensored model that is compatible with the OpenAI API format. It is not the official Qwen model from Alibaba, but it supports similar use cases for uncensored text generation.
What happens if I exceed the rate limit?
If you exceed 300 requests per minute or 8 concurrent requests, you will receive a 429 error. Your prepaid credit remains intact during these errors. Wait a moment and retry your request.
Are errors free?
Yes, errors and refusals do not consume your token credit. You only pay for successful token usage in the response. This includes cases where the model refuses a request due to the hard content limit for minors.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.