Liberty Jail API
An OpenAI- and Anthropic-compatible API for abliterated open-weight models. If your code already talks to one of those two APIs, you only change the base URL, the key and the model id.
Quickstart
- Create an account and add credit from Console → Billing (crypto, minimum $10).
- Open Console → API keys and create a key. Copy it right away — the full key is only shown once.
- Export it as an environment variable and send your first request:
export LJ_API_KEY="lj_..."
curl {{BASE}}/chat/completions \
-H "Authorization: Bearer $LJ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "{{MODEL}}",
"messages": [{"role": "user", "content": "Explain what a Kerberoasting attack is in three sentences."}]
}'
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="{{BASE}}", api_key=os.environ["LJ_API_KEY"])
resp = client.chat.completions.create(
model="{{MODEL}}",
messages=[{"role": "user", "content": "Explain what a Kerberoasting attack is in three sentences."}],
)
print(resp.choices[0].message.content)
// npm install openai
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "{{BASE}}", apiKey: process.env.LJ_API_KEY });
const resp = await client.chat.completions.create({
model: "{{MODEL}}",
messages: [{ role: "user", content: "Explain what a Kerberoasting attack is in three sentences." }],
});
console.log(resp.choices[0].message.content);
Authentication
Every request needs an API key. Keys start with lj_ and can be sent in either of two headers — use whichever your client already sets:
| Header | Format | Typical client |
|---|---|---|
| Authorization | Bearer lj_… | OpenAI SDKs, curl, most tools |
| x-api-key | lj_… | Anthropic SDKs |
Base URLs
| Format | Base URL | Endpoints |
|---|---|---|
| OpenAI | /chat/completions, /models | |
| Anthropic | /v1/messages |
The Anthropic SDKs add /v1/messages themselves, so give them the host without /v1. OpenAI SDKs expect the URL with /v1.
Models
Lists the model ids your key can call, in the usual OpenAI list format.
curl {{BASE}}/models -H "Authorization: Bearer $LJ_API_KEY"
{
"object": "list",
"data": [
{ "id": "{{MODEL}}", "object": "model" }
]
}
Current catalogue (live):
| Model id | Context | Max output | Input / 1M | Output / 1M | Input types |
|---|---|---|---|---|---|
| Loading… | |||||
Rows marked “coming soon” on the models page are listed but return 404 until they go live.
Chat Completions
OpenAI-format chat endpoint. Send a list of messages, get the next assistant message back.
Request body
| Field | Type | Description |
|---|---|---|
| model | string | Required. A model id, e.g. . |
| messages | array | Required. Objects with role (system, user, assistant) and content. |
| max_tokens | integer | Upper limit on generated tokens. Capped by the model’s max output. |
| temperature | number | Sampling temperature, usually 0–2. Lower is more deterministic. |
| top_p | number | Nucleus sampling, 0–1. |
| stop | string | array | Sequences where generation stops. |
| stream | boolean | Send the answer as server-sent events while it is generated. |
| stream_options | object | {"include_usage": true} adds a final chunk with token counts. |
Response
{
"id": "chatcmpl-8f2c...",
"object": "chat.completion",
"model": "{{MODEL}}",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "Kerberoasting abuses service tickets..." },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 21, "completion_tokens": 96, "total_tokens": 117 }
}
Streaming
Set "stream": true. You receive data: {...} lines, each carrying a piece of text in choices[0].delta.content, then data: [DONE]. With stream_options.include_usage, the last chunk before [DONE] has an empty choices array and a usage object.
stream = client.chat.completions.create(
model="{{MODEL}}",
messages=[{"role": "user", "content": "Write a Sigma rule for suspicious certutil downloads."}],
stream=True,
stream_options={"include_usage": True},
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage:
print("\n", chunk.usage)
const stream = await client.chat.completions.create({
model: "{{MODEL}}",
messages: [{ role: "user", content: "Write a Sigma rule for suspicious certutil downloads." }],
stream: true,
stream_options: { include_usage: true },
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
if (chunk.usage) console.log("\n", chunk.usage);
}
data: {"id":"chatcmpl-8f2c","choices":[{"index":0,"delta":{"content":"title: "}}]}
data: {"id":"chatcmpl-8f2c","choices":[{"index":0,"delta":{"content":"Certutil"}}]}
data: {"id":"chatcmpl-8f2c","choices":[],"usage":{"prompt_tokens":18,"completion_tokens":240,"total_tokens":258}}
data: [DONE]
Messages (Anthropic format)
The same models, exposed in the Anthropic Messages format, so the Anthropic SDKs and tools built on them work unchanged. max_tokens is required here, and the system prompt goes in the top-level system field. Streaming uses "stream": true and the Anthropic event types.
# pip install anthropic
import os
import anthropic
client = anthropic.Anthropic(base_url="{{ABASE}}", api_key=os.environ["LJ_API_KEY"])
msg = client.messages.create(
model="{{MODEL}}",
max_tokens=1024,
system="You are a senior incident responder.",
messages=[{"role": "user", "content": "Triage these Windows event IDs: 4624, 4672, 4688."}],
)
print(msg.content[0].text)
curl {{ABASE}}/v1/messages \
-H "x-api-key: $LJ_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "{{MODEL}}",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Triage these Windows event IDs: 4624, 4672, 4688."}]
}'
Image input
Models whose input types include image (see the table above) accept pictures — screenshots, diagrams, photos of a screen. In the OpenAI format, make content an array of parts and add an image_url part. A base64 data: URL is the most reliable option.
import base64
with open("phishing.png", "rb") as f:
b64 = base64.b64encode(f.read()).decode()
resp = client.chat.completions.create(
model="{{MODEL}}",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Is this login page a phishing kit? List the tells."},
{"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}},
],
}],
)
Sending an image to a text-only model returns an error. Images count toward input tokens.
Errors
Errors use the OpenAI shape on every endpoint: an HTTP status plus a JSON body with a readable message, a type and a code.
{
"error": {
"message": "Your balance is too low for this request. Top up in the console.",
"type": "insufficient_quota",
"code": "insufficient_balance"
}
}
| Status | Meaning | What to do |
|---|---|---|
| 401 | Missing, wrong, revoked or expired key | Check the header and the key status in the Console. |
| 402 | Balance empty, or the key’s budget is used up | Top up, or raise the key’s daily/total budget. |
| 404 | Unknown model id, or a model that isn’t live yet | Call GET /v1/models for valid ids. |
| 429 | Too many requests, or too many at once | Wait and retry with exponential backoff. |
| 502 | The upstream model server failed | Retry after a short pause. |
Rate limits
| Limit | Default | Scope |
|---|---|---|
| Requests per minute | 60 | per API key |
| Concurrent requests | 8 | per account (all keys together) |
Going over either limit returns 429. Your current limits are on Console → Limits. If you need more headroom, message us on Telegram.
Billing
- Prepaid. You hold a balance in US dollars. Top it up with crypto from Console → Billing (minimum $10). It is credited automatically once the payment confirms.
- Per token. Each request costs its tokens multiplied by the model’s price per million tokens — input, output and cached input are priced separately. Cached input is the cheapest of the three.
- No subscription. Nothing renews; when the balance reaches zero, requests return 402 until you top up.
Every request, with its tokens and cost, is listed in Console → Activity and can be exported as CSV. Prices for each model are on the pricing page.
Key budgets & expiry
Give each project, teammate or customer its own key, and cap it:
| Setting | Effect |
|---|---|
| Total budget | Lifetime dollar cap for this key. Once reached, the key returns 402. |
| Daily budget | Dollar cap per day. Requests resume the next day. |
| Expiry date | After this date the key returns 401. |
| Revoke | Disables the key immediately and for good. |
Budgets and the expiry date can be changed at any time from Console → API keys. Leave a field empty for “no limit”. Spending is always bounded by your account balance as well.
SDK examples
Complete, copy-paste examples for the common clients. Replace the model id with any id from the catalogue.
curl {{BASE}}/chat/completions \
-H "Authorization: Bearer $LJ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "{{MODEL}}",
"messages": [
{"role": "system", "content": "You are a penetration tester writing a report."},
{"role": "user", "content": "Summarise the impact of an exposed .git folder."}
],
"max_tokens": 800,
"temperature": 0.4
}'
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="{{BASE}}", api_key=os.environ["LJ_API_KEY"])
resp = client.chat.completions.create(
model="{{MODEL}}",
messages=[
{"role": "system", "content": "You are a penetration tester writing a report."},
{"role": "user", "content": "Summarise the impact of an exposed .git folder."},
],
max_tokens=800,
temperature=0.4,
)
print(resp.choices[0].message.content)
print(resp.usage)
// npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "{{BASE}}",
apiKey: process.env.LJ_API_KEY,
});
const resp = await client.chat.completions.create({
model: "{{MODEL}}",
messages: [
{ role: "system", content: "You are a penetration tester writing a report." },
{ role: "user", content: "Summarise the impact of an exposed .git folder." },
],
max_tokens: 800,
temperature: 0.4,
});
console.log(resp.choices[0].message.content);
# pip install anthropic
import os
import anthropic
client = anthropic.Anthropic(base_url="{{ABASE}}", api_key=os.environ["LJ_API_KEY"])
with client.messages.stream(
model="{{MODEL}}",
max_tokens=800,
system="You are a penetration tester writing a report.",
messages=[{"role": "user", "content": "Summarise the impact of an exposed .git folder."}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
Questions or something not working? Reach us on Telegram.