EN ▾
Try with trial credit

Quickstart: Uncensored AI API

Start generating uncensored text immediately with our OpenAI-compatible API. This quickstart guides you from authentication to streaming responses in minutes.

Table of contents
  1. Base URL and Authentication
  2. First Request: Chat Completions
  3. Node.js Integration
  4. Streaming and Token Usage
  5. Parameters: Control and Reproducibility
  6. Rate Limits, Errors, and Constraints

Base URL and Authentication

Use the dedicated base URL and your API key for every request. Our uncensored LLM API requires no complex proxy routing, just standard headers. You receive a single key upon signup via Google or email. This key authenticates all interactions with the model. Errors and refusals do not consume credit. You start with $0.50 trial credit valid for 7 days. Your prompts remain private and are not used for training.

curl https://api.uncensoredaicode.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "list all files in the src directory"}]
  }'

First Request: Chat Completions

Send a POST request to the chat completions endpoint. This is the core interaction for text generation. Specify the model ID as "uncensored" in the body. You can adjust parameters like temperature or top_p. The API returns a text response directly. There are no embeddings or image generation features. This is a pure text-in, text-out service. Keep your requests under 8 MB. The context window supports 100,000 tokens total.

from openai import OpenAI

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

Integrate directly using the official Node SDK or any compatible client. Set the base URL to our API endpoint. Pass your API key in the authorization header. The model ID remains "uncensored" for all calls. You can stream results or fetch them synchronously. Function calling is supported via the tools parameter. Use JSON mode for structured outputs. This setup eliminates vendor lock-in. Your code stays simple and robust.

import OpenAI from "openai";

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

Enable streaming by setting stream to true. You receive chunks via Server-Sent Events. Each chunk contains partial text and usage data. The final chunk includes total token counts. This allows real-time display of generated text. It reduces perceived latency for users. You can abort the stream if needed. The API calculates costs based on actual tokens. Errors do not incur charges. Monitor your credit balance via the models endpoint.

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)

Parameters: Control and Reproducibility

Fine-tune responses using standard parameters. Set temperature for creativity or determinism. Use top_p for nucleus sampling. Define a seed for reproducible outputs. Specify stop sequences to halt generation. Presence and frequency penalties adjust word repetition. These tools give you precise control. The model handles complex prompts well. JSON mode ensures valid structure. Function calling allows external tool use. Adjust these values to fit your use case.

Rate Limits, Errors, and Constraints

Expect specific limits based on your key. You can send 300 requests per minute. Only 8 requests run simultaneously. A single key is active per account. Replace it if needed. Handle 401 errors for invalid keys. Address 402 errors by topping up with crypto. 429 indicates rate limit saturation. The max output is 16,000 tokens per request. Set max_tokens explicitly to avoid defaults. Credit never expires. Errors are free. Use the models endpoint to check status.

Common questions

What is the uncensored AI code base URL?

The base URL is HTTPS://api.uncensoredaicode.com/v1. Use this for all OpenAI-compatible SDKs. Change the base_url in your client configuration. This connects you directly to the uncensored model without intermediaries.

How do I handle errors and rate limits?

Handle 401 errors by verifying your API key. Resolve 402 errors by topping up with USDT or USDC. 429 errors mean you hit the 300 requests per minute limit. Wait and retry, or use multiple keys if needed. Errors do not consume your credit.

Which payment methods do you accept?

Crypto only: USDT on TRC20 or USDC on Base, any whole amount from $20 to $500. Bonus credit applies from $50.

Retrieve your API key

Register an account, copy the key, update your base URL. That is all.