Best LLM API Docs
Quickstart Guide: Drop-in Integration
Integrate our uncensored LLM API into your application by swapping the base URL and API key in your existing OpenAI-compatible codebase.
Prerequisites
Before making your first request, ensure you have a valid API key. Sign up at the Get API key page to receive your key instantly. No credit card is required for the initial trial. You will need a supported programming language environment (Python 3.8+ or Node.js 18+) and the official OpenAI SDK installed in your project.
Our service acts as a drop-in replacement for standard chat-completions endpoints. You do not need to install a custom client library; the standard OpenAI SDK handles the communication protocol, including streaming and tool calling, provided you configure the base URL correctly.
Authentication
Authentication is handled via the Authorization header. Pass your API key as a Bearer token. If the key is invalid or expired, the API returns a 401 Unauthorized error. If your account balance is insufficient, you receive a 402 Payment Required error. Add your key to your environment variables or configuration file to avoid hardcoding credentials.
- Header:
Authorization: Bearer YOUR_API_KEY - Base URL:
https://api.bestllmapi.com/v1
Keep your key secure. You can regenerate it at any time from your dashboard, which immediately invalidates the previous key.
Basic Chat Completion
Send a POST request to /v1/chat/completions with a model ID of uncensored and your message history. The API returns a text response. This endpoint supports standard OpenAI JSON structures, making migration from other providers straightforward.
Ensure you structure your messages correctly with roles like system, user, and assistant. The model processes the input and generates a completion based on your prompt context.
curl https://api.bestllmapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
}'
Streaming Responses
For real-time user experiences, enable streaming by setting stream: true in your request body. The API returns a Server-Sent Events (SSE) stream containing delta objects. Each delta contains a fragment of the generated text. Process these chunks incrementally to display text as it is generated, reducing perceived latency for end-users.
Stream handling is identical to the standard OpenAI streaming protocol. You must handle the stream completion event to know when generation is finished.
from openai import OpenAI
client = OpenAI(base_url="https://api.bestllmapi.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)
Function Calling
Define functions in your request body using the tools parameter. The model may return a tool call object instead of direct text. Parse the function name and arguments, execute the function in your code, and then send the results back to the model for a final response. This allows your LLM to interact with external APIs or databases dynamically.
Function calling follows the standard OpenAI schema. Ensure your function definitions are precise to improve the model's accuracy in selecting the correct tool and extracting arguments.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.bestllmapi.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);
Context Window Limits
The model supports a context window of 100,000 tokens, combining both prompt and completion tokens. Monitor your token usage to avoid exceeding this limit, which results in a 400 Bad Request error. If you hit the rate limit of 300 requests per minute, you receive a 429 Too Many Requests error.
Implement exponential backoff for retries. Request bodies are limited to 8 MB. For long conversations, consider summarizing earlier messages to stay within the token budget while maintaining context.
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)Technical reference
A quick checklist for developers: format, limits, features, billing.
| Item | Value |
|---|---|
| Protocol | OpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key |
| API key | Bearer token in the Authorization header |
| Methods | POST /v1/chat/completions · GET /v1/models |
| Base URL | https://api.bestllmapi.com/v1 |
| Model | uncensored |
| Function calling | Supported: tools + tool_choice, tool_calls in the reply (streamed too), tool results as role: tool messages |
| Structured output | response_format: {"type": "json_object"} |
| Completion length | prompt + completion fit within 100,000 tokens; max_tokens optional, no separate output cap |
| Context window | 100,000 tokens (prompt + completion together) |
| Sampling parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| SSE streaming | Supported (stream: true), usage included at the end |
| Parallel requests | up to 8 in parallel per key |
| Rate limit | 300/min per key |
| Request size | up to 8 MB per request |
| Headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Subscription | paid credit never expires, no subscription |
| Volume bonus | +5% from $50, +10% from $100, +15% from $200 |
| Payment | crypto: USDT on TRON or USDC on Base, $20–$500, any whole sum |
| Price | input $0.15 / 1M tokens, output $0.50 / 1M tokens |
| How you pay | pay as you go from prepaid credit; nothing is charged for failed or refused requests |
| Trial credit | $0.50 for 7 days, no card · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up |
| Key management | one active key per account; a new key replaces the old one |
| Content | uncensored for adults; the only hard rule: no sexual content involving minors |
| Account | Google or e-mail and password |
When a request fails
The type field is stable, the message is for humans. Errors cost nothing.
| Status | Type | Reason |
|---|---|---|
400 | bad_request | invalid JSON, empty messages, bad parameter, or a prompt longer than the window — fix and resend |
401 | missing_key · invalid_key · key_revoked | no key, wrong key, or a key replaced by a newer one |
402 | no_credit | out of credit; add credit and retry |
403 | content_blocked | refused by the content policy |
404 | not_found | unknown endpoint |
413 | request_too_large | body over 8 MB |
429 | rate_limited · concurrency | slow down: rate or parallel limit reached |
503 | upstream_busy | model busy — retry in a few seconds |
Questions and answers
Is this API compatible with the official OpenAI SDK?
Yes, it is fully compatible. You only need to change the base URL and API key in your existing OpenAI SDK configuration to use this service.
What happens if I exceed the rate limit?
The API returns a 429 Too Many Requests error. You should implement retry logic with exponential backoff to handle this gracefully.
Can I use this API for image generation?
No, this API serves only text completions. It does not support image, audio, or video generation endpoints.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.