# DeepInfra

> **Class** in `langchain_community`

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

DeepInfra models.

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

Only supports `text-generation` and `text2text-generation` for now.

## Signature

```python
DeepInfra()
```

## Description

**Example:**

.. code-block:: python

from langchain_community.llms import DeepInfra
di = DeepInfra(model_id="google/flan-t5-xl",
                    deepinfra_api_token="my-api-key")

## Extends

- `LLM`

## Properties

- `model_id`
- `model_kwargs`
- `deepinfra_api_token`
- `model_config`

## Methods

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

---

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