EN ▾
Get API key

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.

API facts in one table

Everything the endpoint can and cannot do, in one place — check it before you top up.

ParameterDetails
ProtocolOpenAI Chat Completions schema; official openai SDKs work unchanged
MethodsPOST /v1/chat/completions · GET /v1/models
API keyBearer token in the Authorization header
Base URLhttps://api.wanuncensored.com/v1
Modeluncensored
Other parameterstemperature, top_p, stop, seed and the two penalties are passed through
Completion lengthprompt + completion fit within 100,000 tokens; max_tokens optional, no separate output cap
StreamingYes — server-sent events; the last chunk carries token usage
Tools / tool callsSupported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages
Structured outputresponse_format: {"type": "json_object"}
Max context100,000 tokens (prompt + completion together)
HeadersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Max bodyup to 8 MB per request
Rate limit300 requests per minute per key
Concurrency8 requests at the same time per key
Top-upUSDT (TRC20) or USDC (Base), any whole amount from $20 to $500
How you payprepaid credit, charged by real token usage; errors and refusals are free
Free trial$0.50 of credit valid 7 days, no card needed · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up
Credit expirypaid credit never expires, no subscription
Priceinput $0.15 / 1M tokens, output $0.50 / 1M tokens
Volume bonus+5% on $50+, +10% on $100+, +15% on $200+
Keysone active key per account; a new key replaces the old one
Sign-inGoogle or e-mail and password
Contentuncensored for adults; the only hard rule: no sexual content involving minors

Error codes

The type field is stable, the message is for humans. Errors cost nothing.

StatusTypeReason
400bad_requestmalformed request or too long for the context window
401missing_key · invalid_key · key_revokedcheck the Authorization header or use your current key
402no_creditbalance is empty — top up, requests resume at once
403content_blockedsexual content involving minors — refused, not billed
404not_foundunknown endpoint
413request_too_largebody over 8 MB
429rate_limited · concurrencyslow down: rate or parallel limit reached
503upstream_busymodel busy — retry in a few seconds

Questions and answers

Does this API support image or video generation?

No. This is a text-only chat-completions API. It does not generate images, audio, video, or embeddings. It is designed for text processing steps in media pipelines, such as prompt engineering or script generation.

What happens if I make a request that fails?

If a request fails due to network errors, invalid parameters, or content refusal, you are not charged for those tokens. Only successful completions consume your prepaid credit. Errors return standard HTTP status codes like 400, 401, 422, or 429.

Can I use multiple API keys for one account?

No. Each account is limited to one active API key. If you generate a new key, the previous one is immediately invalidated. This simplifies key management and ensures consistent usage tracking across your pipelines.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

Get API key