Base URL and authentication
Your requests go to https://api.modelunrestricted.com/v1. Include your API key in the Authorization header. We do not require a phone number to sign up. Google or email login gives you immediate access.
curl https://api.modelunrestricted.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Generate a simple python loop"}]
}'The key is generated instantly. Keep it secure. It identifies your account and credits. Errors like 401 mean the key is wrong. Check your dashboard.
Chat completions endpoint
Send messages to POST /v1/chat/completions. This is the standard way to get text responses. Our model id is uncensored. It answers without refusing lawful adult content.
from openai import OpenAI
client = OpenAI(base_url="https://api.modelunrestricted.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)Set the model name explicitly. Use temperature for creativity. Adjust top_p for diversity. The API returns structured JSON. Parse it in your code.
Streaming responses with SSE
Enable streaming by setting stream: true. You receive tokens as they generate. This reduces perceived latency. It feels faster for users.
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)Read the final chunk for token usage. Accumulate the text locally. Handle network errors gracefully. SSE is standard in most SDKs. Use it for real-time interfaces.
Function calling and tools
Define tools in your request. The model returns structured arguments. Use tool_choice to force specific functions. This works like other OpenAI-compatible APIs.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.modelunrestricted.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);Parse the tool calls. Execute your code. Feed results back into the conversation. This enables complex workflows. Test edge cases early.
JSON mode enforcement
Set response_format to {"type": "json_object"}. The model outputs valid JSON. This is crucial for programmatic integration. Avoid parsing errors in production.
Set temperature lower for consistency. Higher values may break syntax. Validate the output schema. Retry on failure. JSON mode is reliable for structured data.
Limits, errors, and context
Our context window is 100,000 tokens total. Output maxes at 16,000 tokens. Errors and refusals cost nothing. 402 means no credit. Top up with crypto. 429 means rate limit. Wait and retry. We allow 300 requests per minute per key. Eight concurrent requests are fine. Keep your payloads under 8 MB. This ensures stability. No subscription fees apply. Credits never expire. Use the full window wisely.