EN ▾
Get API key

Quickstart for OpenAI NSFW users

Integrate our uncensored API into your existing workflow by updating three configuration lines. Our endpoint accepts standard OpenAI parameters, so your current code works with zero logic changes.

Prerequisites

To begin, you need an API key. Sign up on the Get API key page using Google or email. Your key appears immediately; no phone number is required. You also need a basic understanding of how your chosen SDK handles HTTP headers. We do not offer embeddings, image generation, or fine-tuning. This is a text-only endpoint. If your application requires multimodal inputs or model routing, this API is not the right fit. For general OpenAI usage, check the official documentation for current limits and prices, as they differ from our uncensored model.

Install SDK

Install the official library for your preferred language. The package name remains the same as the standard OpenAI client. This ensures compatibility with our openai compatible endpoint. We rely on the standard client structure, so you do not need a custom wrapper. The client handles JSON serialization, retries, and authentication headers automatically. This keeps your codebase clean and reduces the chance of integration errors when switching from a chat interface to a pure API.

Configure Client

Update your base URL and API key. Point your client to our hosted endpoint. This is the only infrastructure change required. Your existing model names or prompt structures may need slight adjustment if they rely on vendor-specific features, but standard parameters work as expected.

from openai import OpenAI

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

By changing only the base URL and key, you leverage the same SDK logic. This uncensored api responds to standard OpenAI formats. Ensure you are using the latest version of your SDK to support streaming and tool calling features properly.

Send First Request

Make a standard chat completion request. Use the model ID uncensored. The endpoint accepts standard parameters like temperature and top_p. You can send prompts up to 100,000 tokens, with no separate output cap. If you do not set max_tokens, the response can run to the end of the window. The response returns text directly. No image or audio fields are included.

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

Verify the response contains the generated text. If you receive a 401, check your key. If you get a 429, you have hit the rate limit of 300 requests per minute. This endpoint is designed for direct integration, not for browsing.

Handle Streaming

Enable streaming by setting stream: true. The API returns Server-Sent Events (SSE). Each chunk contains partial text. The final chunk includes token usage statistics. You can accumulate these chunks to build the full response in real-time. This is useful for long-form generation or interactive applications. The streaming mode works identically to the standard OpenAI client behavior.

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)

Parse the JSON in each chunk. Handle the end of the stream gracefully. Token counts are provided for transparency regarding your prepaid credit usage.

Use Function Calling

Support tools by providing a function definition in the tools parameter. Set tool_choice to auto or a specific function name. The model will return a tool call if appropriate. You must execute the function and send the result back in a subsequent message. JSON mode is also available via response_format for strict output structures. This allows for reliable data extraction or action triggering.

import OpenAI from "openai";

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

Ensure your client handles the tool call format correctly. The uncensored llm is tuned to follow instructions precisely, including complex tool definitions. This makes it suitable for agentic workflows.

Error Handling

Handle standard HTTP errors. A 401 indicates an invalid or expired key. A 429 means you exceeded 300 requests per minute or 8 concurrent requests. Check your request body size; it must be under 8 MB. Errors and refusals are free, so you are not charged for failed requests. However, if your prepaid credit is exhausted, the API will return a 402 error. You must top up via crypto to resume. Context window errors occur if the prompt plus response exceeds 100,000 tokens.

What the API supports

A quick checklist for developers: format, limits, features, billing.

ItemValue
CompatibilityOpenAI Chat Completions schema; official openai SDKs work unchanged
Modeluncensored
Base URLhttps://api.openainsfw.com/v1
AuthenticationAuthorization: Bearer YOUR_KEY
EndpointsPOST /v1/chat/completions · GET /v1/models
JSON moderesponse_format: {"type": "json_object"}
Other parameterstemperature, top_p, stop, seed and the two penalties are passed through
Completion lengthup to the rest of the 100,000-token window; max_tokens optional (no separate cap)
Function callingYes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool
Max context100,000 tokens, input and output combined
StreamingSupported (stream: true), usage included at the end
Parallel requestsup to 8 in parallel per key
Requests per minute300/min per key
HeadersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Max bodyup to 8 MB per request
Token prices$0.15 per 1M input tokens · $0.50 per 1M output tokens
Billingpay as you go from prepaid credit; nothing is charged for failed or refused requests
Subscriptionno monthly fee; paid credit does not expire
Volume bonus+5% on $50+, +10% on $100+, +15% on $200+
Top-upUSDT (TRC20) or USDC (Base), any whole amount from $20 to $500
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
Sign-inGoogle or e-mail and password
Key managementone key per account, regenerate any time (the old one stops working)
Content policyuncensored for adults; the only hard rule: no sexual content involving minors

Errors and what to do

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_foundonly /v1/chat/completions and /v1/models exist
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyslow down: rate or parallel limit reached
503upstream_busytemporary overload, retry shortly

Questions and answers

What happens if I exceed the 100k context window?

The API will return an error indicating that the input is too long. The limit includes both the prompt and the completion tokens. Ensure your prompt size leaves enough room in the window if you plan to generate long responses.

Is the 402 error always related to credit exhaustion?

Yes. If you receive a 402 status code, it means your prepaid balance is insufficient for the request. Errors and refusals do not consume credit, so a 402 specifically indicates a lack of funds. You can top up via USDT or USDC to restore access.

Does the last streaming chunk contain the total token count?

The last chunk includes token usage information. While it provides usage data, it may not represent the absolute total if the stream is interrupted. The data is provided for transparency and billing accuracy, but always verify the final count via the API response headers if precise accounting is critical.

Your key is one form away

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

Get API key