PT ▾
Get your key

OpenAI compatible API Quickstart Guide

Drop this uncensored API into any existing OpenAI-compatible client by updating your base URL and API key. The endpoint handles standard chat completions with a 100,000-token context window and zero subscription locks.

Authentication & Base URL

Set your base URL to https://api.openaicompatible.com/v1 and pass your key in the Authorization header. We require standard Bearer token authentication, which means you can swap this into Cursor, Cline, or Continue.dev by simply pointing them to this new endpoint. Generate your key via the Get API key page using Google or email, then copy it immediately since it displays only once. You cannot view it again later, so store it securely in your environment variables or client settings before proceeding.

Chat Completions Endpoint

Send requests to POST /v1/chat/completions using the model ID uncensored. This endpoint accepts standard message arrays and returns text completions without content filters. You can test connectivity with a simple curl command to verify your key works before integrating it into your larger application logic.

curl https://api.openaicompatible.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "List the top 5 python libraries for data science"}]
  }'

Remember that we do not support embeddings, audio, or image generation, so keep your payload focused on text-only interactions to avoid unnecessary latency.

Python SDK Integration

Use the official OpenAI Python client by overriding the base URL and providing your custom API key. This ensures that your existing code works without modification, leveraging the standard library for retries and error handling. Point the client to our server and set the model to uncensored to access the uncensored model capabilities.

from openai import OpenAI

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

This approach works seamlessly with tools that expect standard OpenAI behavior, allowing you to maintain your current development workflow while gaining access to our specific model features.

Node SDK Integration

Initialize the OpenAI Node.js client with the same base URL override and key configuration used in Python. This allows JavaScript and TypeScript applications to interact with our API using familiar patterns. Set the model parameter to uncensored and define your messages array to start generating text immediately.

import OpenAI from "openai";

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

The SDK handles the HTTP requests efficiently, so you can focus on parsing the response text rather than managing the underlying network calls.

Streaming & SSE Support

Enable streaming by setting stream: true in your request parameters. We support Server-Sent Events (SSE), which delivers tokens incrementally as they are generated. This is crucial for real-time applications like chat interfaces or code assistants where users expect immediate feedback. The final chunk contains the full usage statistics for billing and monitoring purposes.

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)

Handle the stream events in your client code to update the UI progressively, ensuring a smooth user experience even with longer responses.

Rate Limits, Errors & Context

Each API key is limited to 300 requests per minute and 8 concurrent connections. If you exceed these limits, you will receive a 429 status code, so implement exponential backoff in your retry logic. Context windows support up to 100,000 tokens total, with a maximum output of 16,000 tokens per request. Errors like 401 indicate an invalid key, while 402 means you need to top up your prepaid credit. All errors are free, so you only pay for successful token generation.

Common questions

How do I create an openai compatible API key for my tools?

Navigate to the <strong>Get API key</strong> page and sign in using Google or your email. The key is displayed immediately upon creation, so copy it to your clipboard before leaving the page. You can then paste this key into any OpenAI-compatible client configuration.

Is this an openai compatible API for local models?

Yes, you can point any OpenAI-compatible client to our base URL to use our hosted uncensored model. Unlike Ollama, which requires local hardware, our API allows you to access powerful models remotely without managing GPU resources or model files on your machine.

What happens if I get a 402 error?

A <code>402</code> error indicates that your prepaid credit is exhausted. You can top up your account using USDT (TRC20) or USDC (Base) for amounts between $20 and $500. Credit never expires, and you receive bonus credit for larger top-ups.

Obtain your API key in a single step

Register, retrieve your key, and update your base URL. That covers the entire configuration.

Get your keyView documentation