Start now
per 1M input tokens
$0.15
Output tokens / 1M
$0.50
token context
100,000
trial credit
$0.50
requests per minute
300

Quickstart: Integrate the Uncensored API

Drop our uncensored API into your existing code. Change one base URL and keep your logic.

Prerequisites: SDK and Environment Setup

Install the official SDK for your language. We support any openai compatible client. Our service acts as a drop-in replacement for standard OpenAI integrations.

Set your environment variable immediately. This avoids hardcoding credentials in your source files. Your API key identifies your account and tracks usage.

Use the standard library version. Most developers already have these installed. If not, add the package to your dependencies.

Authentication: Setting the API Key

Pass your key via the Authorization header. We require a Bearer token for every request. This method is standard across all OpenAI-compatible endpoints.

Generate your key from the dashboard. You receive one active key per account. Replacing it invalidates the previous one instantly.

Keep your key secure. Do not expose it in client-side code. Our endpoint validates credentials before processing tokens.

Endpoint: POST /v1/chat/completions

Send your prompt to the chat endpoint. Use the model field set to uncensored. This ensures the request routes to our specific model.

Streaming Responses via SSE

Enable streaming by setting stream: true. You receive chunks as they generate. This reduces perceived latency for long outputs.

Parse the Server-Sent Events format. Each chunk contains partial text. Aggregate these chunks to reconstruct the full response.

Monitor token usage in the final chunk. The last event includes the complete usage statistics. This helps you track costs accurately.

Function Calling and Tool Usage

Define tools in your request body. The model returns structured arguments. Parse these arguments in your application logic.

Supports standard tool definitions. Use tool_choice to force specific behavior. This works with any OpenAI-compatible SDK.

Validate the output format. Ensure your code handles missing arguments gracefully. The model may omit fields if not required.

JSON Mode and Structured Outputs

Set response_format to json_object. The model returns strictly formatted JSON. This eliminates parsing errors for structured data.

Define your schema clearly. The model follows your instructions precisely. Use this for data extraction or configuration generation.

Handle JSON parse errors. Invalid structures still occur occasionally. Implement fallback logic for robust applications.

Error Handling and Rate Limits

Handle HTTP status codes appropriately. A 401 error means your key is invalid. A 402 error indicates insufficient credit. A 429 error signals rate limiting.

Respect the 300 requests per minute limit. You can send 8 concurrent requests. Exceeding these limits returns a 429 error. Wait before retrying.

Your context window is 100,000 tokens. This includes both input and output. Manage your token budget carefully. Max output is 16,000 tokens per request. Errors do not consume credit.

cURL

curl https://api.alternativeapiopenai.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List the primary functions in this module"}]
  }'

Python

from openai import OpenAI

client = OpenAI(base_url="https://api.alternativeapiopenai.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.js

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.alternativeapiopenai.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

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)

Common questions

Is this a true OpenAI API alternative?

Yes, it follows the OpenAI protocol exactly. You only change the base URL and model name. Your existing code works without modification.

What is the context window limit?

The context window is 100,000 tokens total. This includes both your input and the model's output. The maximum output per request is 16,000 tokens.

How do I handle rate limits?

You are limited to 300 requests per minute. You can have 8 concurrent requests. If you exceed this, you receive a 429 error. Wait briefly before retrying.

Key generation requires just a form

Sign up, copy your key, and update your base URL. That is all configuration required.