Integrate Heretic LLM with Python and JS SDKs
Integrate the Heretic LLM uncensored coding model into your backend using standard OpenAI-compatible SDKs. This guide covers Python and JavaScript setup, streaming, and tool usage for reliable inference.
- per 1M input tokens
- $0.15
- Output tokens / 1M
- $0.50
- token context
- 100,000
- trial credit
- $0.50
- requests per minute
- 300
Base URL and Authentication
Start by configuring your client to point at the Heretic LLM endpoint. The API follows the standard OpenAI chat-completions interface, making it compatible with existing libraries. Replace your base URL with https://api.hereticllm.cc/v1 and use your generated API key for authentication. Unlike platforms that require complex header configurations, this service uses standard Authorization: Bearer headers. You generate one active key per account; issuing a new key immediately revokes the previous one, ensuring clear access control. Keep your key secure, as it provides direct access to your prepaid credit.
First Request
Verify your integration by sending a simple completion request. This confirms that your key is valid and the uncensored model responds correctly to your prompts. The endpoint accepts standard JSON payloads with a model identifier and a message array. Ensure you are using the uncensored model ID, which is tuned for raw, unfiltered responses without hidden refusals for lawful adult content.
Python Quickstart
Use the official openai Python package to interact with the API. Initialize the client with your API key and the correct base URL. This approach allows you to leverage familiar syntax for building AI agents or backend logic. The SDK handles serialization and streaming automatically, reducing boilerplate code. Install the package via pip and import the necessary classes to start making requests to the uncensored endpoint.
JavaScript/Node Quickstart
For Node.js environments, use the openai npm package. Configure the client with your API key and the Heretic LLM base URL. This setup works seamlessly with Express routes or serverless functions. The JavaScript SDK supports both synchronous calls and streaming responses, giving you flexibility in how you handle model outputs. Ensure you handle async/await properly to manage concurrent requests within your rate limits.
Streaming Responses
Enable streaming to receive token-by-token updates, which improves perceived latency for users. The API uses Server-Sent Events (SSE) to push data as it is generated. The final chunk of the stream contains the total token usage, allowing you to track costs accurately in real-time. Streaming is ideal for chat interfaces or real-time code generation where immediate feedback is valuable. Configure your SDK to handle the stream object and iterate over the chunks as they arrive.
Limits, Errors, and Context
Monitor your request volume to avoid interruptions. The API enforces a limit of 300 requests per minute per key, with a concurrency cap of 8 simultaneous requests. Request bodies must stay under 8 MB. Common errors include 401 for invalid keys, 402 when credit is exhausted, and 429 for rate limits. Each request supports a 100,000-token context window, with no separate output cap. Errors do not consume credit, and prepaid credit never expires, so you can retry failed requests without penalty.
cURL
curl https://api.hereticllm.cc/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."}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.hereticllm.cc/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.hereticllm.cc/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)Technical specifications
A quick checklist for developers: format, limits, features, billing.
| Item | Value |
|---|---|
| API format | OpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key |
| Base URL | https://api.hereticllm.cc/v1 |
| Model ID | uncensored |
| Authentication | Bearer token in the Authorization header |
| Endpoints | POST /v1/chat/completions · GET /v1/models |
| SSE streaming | Supported (stream: true), usage included at the end |
| JSON mode | JSON object mode via response_format json_object |
| Function calling | Yes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool |
| Context window | 100,000 tokens (prompt + completion together) |
| Completion length | up to the rest of the 100,000-token window; max_tokens optional (no separate cap) |
| Other parameters | temperature, top_p, stop, seed, presence_penalty, frequency_penalty |
| Response headers | X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency |
| Max body | up to 8 MB per request |
| Requests per minute | 300/min per key |
| Parallel requests | 8 requests at the same time per key |
| Free trial | $0.50 of credit valid 7 days, no card needed · Trial key: 2 parallel requests, 60 req/min; full limits (8 and 300) after first top-up |
| Price | input $0.15 / 1M tokens, output $0.50 / 1M tokens |
| Subscription | no monthly fee; paid credit does not expire |
| Top-up | USDT (TRC20) or USDC (Base), any whole amount from $20 to $500 |
| Billing | prepaid credit, charged by real token usage; errors and refusals are free |
| Bonus credit | +5% on $50+, +10% on $100+, +15% on $200+ |
| Key management | one active key per account; a new key replaces the old one |
| Content policy | uncensored for adults; the only hard rule: no sexual content involving minors |
| Sign-in | Google or e-mail and password |
Error reference
The type field is stable, the message is for humans. Errors cost nothing.
| Code | Type | Meaning |
|---|---|---|
400 | bad_request | malformed request or too long for the context window |
401 | missing_key · invalid_key · key_revoked | check the Authorization header or use your current key |
402 | no_credit | balance is empty — top up, requests resume at once |
403 | content_blocked | sexual content involving minors — refused, not billed |
404 | not_found | only /v1/chat/completions and /v1/models exist |
413 | request_too_large | request body larger than 8 MB |
429 | rate_limited · concurrency | slow down: rate or parallel limit reached |
503 | upstream_busy | temporary overload, retry shortly |
Questions and answers
Can I use multiple API keys for one account?
No, each account supports only one active API key at a time. Generating a new key immediately invalidates the previous one, ensuring a single point of access for your billing and usage limits.
What happens if I hit the rate limit?
The API returns a 429 status code. You should implement exponential backoff in your client to retry requests. The limit is 300 requests per minute, with a maximum of 8 concurrent requests per key.
Is the uncensored model the same as GPT or Claude?
No, it is an open-weight model specifically tuned for uncensored responses. It is not GPT, Claude, Gemini, or any other vendor's model. It respects your prompts without hidden refusals for lawful adult content.
Your key is one form away
Create an account, copy the key, change the base URL. That is the whole setup.
On this page
- 01Base URL and Authentication
- 02First Request
- 03Python Quickstart
- 04JavaScript/Node Quickstart
- 05Streaming Responses
- 06Limits, Errors, and Context
- 07Questions and answers
Email and password, key on screen right away.