OpenAI-compatible API reference
This quickstart guide shows how to integrate our uncensored LLM into your application using standard OpenAI SDKs. You will authenticate with a key, send requests to our base URL, and handle streaming responses with zero configuration changes.
Authentication and base URL setup
Start by retrieving your API key from the dashboard. Use the MISTRALNSFW_API_KEY header for every request to our base URL at https://api.mistralnsfw.com/v1. This works with any OpenAI-compatible client because we follow the standard schema.
The /v1/chat/completions endpoint
Send a POST request to /v1/chat/completions with your model ID set to "uncensored". The endpoint accepts standard parameters like temperature and stop. You pay only for tokens used, with input at $0.15 per 1M tokens and output at $0.50 per 1M tokens.
curl https://api.mistralnsfw.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the top ten python libraries for data science"}]
}'
Python SDK integration
Install the official openai package and point it to our base URL. Set the model to "uncensored" to access the uncensored generation capabilities. This approach lets you reuse existing code with minimal changes to your project structure.
from openai import OpenAI
client = OpenAI(base_url="https://api.mistralnsfw.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)
Node SDK integration
Use the Node.js SDK to initialize the client with the correct base URL and API key. Define your messages array and call the chat.completions.create method. This setup ensures compatibility with standard tools while delivering the specific uncensored model behavior you need.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.mistralnsfw.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);
Streaming responses and token usage
Enable streaming by setting stream: true in your request. The server returns chunks via Server-Sent Events (SSE). The final chunk contains the total token usage for the request, allowing you to track costs accurately in real-time.
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)
Rate limits and request constraints
Each key is limited to 300 requests per minute and 8 concurrent requests. The maximum context window is 100,000 tokens, with a max output of 16,000 tokens per request. Errors like 401 (invalid key), 402 (no credit), and 429 (rate limit) are standard HTTP responses.
Common questions
How do I get started with the mistral NSFW API?
Create an account and retrieve your API key from the dashboard. Point your OpenAI-compatible client to our base URL and set the model to "uncensored". You can start with the $0.50 trial credit to test the endpoint immediately.
What happens if I hit the rate limit?
You will receive a 429 status code. The limit is 300 requests per minute per key with a maximum of 8 concurrent requests. You can generate a new key to replace the old one if needed, as each account allows one active key at a time.
Is this service an official Mistral product?
No, we are an independent provider running our own uncensored model. We are not affiliated with Mistral AI, though our API is compatible with their ecosystem. The model is tuned for uncensored generation and is not the same as the official Mistral models.
Get your API key now
Register, copy the key, update the base URL. That is all.