OpenAI Compatible API Quickstart
Drop your existing OpenAI-compatible code into our uncensored LLM API without rewriting your logic. This guide covers the essential setup steps for developers who need a direct, unfiltered replacement for standard model endpoints.
Prerequisites and Environment Setup
You need an API key and the correct base URL to connect your client. Sign up with Google or email on the Get API key page to receive your credential immediately. The trial gives you $0.50 for seven days, and you can top up with USDT or USDC via crypto. Keep your key secure and verify it matches your account settings.
Ensure your environment supports standard HTTP requests. Our service runs on a single uncensored model, so you do not need to manage multiple model endpoints. Set your base URL to HTTPS://api.openaiapicompatibility.com/v1 before making any calls. This ensures all requests route correctly to our tuned inference servers.
Installing the Official OpenAI SDK
Use the official SDKs to maintain compatibility with existing OpenAI workflows. The Python and Node libraries work directly with our endpoint because we follow the standard API schema. Install the package in your project directory using your preferred package manager. This approach avoids the need for custom HTTP client code.
We support standard parameters like temperature, top_p, and stop sequences. The SDK handles the JSON serialization and request headers automatically. You can swap the base URL in the client configuration to point to our servers. This allows you to switch between providers without changing your application logic.
Configuring the Base URL and API Key
Set the base URL and API key in your client configuration object. The base URL is HTTPS://api.openaiapicompatibility.com/v1. Pass your API key in the Authorization header as a Bearer token. This configuration ensures your requests are authenticated and routed to the correct service.
curl https://api.openaiapicompatibility.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "list all python packages for data science"}]
}'Verify your connection by calling the GET /v1/models endpoint. This returns a list of available models, including the uncensored model identifier. Use this step to confirm your network access and credentials are correct before sending complex prompts.
Making Your First Chat Completion Request
Send a POST request to /v1/chat/completions with your prompt messages. Define the model as uncensored to access the unfiltered inference engine. Include your system prompt to set the behavior, and add user messages for the content you want generated.
from openai import OpenAI
client = OpenAI(base_url="https://api.openaiapicompatibility.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 response contains the generated text and token usage statistics. You can adjust parameters like temperature to control creativity. The model does not refuse lawful adult or controversial topics, making it suitable for diverse use cases. Check the response object for the content field to access the output.
Streaming Responses with SSE
Enable streaming by setting the stream parameter to true in your request. This sends partial responses as Server-Sent Events (SSE). It improves the user experience by showing text as it is generated.
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)Each chunk contains a delta of the response. Accumulate these deltas to reconstruct the full text. The final chunk includes the total token usage for the request. This method works with any standard SSE client or library. It reduces perceived latency for long-form content generation.
Handling JSON Mode and Function Calling
Use JSON mode by setting response_format to json_object. This forces the model to output valid JSON instead of free text. It is useful for structured data extraction or API responses. Combine this with function calling for tool use scenarios.
Define your tools in the tools array. Specify the function name, description, and parameters. The model will return the function call details in the response. You can then execute the function and send the result back to the model. This enables complex multi-step workflows with the uncensored model.
Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.openaiapicompatibility.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);FAQ
Does this API support OpenAI API compatibility for existing clients?
Yes, our service is fully compatible with the OpenAI API schema. You can use the official OpenAI SDKs by changing the base URL and API key. This allows you to swap in our uncensored model without rewriting your code.
What are the token limits and context window size?
The context window is 100,000 tokens for both prompt and completion combined. The maximum output per request is 16,000 tokens, or 2,048 if you do not set max_tokens. Requests exceeding these limits will return an error.
How do I handle rate limits and errors?
You are limited to 300 requests per minute and 8 concurrent requests per key. A 401 error indicates an invalid or missing API key. A 402 error means you have insufficient credit, and a 429 error signals that you have exceeded the rate limit.
Get your key via sign-up
Sign up, copy the key, update the base URL. That is all.