EN ▾
Get API key

Heretic LLM API: Hosted Setup in Five Minutes

A heretic llm api here means a hosted, OpenAI-compatible endpoint for an uncensored text model, so you skip the GPU work and change only a base URL and a key. The steps below take you from sign-up to streaming, tool calls and JSON output.

Updated

per 1M input tokens
$0.15
Output tokens / 1M
$0.50
token context
100,000
trial credit
$0.50
requests per minute
300
Isometric terminal sending glowing data packets along a cable to a server tower

What you need

You need an API key, an HTTP client or an OpenAI SDK, and about five minutes. There is no model to download and no server to run. The service hosts one open-weight text model, run by an independent provider and tuned to answer without content refusals for lawful adult use. It is not the official API of any model vendor, and it is not a router across vendors.

  1. Create an account with Google, or with email and password.
  2. Open the API key page and claim the trial credit, or top up.
  3. Set the base URL to https://api.hereticllm.cc/v1 in your client.
  4. Use uncensored as the model name and send the key as a Bearer token.

Everything else in this guide is a variation on those four lines. The quickstart docs hold the short version if you only want a reminder.

Step 1: get a key

After sign-up, go to the API key page. New users can claim $0.50 of trial credit with one click, one per person. It is valid for 7 days and needs no card. Trial keys are limited to 2 concurrent requests and 60 requests per minute, which is plenty for testing a client.

When you are ready for more, top up with any whole amount from $20 to $500. A top-up of $50 or more adds a 5% bonus, $100 or more adds 10%, and $200 or more adds 15%. You can pay with crypto (USDT on TRC20, USDC on Base). Credit never expires, and there is no subscription. Details sit on the pricing page.

Treat the key like a password: do not paste it into client-side code or commit it to a repository. Store the key in an environment variable. The examples below read API_KEY from the environment, so nothing secret lands in your source files.

Step 2: send a first request

Start with curl, since it shows the raw shape of the call. The endpoint is POST /v1/chat/completions.

export API_KEY="paste-your-key-here"

curl https://api.hereticllm.cc/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [
      {"role": "system", "content": "You are a direct, concise assistant."},
      {"role": "user", "content": "List three plot twists for a heist story set in a casino under renovation."}
    ],
    "temperature": 0.9
  }'

To list what the key can see, call GET /v1/models:

curl https://api.hereticllm.cc/v1/models \
  -H "Authorization: Bearer $API_KEY"

In Python, install the official SDK with pip install openai and change the base URL:

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.hereticllm.cc/v1", api_key=os.environ["API_KEY"])

reply = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Summarize the plot of Macbeth in four sentences."}],
    max_tokens=300,
)
print(reply.choices[0].message.content)
print(reply.usage)

And in Node, after npm install openai:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.hereticllm.cc/v1",
  apiKey: process.env.API_KEY,
});

const reply = await client.chat.completions.create({
  model: "uncensored",
  messages: [{ role: "user", content: "Give me five names for a fantasy tavern." }],
});
console.log(reply.choices[0].message.content);

The max_tokens setting is optional. If you leave it out, the completion may use whatever remains of the 100,000-token window after your prompt.

Streaming responses

Set stream to true to receive the reply as server-sent events. This is what makes a chat interface feel responsive, because text shows up as it is generated. Usage totals arrive at the end of the stream.

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.hereticllm.cc/v1", api_key=os.environ["API_KEY"])

stream = client.chat.completions.create(
    model="uncensored",
    messages=[{"role": "user", "content": "Write a short monologue for a retired smuggler."}],
    stream=True,
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="", flush=True)
    if getattr(chunk, "usage", None):
        print("\n\nusage:", chunk.usage)

One detail matters for capacity planning. A streamed request holds its concurrency slot until the stream ends, so a user who opens a long reply and leaves the tab open still occupies one of your slots. Close streams you no longer need.

Tool calling

Tool calling follows the OpenAI format: pass tools, optionally tool_choice, read tool_calls from the reply (they can also be streamed), and send results back as messages with role: "tool". The loop below defines one function, lets the model call it, and returns the result.

