API Documentation for Uncensored Chat Completions
Start using our uncensored chat completions API in minutes with standard OpenAI-compatible code. Send text prompts and receive unrestricted role-play responses without configuration overhead.
Quickstart: Connect in Python or JavaScript
Connect to the API by updating your base URL and setting your API key. The endpoint accepts standard chat-completion requests and returns text. You do not need to install custom libraries if you use the official OpenAI SDKs, as the interface matches their specification exactly.
Begin with a simple HTTP request to verify connectivity. Use the curl command below to send a basic prompt to the uncensored model. Replace YOUR_API_KEY with the key generated on your dashboard.
curl https://api.aiplayrolebest.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Set the character persona to a grumpy detective"}]
}'For Python developers, the process is nearly identical. Initialize the client with your key and the correct base URL. This ensures all requests route through our uncensored servers while maintaining compatibility with existing tooling.
from openai import OpenAI
client = OpenAI(base_url="https://api.aiplayrolebest.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)JavaScript users can achieve the same result using the Node SDK. Set the baseURL property to our endpoint. This approach allows you to integrate the API into web servers or backend services with minimal code changes.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.aiplayrolebest.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);
Authentication and API Key management
Authentication relies on a single API key passed in the header. Pass this key in the Authorization header for every request. If the key is missing or invalid, the API returns a 401 error immediately. This ensures secure access to your prepaid credit.
Generate your key on the dashboard. The key is shown once upon creation. Store it securely in your environment variables. Do not share it publicly. Each account supports one active key at a time. Generating a new key invalidates the previous one instantly.
Use the key in your requests like this: Authorization: Bearer YOUR_API_KEY. This standard header format works with all major SDKs. Keep your key handy for rapid iteration during development.
Chat Completions endpoint parameters
Send requests to the /v1/chat/completions endpoint. Include your messages array and set the model to uncensored. You can adjust parameters like temperature and top_p to control creativity. Higher values produce more varied responses.
Set max_tokens to limit output length. The default is 2,048 tokens if unspecified. The model supports a 100,000 token context window for prompt plus completion. This allows long conversations without truncation. Adjust presence_penalty and frequency_penalty to reduce repetition in role-play scenarios.
Use the stop parameter to halt generation at specific phrases. This helps enforce dialogue structure. The seed parameter ensures reproducible outputs for testing. These tools give you precise control over the model's behavior.
Streaming responses and usage data
Enable streaming by setting stream: true in your request. The API returns chunks of text as they are generated. This reduces perceived latency for end-users. Each chunk includes partial text and metadata.
Usage data appears in the final chunk. This includes input and output token counts. Check the usage field in the last response object. This allows accurate billing verification without separate API calls. Track token consumption in real-time.
Handle stream termination carefully. Ensure you process all chunks before closing the connection. The final chunk contains the complete usage statistics. This data is essential for monitoring cost and performance in production applications.
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)
Error handling and rate limits
The API enforces a limit of 300 requests per minute per key. Concurrent requests are capped at eight per key. The request body must not exceed 8 MB. Exceeding these limits returns a 429 error. Implement exponential backoff to handle transient spikes.
Common errors include 401 for invalid keys and 402 for insufficient credit. A 402 response indicates your prepaid balance is exhausted. Top up your account to resume service. Errors do not consume tokens, so retrying after fixing the issue is free.
Check the response body for detailed error messages. The API returns a JSON object with an error type and message. Use this information to debug issues quickly. Proper error handling ensures a smooth experience for your users during high-traffic periods.
JSON mode and function calling guide
Use JSON mode by setting response_format to {"type": "json_object"}. This forces the model to output valid JSON. Ideal for structured data extraction or API responses. Ensure your prompt clearly describes the desired schema.
Function calling allows the model to invoke tools. Define tools in the request body. The model returns tool calls when appropriate. Handle these calls in your application logic. This enables complex multi-step workflows.
Combine JSON mode with function calling for robust integrations. Validate JSON output on the client side. Use the tool_choice parameter to control when functions are invoked. This flexibility supports diverse application architectures. Ensure your tools are well-defined for optimal performance.
Model details and context window limits
The uncensored model supports a 100,000 token context window. This includes both the input prompt and the output completion. Max output is 16,000 tokens per request. This allows for extensive role-play scenarios without cutting off mid-sentence.
The model is open-weight and tuned for unrestricted content. It does not refuse lawful adult topics. It is not GPT, Claude, or any other vendor's model. Requests are processed on our dedicated servers. This ensures consistent performance and low latency.
Monitor context usage to stay within limits. The API tracks token usage accurately. Errors and refusals do not consume tokens. This transparent billing model helps you predict costs. Plan your context windows to maximize value.
Frequently asked questions
What is the best role play AI uncensored API for NSFW developers?
Our API provides an uncensored model tuned for adult content without refusals. It uses a prepaid billing model with transparent token pricing. This ensures you pay only for real usage without hidden fees.
How do I handle rate limits and errors?
You are limited to 300 requests per minute and eight concurrent requests. Errors like 401 or 402 do not consume tokens. Implement backoff strategies to manage rate limits effectively.
Does the API support streaming and JSON output?
Yes, streaming returns chunks with usage data in the final response. JSON mode forces valid JSON output for structured data. Both features are supported via standard parameters in the chat completions endpoint.
Get your API key
Register, copy the token, update the base URL. That is all.