Skip to main content
POST
/
policy
/
chat
/
completions
curl --request POST \ --url https://api.abliteration.ai/policy/chat/completions \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data ' { "model": "abliterated-model", "messages": [ { "role": "user", "content": "Summarize our support refund policy." } ], "policy_id": "policy-gateway", "policy_target": "support-bot", "stream": false } '
{
  "id": "chatcmpl-policy-123",
  "object": "chat.completion",
  "created": 1735958400,
  "model": "abliterated-model",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Here is a brief summary of the refund policy."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 18,
    "completion_tokens": 12,
    "total_tokens": 30
  },
  "remaining_credits": 48,
  "estimated_credits_used": 1,
  "estimated_cost_usd": 0.00015,
  "policy": {
    "policy_id": "policy-gateway",
    "decision": "allow",
    "effective_decision": "allow",
    "reason_code": "ALLOW",
    "triggered_categories": [],
    "allowlist_hits": [
      "refund policy"
    ],
    "denylist_hits": [],
    "rollout_mode": "enforced",
    "enforced": true,
    "policy_target": "support-bot"
  }
}

Authorizations

Authorization
string
header
required

Use a JWT or API key as a Bearer token.

Headers

X-Policy-Target
string

Optional target label used for shadow/canary rollout targeting.

X-Policy-User
string

Optional end-user identifier for per-user quotas.

X-Policy-Project
string

Optional project identifier when using JWT auth or project budgets.

Body

application/json
model
string
required

Model id.

messages
object[]
required

Conversation messages. content can be a string or a list of parts for multimodal requests.

temperature
number

Sampling temperature.

Required range: 0 <= x <= 2
top_p
number
Required range: 0 <= x <= 1
n
integer
Required range: x >= 1
stream
boolean
default:false
max_tokens
integer
Required range: x >= 1
stop
presence_penalty
number
Required range: -2 <= x <= 2
frequency_penalty
number
Required range: -2 <= x <= 2
user
string

End-user identifier for abuse monitoring.

flagged_categories
string[]

Optional moderation categories to block for this request. Supported: harassment, hate, illicit, sexual. Self-harm and sexual/minors are always blocked.

policy_id
string

Optional policy id to validate against the saved policy.

policy_target
string

Optional rollout target label for shadow/canary targeting.

policy
object

Optional inline policy config. Overrides the saved policy for this request.

policy_user
string

Optional end-user identifier for per-user quota enforcement.

policy_project_id
string

Optional project identifier for project key budgets and usage tracking.

Response

Policy-enforced chat completion response

id
string
required
object
enum<string>
required
Available options:
chat.completion
created
integer
required
model
string
required
choices
object[]
required
usage
object
remaining_credits
integer | null
estimated_credits_used
integer
estimated_cost_usd
number
policy
object