API reference

Anthropic Messages API

Use Abliterator's Anthropic-compatible POST /v1/messages with the Anthropic SDKs: base URL, system prompts, tools, thinking, streaming events and limits.

Reviewed APIAnthropicMessages

Quick answer

Point the Anthropic SDK at https://abliterator.ai and use an Abliterator model ID. Abliterator serves POST /v1/messages with system prompts, tools, images, thinking and streaming; count_tokens and batches are not available.

Endpoint

POST https://abliterator.ai/v1/messages

The Anthropic SDKs add /v1/messages themselves, so their base URL is https://abliterator.ai, without /v1. The endpoint also answers at https://abliterator.ai/api/v1/messages.

Authenticate with x-api-key: <key> (the SDK default) or Authorization: Bearer <key>. Abliterator forwards your anthropic-version and anthropic-beta headers to the model and sends anthropic-version: 2023-06-01 when you omit it.

Python

import os

import anthropic

client = anthropic.Anthropic(base_url="https://abliterator.ai", api_key=os.environ["ABL_API_KEY"])

message = client.messages.create(
    model="kimi-k3.1-pro-abliterated",
    max_tokens=8192,
    system="You are a senior penetration tester writing for a client report. Be precise and cite CWE IDs.",
    messages=[
        {"role": "user", "content": "Explain the risk of a JWT signed with the 'none' algorithm being accepted by an API."}
    ],
)

for block in message.content:
    if block.type == "text":
        print(block.text)
print(message.usage)

TypeScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://abliterator.ai",
  apiKey: process.env.ABL_API_KEY,
});

const message = await client.messages.create({
  model: "kimi-k3.1-pro-abliterated",
  max_tokens: 8192,
  system: "You are a senior penetration tester writing for a client report. Be precise and cite CWE IDs.",
  messages: [
    { role: "user", content: "Explain the risk of a JWT signed with the 'none' algorithm being accepted by an API." },
  ],
});

for (const block of message.content) {
  if (block.type === "text") console.log(block.text);
}

curl

curl https://abliterator.ai/v1/messages \
  -H "x-api-key: $ABL_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash-abliterated",
    "max_tokens": 2048,
    "system": "Answer in three sentences or fewer.",
    "messages": [{"role": "user", "content": "What does the HttpOnly cookie flag protect against?"}]
  }'

Request fields

Field Notes
model Required. An Abliterator model ID or alias, not a Claude model name
max_tokens Required by the Anthropic format. Includes thinking tokens
messages user and assistant turns. Content can be text, image, tool_use, tool_result and thinking blocks
system String or array of text blocks
tools, tool_choice Client tools; see tool calling
stream Server-Sent Events; see streaming
stop_sequences, temperature, top_p, top_k Passed to the model, subject to the per-model rules. temperature and top_p are ignored for kimi-k3.1-pro-abliterated, whose sampling is fixed
thinking {"type": "enabled"}, {"type": "adaptive"} or {"type": "disabled"}; see below
output_config effort (reasoning level) and format (JSON schema output)
metadata Accepted

Images use Anthropic image blocks with a base64 or URL source; see vision.

Thinking and effort

Both models reason by default. In the Messages format:

  • "thinking": {"type": "disabled"} turns reasoning off, the same as reasoning_effort: "none" in Chat Completions.
  • "thinking": {"type": "enabled"} or {"type": "adaptive"} keeps reasoning on at the model's default level. budget_tokens is accepted but does not set the level.
  • output_config.effort sets the level: none, minimal, low, medium, high, xhigh or max.
import os

import anthropic

client = anthropic.Anthropic(base_url="https://abliterator.ai", api_key=os.environ["ABL_API_KEY"])

message = client.messages.create(
    model="deepseek-v4.1-flash-abliterated",
    max_tokens=4096,
    messages=[{"role": "user", "content": "Classify this log line as benign or suspicious: 'sshd: Failed password for root from 203.0.113.7'"}],
    extra_body={"output_config": {"effort": "low"}},
)

for block in message.content:
    print(block.type, getattr(block, "thinking", None) or getattr(block, "text", ""))

Reasoning comes back as thinking content blocks before the text. You can send them back in later turns unchanged. See reasoning.

Response

The response is an Anthropic message object. Abliterator sets model to the canonical model ID.

{
  "id": "msg_01H8XK2V9P",
  "type": "message",
  "role": "assistant",
  "model": "deepseek-v4.1-flash-abliterated",
  "content": [
    {"type": "thinking", "thinking": "HttpOnly blocks script access...", "signature": "..."},
    {"type": "text", "text": "HttpOnly stops JavaScript from reading the cookie..."}
  ],
  "stop_reason": "end_turn",
  "usage": {"input_tokens": 42, "output_tokens": 211, "cache_read_input_tokens": 0}
}

The Anthropic usage object has no cost field. Read the cost from the X-Abl-Cost-Usd header on non-streaming responses, or from GET /api/v1/generation?id=<X-Abl-Generation-Id> for any request. See usage and billing.

cache_read_input_tokens are billed at the cached input price. Prompt caching is automatic; you do not need cache_control breakpoints. Any cache_creation_input_tokens are billed at the normal input price, with no write surcharge. See prompt caching.

Streaming events

With "stream": true, Abliterator relays Anthropic's event sequence: message_start, then for each content block content_block_start, content_block_delta (text_delta, thinking_delta or input_json_delta) and content_block_stop, then message_delta with stop_reason and output usage, then message_stop. The SDK's stream helpers work unchanged:

import os

import anthropic

client = anthropic.Anthropic(base_url="https://abliterator.ai", api_key=os.environ["ABL_API_KEY"])

with client.messages.stream(
    model="deepseek-v4.1-flash-abliterated",
    max_tokens=4096,
    messages=[{"role": "user", "content": "Write a short incident-response checklist for a leaked API key."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)
    final = stream.get_final_message()

print("\n", final.usage)

More detail, including what happens on disconnect, is in streaming.

Errors

Errors use the Anthropic shape, {"type": "error", "error": {"type": ..., "message": ...}}. A 402 (out of credit) has type permission_error, and a 502 has type api_error. The full list is in errors.

Not supported

  • POST /v1/messages/count_tokens, the Message Batches API, the Files API and server tools such as web search. These paths return 404.
  • The Anthropic-format Models API. GET /v1/models returns the OpenAI list format; see models.
  • Claude model names. Requests must name an Abliterator model.

Using Claude Code? See Claude Code setup. Other Anthropic SDK examples are in the Anthropic SDK guide.