EN ▾
Get API key

Uncensored API for developers

https://api.qwennsfw.com/v1

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 temperature to 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.

SpecValue
ProtocolOpenAI Chat Completions schema; official openai SDKs work unchanged
Base URLhttps://api.qwennsfw.com/v1
AuthenticationAuthorization: Bearer YOUR_KEY
MethodsPOST /v1/chat/completions · GET /v1/models
Modeluncensored
StreamingSupported (stream: true), usage included at the end
Max context100,000 tokens, input and output combined
Sampling parameterstemperature, top_p, stop, seed, presence_penalty, frequency_penalty
Tools / tool callsSupported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages
JSON modeJSON object mode via response_format json_object
Completion lengthup to the rest of the 100,000-token window; max_tokens optional (no separate cap)
Rate limit300/min per key
Request size8 MB request body
Parallel requests8 requests at the same time per key
Response headersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Top-upcrypto: 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 expiryno monthly fee; paid credit does not expire
Volume bonus+5% from $50, +10% from $100, +15% from $200
How you payprepaid credit, charged by real token usage; errors and refusals are free
Contentuncensored for adults; the only hard rule: no sexual content involving minors
Keysone key per account, regenerate any time (the old one stops working)
Sign-inGoogle 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.

HTTPTypeWhat to do
400bad_requestinvalid JSON, empty messages, bad parameter, or a prompt longer than the window — fix and resend
401missing_key · invalid_key · key_revokedno key, wrong key, or a key replaced by a newer one
402no_creditbalance is empty — top up, requests resume at once
403content_blockedsexual content involving minors — refused, not billed
404not_foundonly /v1/chat/completions and /v1/models exist
413request_too_largebody over 8 MB
429rate_limited · concurrencyover 300/min or 8 parallel — back off and retry
503upstream_busytemporary 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.

Get API keyRead the docs