How a policy gateway works on an OpenAI-compatible API
Update, 26 November 2026: CommentLLM's catalog has changed since this post was published. Qwen 3.8 27B Abliterated and DeepSeek V4.1 Flash 1017 Abliterated are no longer listed. The current generally available models, each with a 1,048,576-token context window and a 32,768-token output cap, are GLM 5.3 Abliterated (glm-5.3-abliterated), GLM 5.3 Flash Abliterated (glm-5.3-flash-abliterated), DeepSeek V4.1 Flash Abliterated (deepseek-v4.1-flash-abliterated), and DeepSeek V4.1 Flash Abliterated Fast (deepseek-v4.1-flash-abliterated-fast). Current rates are on the CommentLLM pricing page. The article below stays as a dated record.
The usual way to call a hosted model is familiar: an official OpenAI client, a base URL, a key, and chat.completions.create. For authorized security work, the interesting part is not the client. It is what sits in front of inference.
A policy gateway is that layer. You still point the SDK at an OpenAI-compatible endpoint. Before a prompt reaches the model, and often again before a response is returned, the gateway applies the organization's rules. The client code looks ordinary. The control point is in the request path.
This walkthrough follows that path as it works today on CommentLLM, a hosted API for abliterated models used in authorized security work. The mechanics below are from the public API docs and trust page, checked on 23 November 2026.
The request still looks like Chat Completions
Keep the SDK you already use, point it at https://api.commentllm.com/v1, and send a project key that starts with cllm_. The path is the usual /v1/chat/completions. Accepted fields include the ones you already know: model, messages, stream, max_tokens or max_completion_tokens, temperature, and a handful of sampling controls. n must be 1. Tool use (function calling) is supported on both the Chat Completions and Messages endpoints; see the docs. Images and structured output (response_format) are not supported.
CommentLLM adds one extra field, policy_ids, for policies that run only when a request names them.
Authentication is a bearer token. The x-api-key header also works. If the organization has an IP allowlist, a request from any other address is rejected with ip_not_allowed. Model requests also require an accepted acceptable use policy, which you accept at sign-up.
The two public models, both flagged preview as of that date, are qwen3.8-27b-abliterated and deepseek-v4.1-flash-1017-abliterated. Re-check the public catalog before you rely on a rate or a limit. Abliteration reduces refusal behavior; it does not replace the policies and engagement scope you configure.
What the gateway does before the model sees the prompt
Policies run in the gateway. You write them in the console. They are not a system prompt you hope the model will obey.
On the way in, every live policy that applies to the request can inspect the content. The public policy types are:
- PII and secrets, for things like emails, phone numbers, US SSNs, card numbers that pass a Luhn check, AWS access keys, private keys, and JWTs.
- Keywords, a case-insensitive list, such as client names, hostnames, or code names.
- Pattern, a regular expression of up to 300 characters.
- Scope, which looks for hostnames and IPv4 addresses that no active engagement lists.
- Model-judged, a yes or no question about the content, answered by a model. If the judge cannot answer, an enforcing policy blocks and a monitoring policy logs the error and continues.
A policy is not live just because you typed it. It has three stages: draft, where nothing runs; monitoring, where matches are logged as flagged and the request continues; and enforcing, where a match is redacted or the request is blocked. Publishing creates a numbered version. The gateway always runs the live version, so editing a draft changes nothing until you publish.
That "watch first, enforce later" sequence is the practical part. You can learn whether a keyword list is too broad before you start returning errors to a tester mid-engagement.
Scope is a policy, backed by an engagement record
The scope check is only as good as the engagement behind it. An engagement records written authorization: the client, the authorization reference, the dates, and the authorized targets. When the scope policy is enabled and enforcing, detected hosts and IPv4 addresses that no active engagement lists are blocked. An engagement is active when its status is Active and the current date falls within its window. Drafts and closed engagements allow nothing.
A name such as acme.example covers that host and its subdomains; a single address or a CIDR covers the matching IPv4 range. An engagement tied to a project applies only to keys in that project; one without a project applies to the whole organization.
The check cannot identify every possible reference to a target. That limitation belongs in any security review. It is still a stronger control than hoping the model will remember a paragraph in a system prompt.
What a block looks like to the client
If an enforcing policy blocks the request, the Chat Completions error shape is preserved: an error object with message, type, and code. The status is 403, the code is policy_violation, and the body names the policy and the reason, for example that a host is not in an active engagement. A blocked request is not billed.
That last point is a product choice as much as a billing one. If you charge for an answer you refused to give, people will treat the policy as a tax.
Redaction is the other enforcing action: the match is replaced, for example with [REDACTED:email], and the request continues. Use redact when the work can proceed without the matched text. Use block when the request itself is out of bounds.
Policies that check responses run after inference. If you are streaming and a policy checks the response, the docs say the whole answer is checked before any text is sent, so the stream arrives in one piece. Plan for that if your client expects the first token immediately.
What gets logged, and what does not
Every response includes x-request-id, which is the ID that logs and usage show for that request, plus rate-limit headers for the current minute.
The gateway processes prompts and responses long enough to apply policies. It does not keep them. Per the trust page, stored metadata is the request ID and model, token counts and cost, latency and status, and policy outcomes. Prompts, responses, and the text a policy matched are not stored. That content is not used to train models. CommentLLM runs its models on its own private cloud, on GPUs that are dedicated to and isolated for each customer, so prompts are not sent to a third-party inference provider. Decision records use counts — for example, two emails, one phone — never the matched text.
If you export to a SIEM after a policy-checked request, the event is the same kind of metadata: policy names, outcomes, and counts, delivered to Splunk, Datadog, Elastic, or a webhook. Endpoints have to use HTTPS.
This is the right model if you do not want engagement text sitting in a vendor log, and the wrong one to assume if your auditors expect to replay prompts.
Why this belongs in front of an OpenAI-compatible API
Teams already have clients, coding agents, and evaluation harnesses that speak OpenAI's Chat Completions API. A gateway that requires a custom SDK will not be used on the week you need it. A gateway that speaks the protocol you already call can apply engagement scope, redaction, and an audit trail without asking every tool to change.
The client still looks like this: change the base URL, pick a model ID, send the key. The authorization and the policy set live in the gateway, which is where a rule can actually fire. Re-check the docs when you implement; the public models are still in preview.
Written by Aljay Miskino, VP of Partnerships at CommentLLM. Use these models only on systems you're authorized to test; see the acceptable use policy.