xAI adds a guidelines field to the Grok API for per-request moderation of NSFW, violence and profanity
On Oct 28 xAI announced on the official @grok account that all API customers can now add a guidelines array to text requests and set the nsfw, violence and profanity categories to decline, so Grok tightens that content while it writes rather than through after-the-fact filtering. The field works on the Responses API, Chat Completions and the xAI Python SDK; multi-agent models and deferred completions are not supported, and invalid values are rejected with 400 or 422 before the model runs.

Key Takeaways
- Three categories: nsfw, violence and profanity; the only behavior today is decline, and unlisted categories keep the default (docs)
- Works on the Responses API, Chat Completions and chat.create in the xAI Python SDK; with the OpenAI Python SDK pass it via extra_body
- Applies only to the request that carries it, so send it on every turn; the xAI SDK chat object stores it for you
- Not supported on multi-agent models such as grok-4.20-multi-agent or deferred completions; duplicate categories return 400 and unknown values return 422
- The official post had about 592K views and 271 likes when this was written