> ## 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.

# ConnectionConfig

> atoti\_ai\_openai.ConnectionConfig(\
>
>     \*,\
>
>     *api\_key*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *base\_url*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *organization\_id*: [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *custom\_headers*: [Mapping](https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping)\[[str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)] | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *max\_retries*: [int](https://docs.python.org/3/builtins/functions.html#int) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
>     *timeout*: [timedelta](https://docs.python.org/3/library/datetime.html#datetime.timedelta) | [None](https://docs.python.org/3/builtins/constants.html#None) = `None`,\
>
> )

Configuration for connecting to OpenAI.

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> import atoti as tt
>>> import os
>>> from atoti_ai import AiConfig
>>> from atoti_ai_openai import ConnectionConfig, ChatConfig
>>> connection_config = ConnectionConfig(
...     api_key=os.environ["AZURE_OPENAI_API_KEY"],
...     base_url="https://aiwopenai.openai.azure.com/openai/v1",
... )
>>> chat_config = ChatConfig(
...     model="gpt-5",
...     max_completion_tokens=5000,
... )
>>> ai_config = AiConfig(connection=connection_config, chat=chat_config)
>>> session_config = tt.SessionConfig(ai=ai_config)
```

**See also**:
The other [`ConnectionConfig`](./atoti_ai.config.ConnectionConfig#atoti_ai.ConnectionConfig) implementations.

### Attributes

#### *api\_key*

OpenAI API key for authentication.

#### *base\_url*

Base URL for the OpenAI API.

Useful for OpenAI-compatible providers.
The path to the API (such as `/v1`) must be included.

#### *organization\_id*

OpenAI organization ID.

#### *custom\_headers*

Custom HTTP headers to add to every request.

#### *max\_retries*

Maximum number of retries for requests to OpenAI.

#### *timeout*

Timeout for requests to OpenAI.
