# Custom moderation controls

By Steven Van · 2026-10-01

Developers can set nsfw, violence and profanity handling per request on Chat Completions and the Responses API, with decline as the only behavior so far.

Grok's text API now accepts a guidelines array that sets how the model handles three content categories. [Grok](<https://creatorstoolbox.com/tools/grok>) takes the array on [Chat Completions and Responses API requests](<https://docs.x.ai/developers/advanced-api-usage/custom-moderation-controls>), and follows it while writing its response.

## Categories and behaviors

Each entry has a type (always "policy"), a category and a behavior. The only behavior available today is decline. Categories left out keep the model's default moderation.

- **nsfw:** avoids sexual innuendo and sexualized conversations, but still answers educational and clinical questions about sexual topics.

- **violence:** avoids graphic violence, while engaging with history and news without graphic detail.

- **profanity:** writes without profanity. Grok declines when the request is for profanity alone, or is highly offensive.

These descriptions are high level, and the vendor says details may be refined over time. The response has the same shape as one without guidelines.

## Using it in a request

On the Responses API, guidelines is a top-level field in the request body. On Chat Completions it is also top-level, at the same level as messages. In the xAI Python SDK, pass guidelines to chat.create, which stores them on the chat so every sample call sends them. The OpenAI SDKs do not define the field: the Python SDK needs it in extra\_body, while the JavaScript SDK sends it with the other request parameters.

Guidelines apply only to the request that carries them, so a whole conversation needs them on every request.

## Limits and errors

Guidelines do not currently work with multi-agent models such as grok-4.20-multi-agent, or with deferred completions. A request with no server-side tools and no file attachments also cannot use them if it sets stop or sets n above 1. These requests are rejected with a 400 before the model runs.

The API checks guidelines before running the model. An unknown category or behavior returns 422 with the valid values. A repeated category, a type other than "policy", or an unsupported request returns 400. In the xAI Python SDK, an unknown category or behavior raises ValueError before the request is sent.

![Grok](<https://www.google.com/s2/favicons?domain=grok.com&sz=128>)

Grok

AI assistant by xAI — chat, reason, generate images, and analyze data with real-time information access.

[View Grok →](<https://creatorstoolbox.com/tools/grok>)

Sources

[Original source](<https://docs.x.ai/developers/release-notes#custom-moderation-controls>)

[Read Custom moderation controls on Creators Toolbox](<https://creatorstoolbox.com/blog/grok-custom-moderation-controls>)

---
Canonical source: https://creatorstoolbox.com/blog/grok-custom-moderation-controls
