Quickstart for Nanbeige users
Integrate our uncensored API in five minutes using standard OpenAI-compatible clients. Configure the base URL, send your first request, and handle streaming or tools with zero vendor lock-in.
Configure Base URL
The quickest way to start is updating your client configuration. Our service exposes a standard /v1 endpoint compatible with most OpenAI SDKs. You only need to change the base_url and provide your API key. There is no special client required.
- Base URL:
https://api.nanbeige.cc/v1 - Model ID:
uncensored - Auth: Pass your key in the
Authorization: Bearer <key>header.
This approach strips away multi-model routing complexity. You are connecting directly to our hosted model without enterprise dependencies. If you switch providers later, only the base URL and key change. Your integration code remains stable.
Send a Basic Request
Test connectivity with a simple text completion. This confirms your authentication and token limits are active. The model returns text responses for lawful adult content, security research, and controversial topics without standard refusals.
Use the POST method against the chat completions endpoint. Pass the model identifier and your message content. The API returns standard JSON structures that your application can parse immediately.
curl https://api.nanbeige.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."}]
}'If you receive a 401 error, verify your key. A 402 indicates insufficient prepaid credit. A 429 means you have hit the rate limit of 300 requests per minute.
Python SDK Integration
Python developers can use the official openai package. Set the base_url to our endpoint and initialize the client. This allows you to use familiar methods like chat.completions.create().
The SDK handles serialization automatically. You can pass parameters like temperature and top_p to control randomness. The model id is always uncensored. No additional configuration is needed for the text-in, text-out flow.
from openai import OpenAI
client = OpenAI(base_url="https://api.nanbeige.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 method works for both simple prompts and complex multi-turn conversations. Keep your API key secure in environment variables. The SDK supports both synchronous and asynchronous patterns.
Node SDK Setup
Node.js developers can achieve the same result with the openai npm package. Import the client and configure the base URL. This ensures compatibility with existing OpenAI codebases.
Define your messages array and send the request. The response includes token usage statistics and the generated text. You can adjust the max_tokens parameter to control output length.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.nanbeige.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);Remember that the context window is 100,000 tokens total. Plan your prompt and completion sizes accordingly. If you do not set max_tokens, the response can run to the end of the window.
Handle Streaming
For real-time user experiences, enable streaming by setting stream: true. The API returns data in Server-Sent Events (SSE) format. Each chunk contains a portion of the response.
Process chunks as they arrive. This reduces perceived latency for long answers. The final chunk includes token usage details for billing verification. Errors during streaming are delivered as standard JSON error objects.
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)Streaming is ideal for chat interfaces and code generation tools. It allows users to see progress immediately. Ensure your client handles partial responses gracefully. The uncensored model supports streaming just like standard commercial APIs.
Limits, Errors, and Context
Understand your operational boundaries. Each account allows one active API key; generating a new key replaces the old one. The request body limit is 8 MB. You can have up to 8 concurrent requests per key.
The context window is 100,000 tokens, combining prompt and completion. If you exceed this, the API returns an error. Token usage is charged per 1M tokens. Input tokens cost $0.15 per million; output tokens cost $0.50 per million.
Error codes include 401 for invalid keys, 402 for insufficient funds, and 429 for rate limits. Errors and refusals are free. Prepaid credit never expires, so you can top up by crypto (USDT on TRC20, USDC on Base) when needed.
Technical reference
If your tool speaks the OpenAI API, these are the details that matter.
| Spec | Value |
|---|---|
| Protocol | OpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key |
| Authentication | Bearer token in the Authorization header |
| Model | uncensored |
| Endpoints | POST /v1/chat/completions · GET /v1/models |
| Base URL | https://api.nanbeige.cc/v1 |
| Context window | 100,000 tokens, input and output combined |
| SSE streaming | Yes — server-sent events; the last chunk carries token usage |
| Completion length | prompt + completion fit within 100,000 tokens; max_tokens optional, no separate output cap |
| Sampling parameters | temperature, top_p, stop, seed and the two penalties are passed through |
| Tools / tool calls | Yes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool |
| JSON mode | JSON object mode via response_format json_object |
| Response headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Requests per minute | 300/min per key |
| Concurrency | 8 requests at the same time per key |
| Request size | up to 8 MB per request |
| Trial credit | $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 |
| How you pay | pay as you go from prepaid credit; nothing is charged for failed or refused requests |
| Volume bonus | +5% from $50, +10% from $100, +15% from $200 |
| Token prices | input $0.15 / 1M tokens, output $0.50 / 1M tokens |
| Payment | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| Credit expiry | no monthly fee; paid credit does not expire |
| Account | Google or e-mail and password |
| Content | uncensored for adults; the only hard rule: no sexual content involving minors |
| Key management | one key per account, regenerate any time (the old one stops working) |
Error codes
Errors come back as JSON with a stable type; failed and refused requests are not billed.
| Code | Type | Meaning |
|---|---|---|
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 | check the Authorization header or use your current key |
402 | no_credit | out of credit; add credit and retry |
403 | content_blocked | refused by the content policy |
404 | not_found | only /v1/chat/completions and /v1/models exist |
413 | request_too_large | body over 8 MB |
429 | rate_limited · concurrency | slow down: rate or parallel limit reached |
503 | upstream_busy | temporary overload, retry shortly |
Questions and answers
How do I pay for the API?
Payments are accepted by crypto (USDT on TRC20, USDC on Base). You can top up with any whole amount between $20 and $500. Credit is charged based on real token usage, and unused balances never expire. PayPal is not accepted.
What is the context window limit?
The model supports a 100,000-token context window, which includes both the prompt and the completion. There is no separate output cap, and if you do not specify a max_tokens value the response can run to the end of the window. Requests exceeding the context window will fail.
Is this the same as OpenAI's API?
It is OpenAI-compatible in format but uses a different model. You are not using GPT-4 or GPT-3.5; you are using our independent uncensored model identified by the ID uncensored. The endpoint structure matches OpenAI, allowing you to swap the base URL and key without changing your code.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
On this page
- Configure Base URL
- Send a Basic Request
- Python SDK Integration
- Node SDK Setup
- Handle Streaming
- Limits, Errors, and Context
Start with trial credit
Email and password, key on screen right away.