# OpenAI

> **Class** in `langchain_community`

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

OpenAI large language models.

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
OpenAI()
```

## Description

**Example:**

.. code-block:: python

from langchain_community.llms import OpenAI
openai = OpenAI(model_name="gpt-3.5-turbo-instruct")

## Extends

- `BaseOpenAI`

## Methods

- [`get_lc_namespace()`](https://reference.langchain.com/python/langchain-community/llms/openai/OpenAI/get_lc_namespace)

## ⚠️ Deprecated

Deprecated since version 0.0.10. Use langchain_openai.OpenAI instead. Will be removed in version 1.0.

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/7c10a5fa327f6aaaf7c932822a9e5d144891406e/libs/community/langchain_community/llms/openai.py#L733)