> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Atoti Intelligence to use OpenAI in Python

> How to configure OpenAI as the LLM provider for Atoti Intelligence in an Atoti Python project, using `ConnectionConfig` and `ChatConfig` from `atoti_ai_openai` with `AiConfig`, including OpenAI-compatible providers.

<Info>
  ### Atoti Intelligence Essentials

  This is part of the Atoti Intelligence Essentials offer.
</Info>

This guide explains how to configure OpenAI as the LLM provider for Atoti Intelligence in an Atoti Python project.

<Note>
  ### Compatible APIs

  Many LLMs support the OpenAI API format. A model from another provider may be compatible with this configuration.
</Note>

## Prerequisites

Before configuring OpenAI, ensure the following requirements are met:

* An Atoti Python project
* An OpenAI account with API access, or a compatible provider
* An OpenAI API key

## Install the package

```bash theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
uv add "atoti[ai-openai]"
```

## Configure the LLM

Use [`ConnectionConfig`](https://docs.activeviam.com/products/atoti/python-sdk/latest/api/atoti_ai_openai.connection_config.html) and [`ChatConfig`](https://docs.activeviam.com/products/atoti/python-sdk/latest/api/atoti_ai_openai.chat_config.html) from `atoti_ai_openai` to configure the LLM connection, then pass them to [`AiConfig`](https://docs.activeviam.com/products/atoti/python-sdk/latest/api/atoti_ai.ai_config.html).

The following example uses Azure OpenAI, an OpenAI-compatible provider. Adapt the `base_url` and environment variable names for other providers.

<OpenAiAiConfig />

Then pass the config to the session through [`SessionConfig`](https://docs.activeviam.com/products/atoti/python-sdk/latest/api/atoti.config.session_config.html):

```python theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
session = tt.Session.start(tt.SessionConfig(ai=ai_config))
```

### `ConnectionConfig` parameters

<OpenAiConnectionParams />

### `ChatConfig` parameters

<OpenAiChatParams />

## Verify the configuration

After completing the configuration, verify that the LLM connection works:

1. Start the Atoti session.
2. Open the Atoti UI.
3. Test an AI feature such as Visualize This or Auto-Explain.

## Related reading

After configuring OpenAI, proceed to set up AI features:

* [Set up Auto-Explain in Python](../auto-explain/setup-python)
* [Set up Visualize This in Python](../visualize-this/setup-python)
* [`atoti_ai_openai`](https://docs.activeviam.com/products/atoti/python-sdk/latest/api/atoti_ai_openai.html) API reference
