EN ▾
Get API key

First request in five minutes

Integrate our uncensored API in three lines by pointing your existing OpenAI-compatible client to our base URL and swapping the API key. This quickstart covers authentication, chat requests, streaming, and critical limits.

Base URL and Authentication

Our endpoint is fully compatible with the OpenAI API standard. You only need to change the base_url in your client configuration and provide a valid API key. Authentication uses the standard Authorization: Bearer header. Sign up on the Get API key page to receive your token immediately via Google or email. No phone number is required, and the key is displayed once after creation. If you lose it, generate a new one, which replaces the old active key.

First Request

Send a standard chat completion request to test connectivity. The model ID is always uncensored. This model runs on our own infrastructure and does not route to other vendors. It is designed for lawful adult content, creative writing, and research without standard refusals, except for content involving minors which is always blocked.

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

Verify the response structure matches OpenAI's standard JSON format. If you receive a 401 error, your key is invalid or expired. If you see a 402 error, your prepaid credit is exhausted. Errors during processing do not consume tokens, so you are only charged for successful token generation.

Python SDK Integration

Use the official openai Python library. Initialize the client with our base URL and your API key. The library handles serialization automatically. This approach works for any Python application requiring text generation. Ensure you are using a recent version of the SDK that supports custom base URLs. The client will communicate with our servers exactly as it would with OpenAI, but return responses from our uncensored model.

from openai import OpenAI

client = OpenAI(base_url="https://api.nanbeige.top/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 is ideal for backend services and data pipelines. You can pass standard parameters like temperature and top_p to control randomness. The response object contains the generated text in choices[0].message.content.

Node.js SDK Setup

Initialize the Node.js OpenAI client with our custom endpoint. This is useful for serverless functions or web backends. The configuration is identical to the Python setup: set the base URL and API key. The SDK manages the HTTP requests and JSON parsing. This ensures your code remains portable if you switch back to a different provider later.

import OpenAI from "openai";

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

Handle errors gracefully. A 429 status code indicates you have exceeded the rate limit of 300 requests per minute. Implement exponential backoff in your application logic to handle transient errors. The request body is limited to 8 MB, which is sufficient for most text-based tasks.

Streaming Responses (SSE)

Enable streaming by setting stream: true in your request. The API returns a Server-Sent Events (SSE) stream. Each chunk contains partial text and usage statistics in the final chunk. This reduces perceived latency for end-users. Streaming is supported in all SDKs. Parse the SSE stream to display text token by token.

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)

This feature is critical for chat interfaces. The final chunk includes the total token count for the request. You can use this data for billing verification if needed. Streaming does not affect the pricing model; you are still charged per token generated.

Limits, Errors, and Context

The context window is 100,000 tokens total, including both prompt and completion. There is no separate output cap, and if max_tokens is not specified, the response can run to the end of the window. Rate limits are 300 requests per minute and 8 concurrent requests per key. If you exceed these, you receive a 429 error. The model ID is uncensored. It is not a resold model from another vendor. Credit never expires, and refunds are not issued for consumed credit. Use the support page for billing errors.

Under the hood: specs

Before you integrate, here is exactly what you get with a key.

ItemValue
API formatOpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key
AuthenticationBearer token in the Authorization header
Model IDuncensored
EndpointsPOST /v1/chat/completions · GET /v1/models
Base URLhttps://api.nanbeige.top/v1
Context window100,000 tokens, input and output combined
SSE streamingYes — server-sent events; the last chunk carries token usage
Completion lengthup to the rest of the 100,000-token window; max_tokens optional (no separate cap)
Function callingSupported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages
Other parameterstemperature, top_p, stop, seed and the two penalties are passed through
JSON modeJSON object mode via response_format json_object
Parallel requestsup to 8 in parallel per key
Response headersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Request size8 MB request body
Requests per minute300/min per key
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
Token pricesinput $0.15 / 1M tokens, output $0.50 / 1M tokens
Volume bonus+5% on $50+, +10% on $100+, +15% on $200+
Subscriptionno monthly fee; paid credit does not expire
Top-upUSDT (TRC20) or USDC (Base), any whole amount from $20 to $500
Billingprepaid credit, charged by real token usage; errors and refusals are free
Sign-insign in with Google or with e-mail + password
Key managementone key per account, regenerate any time (the old one stops working)
Content policyadult content allowed; sexual content involving minors is refused

Error reference

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

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_blockedsexual content involving minors — refused, not billed
404not_foundunknown endpoint
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyslow down: rate or parallel limit reached
503upstream_busymodel busy — retry in a few seconds

Questions and answers

Is this the official Llama or DeepSeek API?

No. We host our own uncensored model on our servers. It is not a reseller of Llama, DeepSeek, or any other vendor's API. It runs a distinct open-weight model tuned for fewer refusals.

How do I top up my credit?

You can top up by crypto (USDT on TRC20, USDC on Base). Minimum is $20, maximum $500 per transaction. You receive a 5% bonus for $50+ and 10% for $100+.

What happens if I get a 402 error?

A 402 error means your prepaid credit is exhausted. No tokens were consumed for the failed request. Add more crypto credit to your account to resume service. Your existing credit never expires.

Your key is one form away

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

Get API key