import json
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.hereticllm.cc/v1", api_key=os.environ["API_KEY"])

tools = [{
    "type": "function",
    "function": {
        "name": "get_order_status",
        "description": "Look up the status of an order by its id.",
        "parameters": {
            "type": "object",
            "properties": {"order_id": {"type": "string"}},
            "required": ["order_id"],
        },
    },
}]

messages = [{"role": "user", "content": "Where is order A-1043?"}]
first = client.chat.completions.create(model="uncensored", messages=messages, tools=tools)
msg = first.choices[0].message

if msg.tool_calls:
    messages.append(msg)
    for call in msg.tool_calls:
        args = json.loads(call.function.arguments)
        result = {"order_id": args["order_id"], "status": "shipped"}
        messages.append({
            "role": "tool",
            "tool_call_id": call.id,
            "content": json.dumps(result),
        })
    final = client.chat.completions.create(model="uncensored", messages=messages, tools=tools)
    print(final.choices[0].message.content)
else:
    print(msg.content)

Always parse arguments defensively. Models occasionally return a malformed string, so wrap json.loads in a try block and, on failure, send an error message back as the tool result so the model can retry.

JSON mode

When you need machine-readable output, set response_format to {"type": "json_object"}. Also say in the prompt that you want JSON, and describe the keys you expect. The parameter pushes the output toward valid JSON, but your code should still handle a parse error.

import json
import os
from openai import OpenAI

client = OpenAI(base_url="https://api.hereticllm.cc/v1", api_key=os.environ["API_KEY"])

reply = client.chat.completions.create(
    model="uncensored",
    messages=[
        {"role": "system", "content": "Reply with JSON only: {\"title\": string, \"tags\": [string]}"},
        {"role": "user", "content": "Describe a novel about a lighthouse keeper who finds a locked door."},
    ],
    response_format={"type": "json_object"},
    temperature=0.4,
)
data = json.loads(reply.choices[0].message.content)
print(data["title"], data["tags"])

The sampling parameters temperature, top_p, stop, seed and the frequency and presence penalties are passed through. Lower the temperature for structured output and raise it for creative writing.

Keeping a conversation going

The API is stateless. It does not remember earlier calls, so a multi-turn chat works by sending the whole message history each time: the system message, then alternating user and assistant messages, then the new user message. Append each reply to your list before the next call.

import os
from openai import OpenAI

client = OpenAI(base_url="https://api.hereticllm.cc/v1", api_key=os.environ["API_KEY"])

history = [{"role": "system", "content": "You are a patient writing partner for adult fiction."}]

def say(text):
    history.append({"role": "user", "content": text})
    reply = client.chat.completions.create(model="uncensored", messages=history)
    answer = reply.choices[0].message.content
    history.append({"role": "assistant", "content": answer})
    return answer

print(say("Suggest a premise for a slow-burn thriller set on a night train."))
print(say("Make the protagonist a retired translator and continue."))

Because input tokens are billed on every call, a long history makes each turn cost more. The window is 100,000 tokens for prompt plus completion, which is generous, but a chat that has grown to 60,000 tokens of history pays for those tokens again on the next request. Once a conversation gets long, summarize the early part into one message and drop the originals. A summary of 800 tokens in place of 40,000 saves a lot over a long session.

Using it from existing apps

Many chat front ends and agent frameworks accept a custom OpenAI-compatible endpoint. SillyTavern, for example, lets you add one in its connection settings, and libraries such as LangChain and the Vercel AI SDK let you override the base URL on their OpenAI clients. In all of them the three values are the same: the base URL https://api.hereticllm.cc/v1, your key, and the model name uncensored.

If a tool asks for the full chat completions URL instead of the base, use https://api.hereticllm.cc/v1/chat/completions. If it offers a model dropdown filled from GET /v1/models, pick the single entry.

