First request in five minutes
Integrate uncensored text generation into your application using our OpenAI-compatible API. This guide covers authentication, request formats, streaming, and cost calculations for the MiniMax NSFW API.
Authentication and Base URL
Our API follows the standard OpenAI interface, meaning you can use existing SDKs with minimal changes. The base URL for all requests is https://api.minimaxnsfw.cc/v1. You authenticate using a Bearer token in the Authorization header. You can generate your key instantly via Google sign-in or email on the Get API key page. Each account holds one active key; generating a new one revokes the previous. Trial accounts receive $0.50 valid for 7 days, while paid accounts use prepaid credit that never expires.
Auth Header: Authorization: Bearer YOUR_API_KEY
Sending Requests to /v1/chat/completions
Send text prompts to the uncensored model using the standard chat completions endpoint. The model is tuned to answer without content refusals for lawful adult use. You can control behavior using parameters like temperature, top_p, and stop. The base URL is https://api.minimaxnsfw.cc/v1. Ensure your client points to this host instead of the default OpenAI endpoint.
Endpoint: POST /v1/chat/completions
Model ID: uncensored
Pricing: $0.15 per 1M input tokens, $0.50 per 1M output tokens.
Context Window: 100,000 tokens total (prompt + completion). If max_tokens is unset, the response can run to the end of the window.
Use the following curl command to send your first request:
curl https://api.minimaxnsfw.cc/v1/chat/completions
-H "Content-Type: application/json"
-H "Authorization: Bearer YOUR_API_KEY"
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Explain quantum entanglement."}],
"max_tokens": 500
}'
Python SDK Integration
Use the official openai Python library by overriding the base URL. This allows you to keep your existing code structure while switching the backend. Set the base_url to our endpoint and provide your API key. The response object behaves exactly like the standard OpenAI response, including the usage field for token accounting.
Install the library via pip install openai. Then initialize the client with our base URL.
import openai
client = openai.OpenAI(
base_url="https://api.minimaxnsfw.cc/v1",
api_key="YOUR_API_KEY"
)
response = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Write a short story about a robot."}],
max_tokens=1000
)
print(response.choices[0].message.content)
Node SDK Integration
The Node.js SDK works identically. Import the OpenAI class and configure the apiKey and baseURL. This approach is ideal for server-side applications or edge functions. You can handle errors and token usage just as you would with any OpenAI-compatible service.
Install the library via npm install openai. Then initialize the client with our base URL.
const { OpenAI } = require("openai");
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.minimaxnsfw.cc/v1"
});
async function run() {
const response = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Translate 'hello' to French." }],
max_tokens: 100
});
console.log(response.choices[0].message.content);
}
run();
Streaming Responses via SSE
Enable real-time token delivery by setting stream: true. The API returns Server-Sent Events (SSE). Each chunk contains partial content. The final chunk includes the usage data, allowing you to calculate costs accurately. This is essential for chat interfaces where users expect immediate feedback. You can parse the SSE stream in your client or server to display tokens as they generate.
const { OpenAI } = require("openai");
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.minimaxnsfw.cc/v1"
});
const stream = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Write a poem about the ocean." }],
stream: true
});
for await (const chunk of stream) {
const content = chunk.choices[0]?.delta?.content || "";
process.stdout.write(content);
}
Limits, Errors, and Context Window
Understand the constraints to avoid errors. The context window is 100,000 tokens total. If you exceed this, the API returns an error. Request body size is limited to 8 MB. Rate limits are 300 requests per minute and 8 concurrent requests per key. If you exceed these, you will receive a 429 error. Authentication errors (401) indicate an invalid or revoked key. Payment errors (402) occur when prepaid credit is exhausted. Refusals for lawful adult content are rare, but sexual content involving minors is always blocked. Errors and refusals do not consume credit.
cURL
curl https://api.minimaxnsfw.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."}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.minimaxnsfw.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)Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.minimaxnsfw.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);Streaming
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)What the API supports
The numbers below are the real limits of this API, not marketing. Compare them with what your app needs.
| Feature | Support |
|---|---|
| Protocol | OpenAI Chat Completions schema; official openai SDKs work unchanged |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Model | uncensored |
| API key | Authorization: Bearer YOUR_KEY |
| Base URL | https://api.minimaxnsfw.cc/v1 |
| Context window | 100,000 tokens (prompt + completion together) |
| JSON mode | JSON object mode via response_format json_object |
| Max output | up to the rest of the 100,000-token window; max_tokens optional (no separate cap) |
| SSE streaming | Yes — server-sent events; the last chunk carries token usage |
| Function calling | Supported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages |
| Other parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| Concurrency | 8 requests at the same time per key |
| Response headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Rate limit | 300/min per key |
| Max body | up to 8 MB per request |
| Subscription | no monthly fee; paid credit does not expire |
| 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 |
| Token prices | $0.15 per 1M input tokens · $0.50 per 1M output tokens |
| Top-up | USDT (TRC20) or USDC (Base), any whole amount from $20 to $500 |
| Billing | prepaid credit, charged by real token usage; errors and refusals are free |
| Bonus credit | +5% on $50+, +10% on $100+, +15% on $200+ |
| Key management | one key per account, regenerate any time (the old one stops working) |
| Content policy | uncensored for adults; the only hard rule: no sexual content involving minors |
| Account | sign in with Google or with e-mail + password |
Error reference
Errors come back as JSON with a stable type; failed and refused requests are not billed.
| Status | Type | Reason |
|---|---|---|
400 | bad_request | malformed request or too long for the context window |
401 | missing_key · invalid_key · key_revoked | check the Authorization header or use your current key |
402 | no_credit | balance is empty — top up, requests resume at once |
403 | content_blocked | sexual content involving minors — refused, not billed |
404 | not_found | only /v1/chat/completions and /v1/models exist |
413 | request_too_large | request body larger than 8 MB |
429 | rate_limited · concurrency | over 300/min or 8 parallel — back off and retry |
503 | upstream_busy | model busy — retry in a few seconds |
Questions and answers
Does the prepaid credit expire?
No, your prepaid credit never expires. You can top up via crypto at any time. Trial credit is valid for 7 days.
What happens if I make an error in my request?
Errors do not consume your prepaid credit. You are only charged for successful token usage. If you are double-charged, contact Support.
Can I use this API for function calling?
Yes, the API supports function calling (tools) and JSON mode. You can use the standard tools and response_format parameters in your requests.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.