Quickstart: Uncensored LLM API Integration
Drop our uncensored LLM into your existing OpenAI SDK with zero code changes. This quickstart guides you through configuration, streaming, and error handling for a true OpenAI compatible endpoint.
Install the OpenAI SDK
Start by adding the official client library to your project. This ensures compatibility with standard parameters like temperature and top_p. The library handles serialization automatically.
- Supports Python and JavaScript environments.
- Manages connection pooling efficiently.
- Remains compatible with standard OpenAI compatible API structures.
Install the package using your preferred package manager. This step prepares your environment for immediate integration.
You do not need a specific version for basic text generation. The library supports standard authentication headers seamlessly.
Configure Your Base URL
Point your client to our endpoint to bypass standard content filters. Use the base URL https://api.openaipricingapi.com/v1 for all requests. This single change redirects traffic to our uncensored LLM infrastructure.
Set your API key in the standard Authorization header. Pass the key you obtained from the dashboard. The client validates credentials before sending data.
Ensure you use the model ID uncensored for optimal performance. This identifier tells the server which model to route your request to. No other model IDs are supported.
Make Your First Chat Completion
Send a simple message to verify connectivity. Use the standard chat completion endpoint with a system prompt and user message. The response returns text directly.
Check the status code to confirm success. A 200 OK status indicates the request processed correctly. Errors return specific codes for debugging.
Review the output for accuracy. The model answers without refusing lawful adult content. Test with diverse topics to verify behavior.
Enable Streaming and Function Calling
Activate streaming to receive tokens in real-time. Set stream=True in your request. The client yields chunks as they become available. This reduces perceived latency significantly.
Access function calling by defining tools in your payload. The model returns structured arguments for execution. Parse the JSON output to trigger your backend logic.
Combine streaming with tool use for complex workflows. Handle partial responses gracefully. Ensure your code processes the final chunk for token counts.
Handle Tokens and Usage Data
Monitor token usage to manage your prepaid credit. The API charges $0.15 per 1M input tokens and $0.50 per 1M output tokens. Errors do not consume credit.
Parse the usage data from the final streaming chunk. This provides accurate input and output counts. Track costs in your application logs.
Refunds apply only to billing errors. Credit never expires once purchased. Use the usage data to predict future spending accurately.
Understand Rate Limits and Errors
Expect a 429 error if you exceed 300 requests per minute. Throttle your client to avoid interruptions. Concurrent requests are limited to 8 per key.
A 401 error indicates an invalid or missing API key. Verify your credentials in the dashboard. A 402 error means your prepaid balance is exhausted.
The context window supports 100,000 tokens total. Requests exceeding this limit return an error. Adjust your payload size accordingly to maintain performance.
cURL
curl https://api.openaipricingapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "List the hourly cost per token for the current model tier"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.openaipricingapi.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.openaipricingapi.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)Frequently asked questions
Is this a true OpenAI pricing API alternative?
Yes, our endpoint accepts standard OpenAI compatible payloads and returns standard JSON responses. You can use the official OpenAI SDKs without modifying your code structure. The pricing model differs by using prepaid credit instead of subscriptions.
What happens if I get a 402 error?
A 402 error indicates your prepaid credit balance is zero. You must top up using USDT or USDC to resume service. Errors during failed requests do not consume your credit, so you can retry safely.
How large is the context window?
The model supports a 100,000 token context window for both input and output combined. You can specify up to 16,000 tokens for a single response. Requests exceeding the limit will fail immediately.
Get your API key
Sign up, grab the key, update your base URL. That’s it.