# Content Moderation

### Overview

The Kidjig API provides robust content moderation capabilities for both input (user prompts) and output (AI responses) across all AI providers. This feature helps ensure that interactions with AI models remain safe, appropriate, and aligned with content guidelines.

### Key Features

* **Input Moderation**: Automatically checks user prompts for harmful content before sending to AI models
* **Output Moderation**: Filters AI responses for harmful content

### How to Use Content Moderation

You can enable content moderation by adding moderation parameters to your API requests:

```json
{
  "model": "claude-3-5-sonnet-20241022",
  "prompt": "Tell me about coffee brewing methods",
  "stream": false,
  "input_moderation": true,
  "output_moderation": true
}
```

#### Moderation Parameters <a href="#moderation-parameters" id="moderation-parameters"></a>

| Parameter           | Type    | Default | Description                                                             |
| ------------------- | ------- | ------- | ----------------------------------------------------------------------- |
| `input_moderation`  | boolean | false   | When enabled, checks user prompts for harmful content before processing |
| `output_moderation` | boolean | false   | When enabled, filters AI responses for harmful content                  |

### Moderation Categories <a href="#moderation-categories" id="moderation-categories"></a>

The system checks for the following categories of harmful content:

* **Violence**: Violence, weapons, harm
* **Hate**: Hate speech, racism, discrimination
* **Harassment**: Harassment, bullying, threats
* **Self-Harm**: Suicide, self-harm, eating disorders
* **Sexual**: Sexual content, pornography
* **Shocking**: Vulgar language, shocking content
* **Illegal**: Illegal activities, drugs, hacking
* **Deception**: Scams, fraud, deception

### Error Handling <a href="#error-handling" id="error-handling"></a>

When moderation detects harmful content in a user prompt or AI response, the API returns a 403 Forbidden response with a user-friendly message:

{% code overflow="wrap" %}

```json
{
  "success": false,
  "statusCode": 403,
  "message": "For your safety and in accordance with our content guidelines, I can't provide information on this topic. I'd be happy to help with other questions instead."
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kidjig.gitbook.io/kidjig-docs/api-provider/text-models-llm/content-moderation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
