Dev.to Security 🔐 Cybersecurity 👁 0 📖 6 min read

Call a Hosted Abliterated Model with the OpenAI Python and Node SDKs

Most teams I talk to already have an OpenAI or Anthropic client in their tooling. They do not want to self-host a 27B checkpoint just to discuss a detection rule or a scoped test plan. You can keep the SDK you already us

Most teams I talk to already have an OpenAI or Anthropic client in their tooling. They do not want to self-host a 27B checkpoint just to discuss a detection rule or a scoped test plan. You can keep the SDK you already use and change the base URL.

This walkthrough uses CommentLLM, a hosted API for abliterated models aimed at authorized security work. The examples cover Python, Node, and curl against https://api.commentllm.com/v1, the two current preview model IDs, and the Anthropic-compatible option, which uses a slightly different base URL. The prompts are ordinary on purpose: explain a public detection pattern, or draft a test-plan outline. Nothing here is an attack procedure.

Model IDs, context windows, and token rates below were checked on the public catalog on 23 November 2026 (America/New_York). Re-check that catalog before you quote them; both models are still in preview.

What "abliterated" means here

An abliterated model is not a jailbreak wrapper. Abliteration edits refusal-related directions in the model weights, so the model is less likely to decline ordinary security questions. It does not guarantee that every request will be followed, and it does not remove your responsibility to stay inside a written engagement. In this API, a policy gateway still applies your organization's engagement scope and rules before a response is returned.

If you have been searching for an uncensored LLM API for red-team or detection-engineering work, that distinction matters: fewer unhelpful refusals, plus controls you can explain to a client or a CISO.

Set up a key

Create an account, then create a project key in the console. Keys start with cllm_ and are shown once. Send the key as Authorization: Bearer cllm_.... The x-api-key header also works.

You can create an account without a card. Model requests need prepaid credit (you can add credits from $10) or a monthly plan, which starts at $20 and includes usage credit plus a discount on the listed rates. There is no review step after sign-up.

Export the key and keep it out of source control:

export COMMENTLLM_API_KEY="cllm_..."

Install the official clients if you do not already have them:

pip install openai
# or
npm install openai

Python: change the base URL

The only required change from a typical OpenAI client is base_url and the key.

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.commentllm.com/v1",
    api_key=os.environ["COMMENTLLM_API_KEY"],
)

rule = """
title: Suspicious PowerShell Encoded Command
logsource:
  category: process_creation
  product: windows
detection:
  selection:
    CommandLine|contains:
      - ' -enc '
      - ' -EncodedCommand '
  condition: selection
"""

reply = client.chat.completions.create(
    model="qwen3.8-27b-abliterated",
    max_tokens=1024,
    messages=[
        {
            "role": "user",
            "content": (
                "Explain this public, simplified Sigma-style rule in plain language. "
                "What process behavior does it look for, which Windows fields matter, "
                "and what false positives should an analyst expect?\n\n"
                + rule
            ),
        }
    ],
)

print(reply.choices[0].message.content)
print("request:", reply.id)

Set max_tokens (or max_completion_tokens). If you omit an output limit on Chat Completions, the gateway reserves credit up to the model's maximum output: 65,536 tokens on the Qwen ID and 32,768 on the DeepSeek ID. Every response includes an x-request-id header that matches the request in the console; the SDK also exposes reply.id.

Node: the same call

The Node SDK uses baseURL and apiKey. The request shape is otherwise unchanged.

import OpenAI from "openai";

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

const reply = await client.chat.completions.create({
  model: "qwen3.8-27b-abliterated",
  max_tokens: 1024,
  messages: [
    {
      role: "user",
      content:
        "Draft a high-level test plan outline for a web application assessment " +
        "we are already authorized to perform. Cover kickoff, scoping against " +
        "the written rules of engagement, documentation review, and the report " +
        "structure. Do not include exploit steps or payloads.",
    },
  ],
});

console.log(reply.choices[0].message.content);

curl, and listing models

If you want to confirm which IDs the gateway currently accepts, list them with your project key:

curl --fail-with-body https://api.commentllm.com/v1/models \
  -H "Authorization: Bearer $COMMENTLLM_API_KEY"

A non-streaming Chat Completions call looks like this:

