Quickstart for Wan pipelines
This guide helps you integrate the wan uncensored text API into your pipeline using standard OpenAI-compatible clients. You will learn to authenticate, send requests, handle streaming, and manage limits.
Prerequisites
Before starting, ensure you have an active API key from wanuncensored.com. The service uses a standard OpenAI-compatible structure, meaning you can use any existing OpenAI SDK or HTTP client. You only need to point your client to the correct base URL: https://api.wanuncensored.com/v1. Authenticate by setting the Authorization header to Bearer YOUR_API_KEY. The model ID you must specify is uncensored. This is an open-weight model tuned for minimal refusal, not a GPT or Claude instance. Keep in mind that this API handles text only; it does not generate images, audio, or video.
Make Your First Request
Send a POST request to /v1/chat/completions with your system and user messages. The following example demonstrates a basic completion using cURL.
curl https://api.wanuncensored.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."}]
}'This request returns a JSON object containing the generated text. Remember that the model has a hard content limit: it will refuse requests involving sexual content with minors, but it remains open to other adult, fictional, or controversial topics. Errors like invalid keys (401) or insufficient credit (402) will return standard error codes without charging your prepaid balance.
Python SDK Integration
Use the official OpenAI Python library to interact with the wan uncensored API. Initialize the client with the custom base URL and your API key. This approach allows you to reuse existing codebases that were built for OpenAI, simply by changing the endpoint configuration.
from openai import OpenAI
client = OpenAI(base_url="https://api.wanuncensored.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)The Python SDK handles JSON parsing automatically. Ensure you set the model parameter to uncensored. If you encounter a 429 rate limit error, implement a retry loop with exponential backoff. The API supports up to 300 requests per minute per key, with a concurrency limit of 8 simultaneous requests.
Node SDK Integration
For JavaScript or TypeScript environments, use the openai npm package. Configure the client with the wanuncensored base URL. This is ideal for server-side post-processing or real-time script generation in web applications.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.wanuncensored.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);The Node client streams responses by default if you handle the async iterator. You can also use the standard await pattern for synchronous responses. Keep track of your token usage, as billing is based on actual input and output tokens. Errors are returned as standard OpenAI error objects, making debugging straightforward.
Streaming Responses
Enable streaming by setting stream: true in your request. The API returns Server-Sent Events (SSE), allowing you to process tokens as they are generated. This is crucial for long-form script writing or captioning where latency matters.
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)Each chunk contains partial content. The final chunk includes the total token usage for the request. Note that there is no separate output cap, and if you do not specify max_tokens, the response can run to the end of the window. Streaming helps keep your application responsive while the model processes complex prompts within the 100k context window.
Limits, Errors, and Context
The API enforces a 100,000-token context window (input + output) and an 8 MB request body. Rate limits are 300 requests per minute and 8 concurrent requests per key. If you exceed these, you will receive a 429 error. Authentication failures return 401, and billing issues return 402. Errors do not consume your prepaid credit. You can only have one active key per account; generating a new key invalidates the old one. For high-volume pipelines, consider batching requests or using function calling to manage complexity efficiently.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.