API Documentation
Get started with our uncensored LLM API in minutes. This guide covers authentication, endpoints, streaming, and parameters for your unrestricted AI projects.
Authentication and Base URL
Your API key authenticates every request. Use the base URL https://api.modelsaiunrestricted.com/v1 for all calls. Generate your key on the Get API Key page via Google or email. The system rejects invalid keys with a 401 error. Keep your key secure.
Chat Completions Endpoint
Send messages to the uncensored model via POST /v1/chat/completions. This endpoint handles text input and returns text output. It is fully OpenAI compatible.
from openai import OpenAI
client = OpenAI(base_url="https://api.modelsaiunrestricted.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)Use the official OpenAI SDK or any compatible client. Set the model ID to uncensored. The context window supports 100,000 tokens total. Max output is 16,000 tokens per request. Errors and refusals consume no tokens.
Streaming Responses
Receive tokens in real-time using Server-Sent Events (SSE). Enable streaming by setting stream: true in your request. This reduces perceived latency for long responses.
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)The final chunk contains the complete token usage statistics. Parse the stream to display tokens as they generate. This is ideal for chat interfaces. Buffer the output if you need to assemble the full text later.
Parameters: Temperature & Top P
Control creativity with temperature and diversity with top_p. Lower values make outputs more deterministic. Higher values introduce more variation.
Default temperature is 1.0. Default top_p is 0.9. Adjust these for roleplay or factual tasks. You can also set seed for reproducible results. Use stop sequences to halt generation early.
Invalid parameters return a 400 error. Check the schema for valid ranges.
Function Calling & JSON Mode
Use structured outputs for reliable data extraction. Enable JSON mode with response_format: {"type": "json_object"}. The model returns strictly valid JSON. This prevents parsing errors in your code.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.modelsaiunrestricted.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);Define tools in the tools parameter. Use tool_choice to force specific functions. This works alongside standard chat completions. Combine streaming with function calling for dynamic apps.
Limits, Errors & Context
Rate limits are 300 requests per minute per key. Concurrency is capped at 8 simultaneous requests. Request bodies must stay under 8 MB. Exceeding these triggers a 429 error.
Insufficient funds return a 402 error. Add crypto credit to resume. The 100,000 token context window includes both prompt and completion. Refusals for minor sexual content are free. Balance never expires.
cURL
curl https://api.modelsaiunrestricted.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the top five open source models for local inference."}]
}'Frequently asked questions
What is the base URL for the unrestricted AI API?
The base URL is HTTPS://api.modelsaiunrestricted.com/v1. It works with standard OpenAI SDKs by updating the base_url configuration. This URL handles all chat completions and model metadata requests.
How do I handle streaming responses in Python?
Set stream=True in your client request. The API returns Server-Sent Events (SSE). Parse the stream to access tokens as they generate. The final chunk includes the total token usage.
What happens if I hit the rate limit?
You receive a 429 Too Many Requests error. The limit is 300 requests per minute per key. Wait a few seconds before retrying. Concurrency is also limited to 8 simultaneous requests per key.
Secure your API key
Sign up, grab the token, update your endpoint. Done.