APIDec 1, 2026Ghost research

Uncensored LLM API, OpenAI compatible: point your SDK at Ghost in one line

Ghost serves uncensored and abliterated open models behind the same chat completions format the OpenAI SDK already speaks. Change the base URL and the key, keep the rest of your code.

  • Base URL https://api.thesapientdirective.com/v1, key sent as Authorization: Bearer YOUR_GHOST_KEY. Keys start with ak_.1
  • Supported endpoints are /v1/chat/completions, /v1/responses (used by Codex), /v1/models and an Anthropic-format /v1/messages for Claude Code.1
  • Ghost's docs document streaming with "stream": true, tool calls in the OpenAI tools format, JSON output and images on vision models.1
  • Pricing is per token, from $0.20 per million input tokens and $0.80 per million output tokens on Ghost X2, Ghost X1, GLM 5.3 Flash Uncensored and Qwen 3.8 Abliterated.
  • API credits never expire, and you can reload from $5.

Yes, there is an uncensored LLM API that is OpenAI compatible: Ghost serves open models with their refusals removed at https://api.thesapientdirective.com/v1, in the same chat completions format the OpenAI SDK uses. You change the base URL and the API key, pick a model id such as ghost-x2, and the rest of your code stays as it is. Streaming and tool calls work the way the OpenAI docs describe them.

What we actually tested

On November 30, 2026 we pointed real OpenAI-compatible clients at Ghost's production API with model ghost-x2 and gave each a small job that leaves proof. Aider wrote a hello.py that ran. Hermes Agent 0.19, Cline CLI 3.0, Kilo Code CLI 7.8 and OpenClaw 2026.11.13 each wrote a hello.txt through their own file tools. OpenCode 1.19 crashed on its first run, because Ghost's stream ended with a non-standard data frame that AI SDK clients reject. We fixed the gateway that night and OpenCode then passed. Open WebUI on a real server listed all 19 models the API serves (16 are on the Models page) and replied "hello from ghost". The agent setup guide has each config and result.

Why the base URL is all you change

The official OpenAI Python library takes a base_url argument, and it also reads the OPENAI_BASE_URL environment variable.2 The JavaScript library has the same baseURL option. Any server that accepts the same request shape can stand in for OpenAI's, which is why so many tools list "OpenAI compatible" as a provider type.

Ghost accepts that shape. Your messages array, your system prompt, your temperature and your max_tokens all mean what they meant before. The differences are the model ids, which come from Ghost's list, and the models themselves, which are open models with the refusal behavior removed (see what an abliterated model is for how that works).

Get a key on the API page. The Connect page can also make one and hand you a ready command.

Python

Install the official package with pip install openai, then:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.thesapientdirective.com/v1",
    api_key="YOUR_GHOST_KEY",
)

reply = client.chat.completions.create(
    model="ghost-x2",
    messages=[
        {"role": "system", "content": "You are a direct, technical assistant."},
        {"role": "user", "content": "Explain how a SQL injection works, with a vulnerable query and the fix."},
    ],
)
print(reply.choices[0].message.content)

In real code, read the key from an environment variable instead of pasting it into the file.

JavaScript and TypeScript

With npm install openai:

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.thesapientdirective.com/v1",
  apiKey: process.env.GHOST_API_KEY,
});

const reply = await client.chat.completions.create({
  model: "ghost-x2",
  messages: [{ role: "user", content: "Write a villain monologue for a heist thriller." }],
});
console.log(reply.choices[0].message.content);

curl

No SDK needed. This is the whole request:

curl https://api.thesapientdirective.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_GHOST_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"ghost-x2","messages":[{"role":"user","content":"Hello"}]}'

To see every model your key can call, with context size and price, ask the API itself:

curl https://api.thesapientdirective.com/v1/models \
  -H "Authorization: Bearer YOUR_GHOST_KEY"

Streaming and tool calls

Ghost's API docs describe streaming this way: pass "stream": true and the reply arrives token by token as server-sent events, ending with data: [DONE]. Leave it out and you get one JSON reply.1 In Python that is one extra argument:

stream = client.chat.completions.create(
    model="ghost-x2",
    messages=[{"role": "user", "content": "Summarize the CAP theorem in five lines."}],
    stream=True,
)
for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

