Quickstart: Connect your client
Connect your existing tools to our uncensored LLM in minutes using the standard OpenAI compatible API format. This quickstart covers authentication, request structure, and streaming for immediate integration.
Prerequisites and SDK Installation
Install the official SDK for your language to handle authentication and request serialization automatically. You need a valid API key and the base URL configured in your client environment. Our service accepts standard parameters like temperature and top_p without requiring custom headers.
Ensure your environment variable holds your token securely before running any scripts. The SDK versions must be current to support streaming and JSON mode features correctly. No additional drivers are required for text-only generation.
Configuring Base URL and Key
Point your client to our specific base URL to route requests through our uncensored infrastructure. Use the header Authorization: Bearer YOUR_KEY to authenticate every call. This setup works identically for local testing or production deployment scripts.
Replace the default OpenAI endpoint with our host to avoid confusion with other providers. Keep your key secret and do not expose it in public repositories. The configuration remains static until you rotate your key.
Sending Your First Request
Execute a standard chat completions call to verify connectivity and response format. Send a simple prompt to confirm the model returns text without refusal. This test ensures your key has sufficient prepaid credit for usage.
curl https://api.keyapiminimax.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Generate a JSON object with keys id and name"}]
}'Check the response for content and token usage details. If you receive a 401 error, verify your key format. A 402 indicates you need to top up your credit balance.
Handling Streaming Responses
Enable streaming to receive tokens in real-time as they are generated. This reduces perceived latency for users waiting for long outputs. The last chunk contains the final token counts for billing accuracy.
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 partial responses gracefully in your client code. Buffer the content until the stream closes or an error occurs. Streaming works with all standard parameters including temperature adjustments.
Python SDK Integration
Use the Python library to manage requests with minimal boilerplate code. Initialize the client with your base URL and key for immediate use. This approach simplifies error handling and response parsing.
from openai import OpenAI
client = OpenAI(base_url="https://api.keyapiminimax.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)Access the generated content directly from the response object. Check for errors and handle rate limits appropriately. The SDK supports both synchronous and asynchronous workflows.
Node SDK and Limits
Integrate with Node.js applications using the official JavaScript SDK. Set the base URL to ensure requests reach our uncensored endpoint. Monitor your usage to stay within rate limits.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.keyapiminimax.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);You can make 300 requests per minute with a concurrency of 8. Each request body must stay under 8 MB. The context window supports 100,000 tokens total. Errors and refusals do not consume credit, but successful outputs do. Keep your key secure and rotate it if needed.
Understanding Token Usage
Billing is based on actual tokens used in the prompt and completion. Input tokens cost $0.15 per million, while output tokens cost $0.50 per million. Prepaid credit covers all usage without monthly fees.
Errors and refusals are free, so you only pay for successful responses. The last chunk in a stream contains the token count. Monitor your dashboard to track spending and avoid running out of credit. Top up with USDT or USDC for instant access.
Frequently asked questions
What is the context window size for requests?
The total context window is 100,000 tokens, combining both the prompt and the completion. The maximum output per request is 16,000 tokens, or 2,048 if you do not specify max_tokens.
How do I handle rate limits and errors?
You are limited to 300 requests per minute and 8 concurrent requests per key. A 401 status means your key is invalid, while a 402 indicates insufficient credit. A 429 error signals that you have exceeded the rate limit.
Does the uncensored API key work with standard tools?
Yes, the key works with any OpenAI compatible client by changing the base URL. It supports streaming, JSON mode, and function calling just like major vendors. You can use it with popular IDE extensions and bots immediately.
Generate your API key instantly
Register, copy the token, update the endpoint. That is all you need to do.