EN ▾
Get API key

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.

ItemValue
API formatOpenAI-compatible: any OpenAI SDK or client works — change the base URL and the key
Base URLhttps://api.hereticllm.cc/v1
Model IDuncensored
AuthenticationBearer token in the Authorization header
EndpointsPOST /v1/chat/completions · GET /v1/models
SSE streamingSupported (stream: true), usage included at the end
JSON modeJSON object mode via response_format json_object
Function callingYes — tools, tool_choice; replies carry tool_calls, also when streaming; send results back as role: tool
Context window100,000 tokens (prompt + completion together)
Completion lengthup to the rest of the 100,000-token window; max_tokens optional (no separate cap)
Other parameterstemperature, top_p, stop, seed, presence_penalty, frequency_penalty
Response headersX-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests, X-RateLimit-Limit-Concurrency
Max bodyup to 8 MB per request
Requests per minute300/min per key
Parallel requests8 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
Priceinput $0.15 / 1M tokens, output $0.50 / 1M tokens
Subscriptionno monthly fee; paid credit does not expire
Top-upUSDT (TRC20) or USDC (Base), any whole amount from $20 to $500
Billingprepaid credit, charged by real token usage; errors and refusals are free
Bonus credit+5% on $50+, +10% on $100+, +15% on $200+
Key managementone active key per account; a new key replaces the old one
Content policyuncensored for adults; the only hard rule: no sexual content involving minors
Sign-inGoogle or e-mail and password

Error reference

The type field is stable, the message is for humans. Errors cost nothing.

CodeTypeMeaning
400bad_requestmalformed request or too long for the context window
401missing_key · invalid_key · key_revokedcheck the Authorization header or use your current key
402no_creditbalance is empty — top up, requests resume at once
403content_blockedsexual content involving minors — refused, not billed
404not_foundonly /v1/chat/completions and /v1/models exist
413request_too_largerequest body larger than 8 MB
429rate_limited · concurrencyslow down: rate or parallel limit reached
503upstream_busytemporary 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.