Authentication and Base URL
Start by configuring your client to point at our infrastructure. Use https://api.uncencom.com/v1 as your base URL and pass your API key in the Authorization header. This setup works with any standard OpenAI-compatible SDK.
curl https://api.uncencom.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "What is the capital of France"}]
}'Authentication failures return a 401 status if the key is invalid. Ensure you copy the key immediately after signup, as it is shown only once.
Chat Completions Endpoint
Interact with the model by sending POST requests to /v1/chat/completions. The model ID is uncensored, and it responds with text based on your system and user prompts. This endpoint handles all standard chat interactions without extra complexity.
from openai import OpenAI
client = OpenAI(base_url="https://api.uncencom.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)The API returns structured JSON containing the generated text. You can adjust behavior using parameters like temperature and top_p to control creativity and determinism.
Streaming Responses (SSE)
For lower latency, enable streaming by setting stream: true in your request. The server sends Server-Sent Events (SSE) with incremental token updates. This allows your application to display output progressively.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.uncencom.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 is efficient for long outputs. The final chunk includes total token usage statistics, helping you track costs in real-time. Use this mode for chat interfaces where immediate feedback matters.
Function Calling and Tools
The API supports structured tool definitions for function calling. Define tools in your request, and the model can return structured arguments for execution. Use tool_choice to enforce specific behaviors or allow the model to decide.
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)Tool responses are handled via the standard conversation history. This enables complex workflows where the model generates data for your code to process. Combine this with streaming for responsive dynamic applications.
JSON Mode and Parameters
Ensure deterministic output by using response_format: {"type": "json_object"}. This forces the model to return valid JSON, which is essential for programmatic integration. You can also set seed for reproducible results.
Adjust parameters like presence_penalty and frequency_penalty to refine text style. These controls help reduce repetition and improve coherence in generated content.
Token Limits and Costs
Each request supports a context window of 100,000 tokens, combining prompt and completion. The maximum output per request is 16,000 tokens, or 2,048 if max_tokens is omitted. Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens.
Rate limits allow 300 requests per minute per key. If you exceed limits, you receive a 429 error. Errors and refusals are free, so you only pay for successful token generation.