Integration Guide for Developers
Get your uncensored LLM API working in minutes with this quickstart guide. We provide an OpenAI-compatible endpoint so you can drop our SDK into your existing code with minimal changes.
Authentication and Base URL setup
Start by generating your API key on the dashboard. The base URL is HTTPS://api.apiaicheap.com/v1. Send your key in the Authorization header as a bearer token.
- Click "Get API key" and sign in with Google or email.
- Copy the key immediately; it is shown only once.
This key authenticates all requests to the chat completions endpoint.
Example Header
Authorization: Bearer YOUR_API_KEY
First request with cURL
Send a basic chat completion to test your setup. Use the POST /v1/chat/completions endpoint with the model "uncensored".
This confirms your credit balance and latency.
- Set the role to "user".
- Keep the message simple for the first test.
Check the response for a generated text field.
- Look for the "content" value.
If you get a 200 OK, your integration is working.
curl https://api.apiaicheap.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Fix the null pointer in the login handler"}]
}'
Python SDK integration
Use the official OpenAI Python library for easy integration. Point it to our base URL and set your API key.
This approach handles retries and JSON parsing automatically.
- Install the library via pip.
- Set the base_url parameter to our endpoint.
Call the chat.completions.create method.
Pass your messages list as an argument.
- Include the model name "uncensored".
Access the response text via the object's attributes.
This method is clean and readable for production scripts.
from openai import OpenAI
client = OpenAI(base_url="https://api.apiaicheap.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 SDK setup
The Node.js SDK works similarly to the Python version. Initialize the client with your key and our base URL.
This allows you to use familiar async/await patterns.
- Import the OpenAI package.
- Configure the base URL in the constructor.
Create a completion request with your messages.
Handle the promise to get the result.
- Extract the message content from the response.
Log the output to verify the model responds correctly.
This setup is ideal for web servers and backend services.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.apiaicheap.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 responses with SSE
Enable streaming by setting stream to true in your request. The API returns chunks as they are generated via Server-Sent Events.
This reduces perceived latency for users in chat apps.
- Set stream: true in the payload.
- Process each chunk as it arrives.
Combine the chunks to form the final response.
Token usage details appear in the last chunk.
- Check the "usage" field in the final chunk.
This approach keeps the user interface responsive during long generations.
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)
Limits, errors, and context window
Your account has a 300 requests per minute limit per key. The context window supports 100,000 tokens total for prompt and completion.
Errors are handled with standard HTTP status codes.
- 401 indicates an invalid or missing API key.
- 402 means your prepaid credit is exhausted.
- 429 signals you have exceeded the rate limit.
Refusals do not cost credit. Errors are free too.
Max output is 16,000 tokens per request. Set max_tokens if you need less.
This structure ensures predictable billing and performance.
Common questions
Is the API key generated instantly?
Yes. Once you sign in with Google or email, your key is displayed immediately. No phone number verification is required.
What happens if I exceed the rate limit?
You will receive a 429 Too Many Requests error. Wait a few seconds before retrying. You can create a new key to increase your concurrent request capacity.
Does the API support streaming?
Yes. Set the stream parameter to true to receive Server-Sent Events. Token usage is included in the final chunk of the stream.
Get your API key now
Sign up, grab the key, update your base URL. That is all there is to it.