Quick troubleshooting

  • Authentication error. Check that the header reads Authorization: Bearer followed by the key, with no stray quotes or line breaks from copying.
  • Not found. Make sure the base URL ends in /v1 and that your client does not add a second /v1.
  • Unexpected 429 on a small test. A trial key allows 2 concurrent requests, so a script that fires 5 at once will hit the concurrency code. Lower the worker count or top up for a full key.
  • Cut-off output. You may have set max_tokens too low. Raise it or remove it.
  • Odd formatting in JSON mode. Add a one-line example of the exact shape you want to the system message.

Keep the content rules in mind when you build on it: the service is for lawful adult use, text only, and sexual content involving minors is never allowed. The model is tuned to answer without content refusals, so your own app should decide what its users may see.

Rate limits, errors and cost tracking

A full key allows 8 concurrent requests and 300 requests per minute. A trial key allows 2 and 60. The maximum request body is 8 MB. Over a limit, the API returns HTTP 429 with the error code rate_limited for requests per minute or concurrency for too many requests at once. Under temporary overload it also returns 429, with a Retry-After: 5 header. The fix is the same in every case: wait, then retry.

import os
import time
from openai import OpenAI, RateLimitError

client = OpenAI(
    base_url="https://api.hereticllm.cc/v1",
    api_key=os.environ["API_KEY"],
    max_retries=0,
)

def ask(prompt, attempts=5):
    for n in range(attempts):
        try:
            raw = client.chat.completions.with_raw_response.create(
                model="uncensored",
                messages=[{"role": "user", "content": prompt}],
            )
            print("balance:", raw.headers.get("X-Balance-USD"))
            return raw.parse().choices[0].message.content
        except RateLimitError as err:
            wait = float(err.response.headers.get("Retry-After", 2 ** n))
            time.sleep(wait)
    raise RuntimeError("still rate limited after retries")

print(ask("Name three classic locked-room mystery setups."))

Responses carry X-Request-Id, X-Balance-USD, X-RateLimit-Limit-Requests and X-RateLimit-Limit-Concurrency. Log the request ID so support can trace a call, and watch the balance header if you run unattended jobs. For batch work, cap your worker pool at the concurrency limit, so 8 on a full key.

Cost is easy to estimate. At $0.15 per 1M input tokens and $0.50 per 1M output tokens, a call with 3,000 input tokens and 1,000 output tokens costs $0.00045 plus $0.0005, which is $0.00095. Ten thousand such calls cost $9.50. Failed or refused requests are not charged. If something looks wrong, the support page is the place to ask.

Questions and answers

Do I need to change anything besides the base URL and key?

No. Set the model to uncensored and keep the rest of your OpenAI-style code as it is. Text chat completions, streaming, tool calling and JSON mode use the standard parameters.

Is this the official API of the Heretic tool or of a model vendor?

No. It is an independent hosted service in front of one open-weight model, and it is not affiliated with any model vendor.

Can I generate images or embeddings?

No. The API is text only: no images, audio, video, embeddings or fine-tuning.

What happens when I hit a rate limit?

You get HTTP 429 with the code rate_limited or concurrency. Wait and retry; on temporary overload the response includes a Retry-After header of 5 seconds.

Are my prompts used for training?

No. Prompts are not used for training.

Your key is one form away

Create an account, copy the key, change the base URL. That is the whole setup.

On this page

  1. What you need
  2. Step 1: get a key
  3. Step 2: send a first request
  4. Streaming responses
  5. Tool calling
  6. JSON mode
  7. Keeping a conversation going
  8. Using it from existing apps
  9. Rate limits, errors and cost tracking
  10. More guides
Start with trial credit

Email and password, key on screen right away.

Key points

  • Base URL is https://api.hereticllm.cc/v1, the model ID is uncensored, and auth is a Bearer key.
  • Two endpoints exist: POST /v1/chat/completions and GET /v1/models.
  • Streaming, tool calling and JSON mode work through the standard OpenAI parameters.
  • A full key allows 8 concurrent requests and 300 per minute; a 429 tells you which limit you hit.