# AI21

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/llms/ai21/AI21)

AI21 large language models.

To use, you should have the environment variable ``AI21_API_KEY``
set with your API key or pass it as a named parameter to the constructor.

## Signature

```python
AI21()
```

## Description

**Example:**

.. code-block:: python

from langchain_community.llms import AI21
ai21 = AI21(ai21_api_key="my-api-key", model="j2-jumbo-instruct")

## Extends

- `LLM`

## Properties

- `model`
- `temperature`
- `maxTokens`
- `minTokens`
- `topP`
- `presencePenalty`
- `countPenalty`
- `frequencyPenalty`
- `numResults`
- `logitBias`
- `ai21_api_key`
- `stop`
- `base_url`
- `model_config`

## Methods

- [`validate_environment()`](https://reference.langchain.com/python/langchain-community/llms/ai21/AI21/validate_environment)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/llms/ai21.py#L21)