EN ▾
Get API key

wanapi.ccQuickstart for Wan pipelines

Quickstart for Wan pipelines

Integrate the Wan uncensored text API into your pipeline with this quickstart guide. Configure your client, send requests, and handle streaming or structured outputs with precise token pricing.

Base URL and Authentication

Start by configuring your client to point at the Wan API base URL. All requests require an API key passed in the Authorization header. You generate this key on the Get API key page using Google or email. Keep your key secure; it is the only credential needed for authentication.

The base URL is https://api.wanapi.cc/v1. This endpoint is compatible with standard OpenAI SDKs. Ensure your client library uses this base URL and attaches your key to every request header.

Sending a Completion Request

Send a POST request to /v1/chat/completions. The model identifier is uncensored. This model is open-weight and tuned to answer without content refusals for lawful adult use. It is not GPT, Claude, or any other vendor's model.

curl https://api.wanapi.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."}]
  }'

Check the response for the generated text and token usage. Errors such as insufficient credit return a 402 status. The API accepts text input and returns text output. No embeddings or vision processing occur here.

Python SDK Integration

Use the official OpenAI Python SDK or any compatible library. Set the base URL to the Wan endpoint. Initialize the client with your API key. Call the chat completions method with the uncensored model.

from openai import OpenAI

client = OpenAI(base_url="https://api.wanapi.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)

This approach simplifies header management and JSON parsing. The SDK handles the streaming or non-streaming logic if configured. Remember that this text API complements your image or video tools; it does not generate them.

Node SDK Implementation

For JavaScript environments, use the OpenAI Node SDK. Configure the baseURL and apiKey properties. Pass the model ID as uncensored.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.wanapi.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);

The SDK provides promise-based responses. You can extract the content from the choices array. This method is suitable for server-side processing or edge functions where you need reliable text generation without vendor lock-in.

Streaming Responses with SSE

Enable streaming by setting stream: true in your request. The API returns Server-Sent Events (SSE). Each chunk contains partial text. Token usage details appear in the final chunk.

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 to build the final response incrementally. This reduces perceived latency for long outputs. The context window supports up to 100,000 tokens total, so streaming helps manage memory for long conversations.

Limits, Errors, and Context

Rate limits are 300 requests per minute and 8 concurrent requests per key. If you exceed this, you receive a 429 error. Authentication failures return 401. Payment issues return 402. The request body must be under 8 MB.

The context window is 100,000 tokens for prompt plus completion. Set max_tokens explicitly to cap the output; otherwise, the response can run to the end of the window. Errors and refusals do not consume credit. No card is needed for the $0.50 trial, but top-ups require crypto.

Specs at a glance

Use this table to decide whether the API fits your project before you buy credit.

ItemValue
CompatibilityOpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key
Base URLhttps://api.wanapi.cc/v1
EndpointsPOST /v1/chat/completions · GET /v1/models
API keyBearer token in the Authorization header
Modeluncensored
Tools / tool callsSupported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages
JSON moderesponse_format: {"type": "json_object"}
Completion lengthprompt + completion fit within 100,000 tokens; max_tokens optional, no separate output cap
Max context100,000 tokens, input and output combined
Sampling parameterstemperature, top_p, stop, seed, presence_penalty, frequency_penalty
SSE streamingYes — server-sent events; the last chunk carries token usage
Max body8 MB request body
Rate limit300 requests per minute per key
Response headersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Concurrencyup to 8 in parallel per key
Trial credit$0.50 for 7 days, no card · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up
How you payprepaid credit, charged by real token usage; errors and refusals are free
Token prices$0.15 per 1M input tokens · $0.50 per 1M output tokens
Subscriptionno monthly fee; paid credit does not expire
Top-upcrypto: USDT on TRON or USDC on Base, $20–$500, any whole sum
Bonus credit+5% from $50, +10% from $100, +15% from $200
Keysone key per account, regenerate any time (the old one stops working)
AccountGoogle or e-mail and password
Contentuncensored for adults; the only hard rule: no sexual content involving minors

Error codes

Errors come back as JSON with a stable type; failed and refused requests are not billed.

CodeTypeMeaning
400bad_requestmalformed request or too long for the context window
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_blockedrefused by the content policy
404not_foundunknown endpoint
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyover 300/min or 8 parallel — back off and retry
503upstream_busymodel busy — retry in a few seconds

Questions and answers

What is the context window size?

The context window is 100,000 tokens for the combined prompt and completion. There is no separate output cap, and if you do not set the max_tokens parameter, the response can run to the end of the window.

How do I pay for the API?

You top up prepaid credit by crypto (USDT on TRC20, USDC on Base). Minimum top-up is $20. Credit never expires. Errors and refusals are free.

Is the model uncensored?

Yes, the uncensored model answers without refusals for lawful adult, fictional, or controversial topics. The only hard limit is content involving minors, which is always blocked.

Your key is one form away

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

Start with trial credit

Email and password, key on screen right away.