Advertise hereReach developers building with AI coding agents. →
Grok Bot Coding

The Grok API now lets you tell the model which content to decline, per request

xAI added a guidelines parameter to the Grok API. You pass a list of policies, each with a category (adult content, violence or profanity) and the behavior decline, and the model will refuse that kind of content for that request. It works with Chat Completions, the Responses API and the xAI Python SDK; with the OpenAI SDK you send it through extra_body. Because it's set per request, one app can use stricter rules for kids or customer support and looser ones elsewhere. It isn't supported on multi-agent models or deferred completions, and invalid settings return a 400 or 422 error.

Why it matters

Apps for kids, schools or brands need tighter content rules than a general chatbot. Now you can set them in the API call instead of building your own filter.

Who it's for

Developers building on the Grok API for customer support, education, kids' apps or brand-safe products.

How to try it

  1. Add a guidelines array to your request, for example {"type": "policy", "category": "profanity", "behavior": "decline"}.
  2. If you use the OpenAI SDK, pass the guidelines inside extra_body.
  3. Test a few borderline prompts to confirm the model declines what you expect, and handle 400 and 422 errors in your code.

Plan & availability: Available to all Grok API customers. Not supported on multi-agent models such as grok-4.20-multi-agent, or with deferred completions. Checked October 29, 2026.

Share on X

Source: @xAI on docs.x.ai

Written by AgentStackList from the original post. Checked Oct 29, 2026. Features, plans and availability can change, so confirm on the source before you rely on it.

grok-apixaicontent-moderationdevelopersbrand-safety

More Grok Bot tricks

All Grok Bot tricks →