OpenAI compatible api quickstart
Drop-in integration for your existing pipeline using our uncensored LLM endpoint. We provide transparent prepaid billing so you control costs without monthly overhead.
Base URL and authentication
Start by pointing your client to our openai compatible endpoint. Set the base_url variable to https://api.openaipriceapi.com/v1 and provide your key in the authorization header. You get one active key per account and no phone number is required during signup. The base URL works with the official SDKs, so you only change the URL and key to switch from other providers. Our openai price api charges for valid tokens, errors cost zero, and credit never expires. Keep your key secure because it is the only credential needed for all requests.
First chat completion request
Send a standard POST request to the chat completions endpoint. Pass the model identifier as "uncensored" and include your system and user prompts. The API returns a text response in the chosen format, typically JSON or plain text. You can adjust parameters like temperature and top_p to control creativity. The request body must stay under 8 MB to ensure smooth processing. Use the curl command below to verify connectivity and get your first response.
Python SDK integration
Use the official Python library to interact with our service. Configure the client with your base URL and API key. The SDK handles tokenization and HTTP requests automatically. You can send multiple messages in a single conversation context. The model supports a 100,000 token context window for long documents. Streaming is also available via the Python client. Use the code snippet below to initialize the client and send a message.
Node SDK usage
Integrate with Node.js using the standard npm package. Set the environment variables or pass them directly to the client constructor. The Node SDK mirrors the Python interface for consistency. You can handle errors gracefully and parse the response object. Function calling and JSON mode are supported out of the box. This approach works well for server-side applications needing reliable text generation. The following snippet shows the basic setup for your Node environment.
Handling streaming responses
Enable streaming to receive tokens as they are generated. This reduces perceived latency for long outputs. The final chunk contains the total token usage for accurate billing. You can parse the stream to update a UI in real time. The API uses Server-Sent Events for this protocol. This method is ideal for chat interfaces and live demos. Use the example below to implement a streaming client that processes tokens efficiently.
Limits, errors, and context window
Monitor your request limits to avoid interruptions. The API allows 300 requests per minute and 8 concurrent requests per key. A 401 error means your key is invalid, while 402 indicates no credit. A 429 response signals rate limiting; wait and retry. The context window is 100,000 tokens for input and output combined. Max output is 16,000 tokens unless you set a lower limit. Errors and refusals are free, so you only pay for successful tokens. This transparent billing model ensures you know exactly what you spend.
cURL
curl https://api.openaipriceapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Set timezone to UTC for log parsing"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.openaipriceapi.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.openaipriceapi.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
What is the base URL for the openai price API?
The base URL is HTTPS://api.openaipriceapi.com/v1. You must update your client configuration to use this endpoint instead of the default OpenAI URL. This ensures your requests go to our uncensored model servers.
How much does the uncensored LLM cost?
Pricing is $0.15 per 1M input tokens and $0.50 per 1M output tokens. You pay only for valid tokens with errors charged at zero. Credit is prepaid via crypto and never expires.
What is the context window size?
The context window is 100,000 tokens for the total prompt and completion. You can set a max output limit of 16,000 tokens per request. This allows for long document processing while maintaining response quality.
Get your API key in steps
Register, copy the token, update your base URL. That is the entire configuration.