Tool calls use the OpenAI tools format. You describe your functions, and when the model wants one, the reply comes back with finish_reason: "tool_calls" and the call in message.tool_calls. You run the function, send the result back as a tool message, and ask again.1 That loop is the same one OpenAI's function calling guide walks through.3

tools = [{
    "type": "function",
    "function": {
        "name": "get_cve",
        "description": "Look up a CVE record by id",
        "parameters": {
            "type": "object",
            "properties": {"cve_id": {"type": "string"}},
            "required": ["cve_id"],
        },
    },
}]

reply = client.chat.completions.create(
    model="ghost-x2",
    messages=[{"role": "user", "content": "What is CVE-2021-44228 and how do I patch it?"}],
    tools=tools,
)
print(reply.choices[0].finish_reason, reply.choices[0].message.tool_calls)

Coding agents lean on tool calls heavily. On November 30, 2026 we ran Codex, OpenCode, Cline, Kilo Code, Aider, Hermes Agent and OpenClaw against Ghost's production API end to end, each with a real task, and every one of those configs uses ghost-x2. The agent setup guide has the exact configs.

Which model id to use

ModelAPI idContextInput per 1MOutput per 1MGood for
Ghost X2ghost-x2256K$0.20$0.80Coding, text, research
Ghost X1ghost-x1256K$0.20$0.80Coding, text
GLM 5.3 Flash Uncensoredglm-5-3-flash-uncensored1M$0.20$0.80Long documents, research
Qwen 3.8 Abliteratedqwen3.8-abliterated256K$0.20$0.80Coding, text
GLM 5.3 Uncensoredglm-5-3-uncensored1M$3$5Hard research and coding, 753B
DeepSeek V4.1 Flash Uncensoreddeepseek-v4-1-flash-uncensored256K$0.60$2.25Coding, reasoning
Kimi K3.1 Pro Uncensoredkimi-k3-1-pro-uncensored256K$7.50$22.50The largest model, 2.8T
Qwen 3 VL Abliteratedqwen3-vl-32b32K$0.70$2.50Photos, screenshots, documents

A simple rule: start on ghost-x2, move to glm-5-3-flash-uncensored when your input is too long for 256K, and reach for glm-5-3-uncensored or kimi-k3-1-pro-uncensored when a task is hard enough to justify the higher price. The Models page has every model with live prices.

What it costs

You pay for the tokens each request uses at the prices above, and nothing else. Credits never expire, and you can reload from $5. An empty balance returns HTTP 402 with api_balance_empty, so your code can catch it.4 At $0.20 in and $0.80 out, a request with 2,000 input tokens and 500 output tokens costs $0.0008 on Ghost X2. If you also want the chat app, the Pro plan is $20 a month.

What the models will and will not do

Uncensored here means the models do not refuse ordinary work out of reflex: security research, blunt medical and legal questions, dark fiction, and code that a stock model might lecture you about. Ghost's Content Policy still prohibits six categories on every model, including sexual content of any kind, malware built to attack systems and breaking into accounts or systems. If you are building a product on the API, read that policy before you ship, and read the privacy policy yourself too. For background on the term, see what uncensored AI means.

FAQ

Do I need a special SDK to use Ghost?

No. The official OpenAI Python and JavaScript libraries work as they are. You set the base URL to https://api.thesapientdirective.com/v1 and use your Ghost key.

Does Ghost support the Anthropic SDK too?

Yes. Ghost serves the Anthropic Messages format at https://api.thesapientdirective.com, which is how Claude Code runs on it. The Claude Code guide shows the setup.

Can I get a list of models from the API?

Yes. GET /v1/models with your key returns every model it can call, with its context size and price per million tokens.

Is there a free tier for the API?

The API is pay per token with reloads from $5, and credits never expire. The chat app has a free plan with 3 messages to try Ghost, no card needed.

Sources

  1. Ghost API docs: endpoints, authentication, streaming and tool calls
  2. openai-python README, OpenAI on GitHub
  3. Function calling guide, OpenAI API docs
  4. Ghost API: models, prices and billing

Authors

Ghost research. Written by the Ghost team at The Sapient Directive. Ghost prices and model details are checked against the live Models page; if they ever differ, that page is right.

Keep reading