# OpenAIModerationChain

> **Class** in `langchain_classic`

📖 [View in docs](https://reference.langchain.com/python/langchain-classic/chains/moderation/OpenAIModerationChain)

Pass input through a moderation endpoint.

To use, you should have the `openai` python package installed, and the
environment variable `OPENAI_API_KEY` set with your API key.

Any parameters that are valid to be passed to the openai.create call can be passed
in, even if not explicitly saved on this class.

## Signature

```python
OpenAIModerationChain()
```

## Description

**Example:**

```python
from langchain_classic.chains import OpenAIModerationChain

moderation = OpenAIModerationChain()
```

## Extends

- `Chain`

## Properties

- `client`
- `async_client`
- `model_name`
- `error`
- `input_key`
- `output_key`
- `openai_api_key`
- `openai_organization`
- `openai_pre_1_0`
- `input_keys`
- `output_keys`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-classic/chains/moderation/OpenAIModerationChain/validate_environment)

---

[View source on GitHub](https://github.com/langchain-ai/langchain/blob/fb6ab993a73180538f6cca876b3c85d46c08845f/libs/langchain/langchain_classic/chains/moderation.py#L16)