curl https://api.commentllm.com/v1/chat/completions \
  -H "Authorization: Bearer $COMMENTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-27b-abliterated",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Explain this Sigma rule."}
    ]
  }'

Streaming

Set stream: true for Chat Completions. The server sends chat.completion.chunk events, then a chunk with usage, then data: [DONE].

stream = client.chat.completions.create(
    model="qwen3.8-27b-abliterated",
    max_tokens=1024,
    stream=True,
    messages=[
        {
            "role": "user",
            "content": "Draft a test plan outline for the engagement already in my scope.",
        }
    ],
)

for chunk in stream:
    delta = chunk.choices[0].delta.content if chunk.choices else None
    if delta:
        print(delta, end="", flush=True)

Equivalent curl:

curl -N https://api.commentllm.com/v1/chat/completions \
  -H "Authorization: Bearer $COMMENTLLM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.8-27b-abliterated",
    "stream": true,
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Draft a test plan for my scope."}]
  }'

One behavior that surprises people coming from other hosts: if a policy is configured to check responses, the gateway checks the whole answer before any text is sent, so the stream can arrive in one piece. If a stream fails partway, look up the x-request-id in Usage before retrying, because the gateway confirms the charge before it sends the final success event.

Which model ID to pass

Both public models are text-only and flagged preview. The context window is shared between input and output.

Model ID Context / max output Listed rate (per 1M tokens)
qwen3.8-27b-abliterated 262,144 / 65,536 $0.80 input, $0.08 cached input, $2.00 output
deepseek-v4.1-flash-1017-abliterated 1,048,576 / 32,768 $3.00 input, $0.30 cached input, $5.00 output

I start with Qwen 3.8 27B Abliterated for everyday detection write-ups. I switch to DeepSeek V4.1 Flash 1017 Abliterated when the prompt includes a long log pack, a large ruleset, or a coding-agent thread that needs the 1M-token window. Plans discount these listed rates; cached input is billed when the backend reports a cache hit.

Tool use and structured output are not currently available on either endpoint, so keep the client on plain Chat Completions or Messages until that changes.

The Anthropic-compatible option

If your tooling already uses the Anthropic SDK, you can call the same models through Messages. This is the important difference: the Anthropic client appends /v1/messages itself, so the base URL should be https://api.commentllm.com with no /v1 suffix. The OpenAI client needs the /v1.

import os
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.commentllm.com",
    api_key=os.environ["COMMENTLLM_API_KEY"],
)

reply = client.messages.create(
    model="deepseek-v4.1-flash-1017-abliterated",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Explain this Sigma rule."},
    ],
)

print(reply.content[0].text)

max_tokens is required on this endpoint. The same key and model IDs work on both protocols.

Authorized use, scope, and logging

Use this API only for work you are authorized to do: an agreed penetration test, a red-team engagement, detection engineering on data you already have, or AI red-team evaluation under policy. Accept the Acceptable Use Policy at sign-up. Accounts that break it are suspended.

The useful control is the gateway, not a promise that the model will never refuse. You can record written authorization as an engagement (client, reference, dates, and authorized hostnames or IPv4 ranges). When the scope policy is enforcing, the gateway blocks detected hostnames and IPv4 addresses that no active engagement lists. Keyword, pattern, or PII policies can also be attached. A blocked request is not billed.

Gateway logs keep metadata: request ID, model, tokens, cost, latency, status, and policy outcomes. Prompts, responses, and the text a policy matched are not stored, and that content is not used to train models. If you are on the Team plan, policy decision metadata can be exported to Splunk, Datadog, Elastic, or a webhook.

New organizations start at 60 requests per minute per key. An IP allowlist, if enabled, rejects other addresses with ip_not_allowed.

A short checklist

  1. Export COMMENTLLM_API_KEY.
  2. Point the OpenAI SDK at https://api.commentllm.com/v1, or the Anthropic SDK at https://api.commentllm.com.
  3. Pass qwen3.8-27b-abliterated or deepseek-v4.1-flash-1017-abliterated.
  4. Set max_tokens to something that fits the task.
  5. Configure engagement scope before you paste customer assets into a prompt.
  6. Use a harmless first prompt, such as explaining a public detection rule, and confirm the request appears in the console.

That is the whole integration: the SDK stays the same, the base URL and model ID change, and the gateway applies your organization's rules.

Aljay Miskino is VP of Partnerships at CommentLLM.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.